apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: load-nomis-slots
spec:
  schedule: "0 0 * * *"
  concurrencyPolicy: Forbid
  successfulJobsHistoryLimit: 3
  failedJobsHistoryLimit: 3
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: prison-visits-booking-staff-load-nomis-slots
            image: 754256621582.dkr.ecr.eu-west-2.amazonaws.com/prison-visits-booking/prison-visits-staff:latest
            imagePullPolicy: Always
            command: ['sh', '-c', "bundle exec rake pvb:load_nomis_slots"]
            envFrom:
              - configMapRef:
                  name: shared-environment
              - secretRef:
                  name: secrets
            env:
              - name: DATABASE_URL
                valueFrom:
                  secretKeyRef:
                    name: prison-visits-rds-instance-output
                    key: url
          restartPolicy: OnFailure
