apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: cccd-archive-stale
spec:
  schedule: "5 0 * * *"
  concurrencyPolicy: Forbid
  successfulJobsHistoryLimit: 3
  failedJobsHistoryLimit: 3
  startingDeadlineSeconds: 300
  jobTemplate:
    spec:
      backoffLimit: 0
      ttlSecondsAfterFinished: 250000
      template:
        metadata:
          labels:
            tier: worker
        spec:
          restartPolicy: Never
          containers:
          - name: cronjob-worker
            image: 754256621582.dkr.ecr.eu-west-2.amazonaws.com/laa-get-paid/cccd:set-me
            imagePullPolicy: Always
            command:
              - bundle
              - exec
              - rake
              - claims:archive_stale

            envFrom:
            - configMapRef:
                name: cccd-app-config
            - secretRef:
                name: cccd-secrets

            env:
            - name: DATABASE_URL
              valueFrom:
                secretKeyRef:
                  name: cccd-rds
                  key: url
