apiVersion: v1
kind: Pod
metadata:
  name: "{{ .Release.Name }}-sed-test"
  annotations:
    "helm.sh/hook": test-success
spec:
  containers:
    - name: "{{ .Release.Name }}-sed-test"
      image: "registry.access.redhat.com/rhscl/mysql-80-rhel7:latest"
      imagePullPolicy: "IfNotPresent"
      env:
        - name: MYSQL_HOST
          valueFrom:
            secretKeyRef:
              name: "io.servicebinding.{{ .Release.Name }}"
              key: host
        - name: MYSQL_USER
          valueFrom:
            secretKeyRef:
              name: "io.servicebinding.{{ .Release.Name }}"
              key: username
        - name: MYSQL_PASSWORD
          valueFrom:
            secretKeyRef:
              name: "io.servicebinding.{{ .Release.Name }}"
              key: password
        - name: MYSQL_DATABASE
          valueFrom:
            secretKeyRef:
              name: "io.servicebinding.{{ .Release.Name }}"
              key: database
        - name: MYSQL_PORT
          valueFrom:
            secretKeyRef:
              name: "io.servicebinding.{{ .Release.Name }}"
              key: port
      command:
        - /bin/bash
        - -ec
        - |
          mysql  -h $MYSQL_HOST  -u$MYSQL_USER -p$MYSQL_PASSWORD -P$MYSQL_PORT -D$MYSQL_DATABASE -e "select 1"
  restartPolicy: Never
