apiVersion: batch/v1
kind: Job
metadata:
  name: mysql-employees-init
spec:
    ttlSecondsAfterFinished: 300
    template:
      spec:
        containers:
          - name: mysql-employees-init
            image: tdewin/mysql-employees
            command: ["/usr/sbin/mysql-employees"]
            args: ["-init"]
            env:
              - name: MYSQL_DB
                value: employees
              - name: MYSQL_SERVER
                value: tcp(mysql-demo:3306)
              - name: MYSQL_USERNAME
                value: root
              - name: MYSQL_PASSWORD
                valueFrom:
                  secretKeyRef:
                    key: mysql-root-password
                    name: mysql-demo
            volumeMounts:
              - name: mysql-configmap
                mountPath: /usr/share/mysql-employees
        volumes:
          - name: mysql-configmap
            configMap:
              name: mysql-configmap
        restartPolicy: Never
    backoffLimit: 1

