---
apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: deployments-pruner
  namespace: openshift-sre-pruning
spec:
  failedJobsHistoryLimit: 5
  successfulJobsHistoryLimit: 3
  concurrencyPolicy: Replace
  schedule: "0 */1 * * *"
  jobTemplate:
    spec:
      template:
        spec:
          serviceAccountName: sre-pruner-sa
          restartPolicy: Never
          containers:
          - name: deployments-pruner
            image: image-registry.openshift-image-registry.svc:5000/openshift/cli:latest
            imagePullPolicy: Always
            command:
            - oc
            - adm
            - prune
            - deployments
            - --keep-complete=1
            - --keep-younger-than=24h
            - --keep-failed=1
            - --confirm
