---
apiVersion: v1
kind: Pod
metadata:
  name: "{{ .Release.Name }}-{{ randAlpha 5 | lower }}-test"
  annotations:
    "helm.sh/hook": test-success
spec:
  containers:
  - name: "{{ .Release.Name }}-{{ randAlpha 5 | lower }}-test"
    image: "{{ .Values.image }}:{{ .Values.imageTag }}"
    command:
      - "sh"
      - "-c"
      - |
        #!/usr/bin/env bash -e
        curl -XGET --fail '{{ template "elasticsearch.uname" . }}:{{ .Values.httpPort }}/_cluster/health?{{ .Values.clusterHealthCheckParams }}'
  restartPolicy: Never
