apiVersion: batch/v1
kind: Job
metadata:
  name: migrate-budgetsh-latest
  namespace: budgetsh
spec:
  template:
    spec:
      containers:
        - name: migrate-budgetsh-latest
          image: djquan/budget.sh-backend:latest
          command: ["bin/budgetsh", "eval", "BudgetSH.Release.migrate"]
          env:
            - name: POSTGRES_HOST
              valueFrom:
                secretKeyRef:
                  name: postgres
                  key: postgres-host
            - name: POSTGRES_PRODUCTION_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: postgres
                  key: postgres-password
            - name: SECRET_KEY_BASE
              valueFrom:
                secretKeyRef:
                  name: budgetsh
                  key: secret-key-base
            - name: SESSION_SALT
              valueFrom:
                secretKeyRef:
                  name: budgetsh
                  key: session-salt
      restartPolicy: Never
  backoffLimit: 4
