apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: migrate
spec:
  schedule: "0 0 1 * 0"
  suspend: true # this is only used as a --from= for jobs, hence doesn't run auto
  jobTemplate:
    spec:
      template:
        spec:
          restartPolicy: Never
          containers:
          - name: migrate
            image: registry/project/repo/migrate
            # note: change `update` to `init` for your initial migration
            command: [automig_pg, update]
            env:
            - name: AUTOMIG_CON
              valueFrom:
                secretKeyRef:
                  name: database-credentials
                  key: libpq-url
            - name: PGCONNECT_TIMEOUT
              value: "10"
          imagePullSecrets:
          - name: regcred
