apiVersion: v1
kind: Pod
metadata:
  name: "{{ printf "%s-%s" .Release.Name .Values.Name | trunc 56 }}-test"
  annotations:
    "helm.sh/hook": test-success
{{- if and (.Values.NetworkPolicy.Enabled) (not .Values.NetworkPolicy.AllowExternal) }}
  labels:
    "{{.Release.Name}}-{{.Values.Component}}-client": true
{{- end }}
spec:
  containers:
  - name: "client-test"
    image: "{{ .Values.Image }}:{{ .Values.ImageTag }}"
    imagePullPolicy: "{{ .Values.ImagePullPolicy }}"
    command:
      - "/cockroach/cockroach"
      - "sql"
      - "--insecure"
      - "--host"
      - "{{ printf "%s-%s" .Release.Name .Values.Name | trunc 56 }}-public.{{ .Release.Namespace }}"
      - "--port"
      - "{{ .Values.ExternalGrpcPort }}"
      - "-e"
      - "SHOW DATABASES;"
  restartPolicy: Never
