apiVersion: batch/v1
kind: Job
metadata:
  name: server-migrations-job
spec:
  template:
    spec:
      containers:
        - name: server
          image: bblaise/currency-converter-server
          command: ['python', 'manage.py', 'migrate']
          env:
            - name: DB_USER
              value: postgres
            - name: DB_HOST
              value: postgres-cluster-ip-service
            - name: DB_PORT
              value: '5432'
            - name: DB_NAME
              value: postgres
            - name: DB_PASS
              valueFrom:
                secretKeyRef:
                  name: pgpassword
                  key: PGPASSWORD
      restartPolicy: Never
  backoffLimit: 5
