apiVersion: batch/v1
kind: Job
metadata:
  name: deploy-database-config
spec:
  ttlSecondsAfterFinished: 100
  template:
    spec:
      containers:
        - name: deployment-container
          image: localhost:32000/crimson_deployment:latest
          env:
            - name: EXECUTE_LIQUIBASE
              value: "true"
            - name: EXECUTE_DEPLOYMENT
              value: "true"
            - name: EXECUTE_TEMPLATES
              value: "true"
            - name: DB_PASS
              valueFrom:
                secretKeyRef:
                  name: db-credentials
                  key: dbPassword
            - name: DB_PORT
              valueFrom:
                configMapKeyRef:
                  name: db-config
                  key: port
            - name: DB_USER
              valueFrom:
                configMapKeyRef:
                  name: db-config
                  key: user
            - name: DB_NAME
              valueFrom:
                configMapKeyRef:
                  name: db-config
                  key: name
            - name: DB_HOST
              valueFrom:
                secretKeyRef:
                  name: db-credentials
                  key: dbHost
      restartPolicy: Never