apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: bz2008282-pruner
  namespace: openshift
spec:
  failedJobsHistoryLimit: 5
  successfulJobsHistoryLimit: 3
  concurrencyPolicy: Replace
  schedule: "*/7 * * * *"
  jobTemplate:
    spec:
      template:
        spec:
          affinity:
            nodeAffinity:
              preferredDuringSchedulingIgnoredDuringExecution:
              - preference:
                  matchExpressions:
                  - key: node-role.kubernetes.io/infra
                    operator: Exists
                weight: 1
          tolerations:
            - effect: NoSchedule
              key: node-role.kubernetes.io/infra
              operator: Exists
          serviceAccountName: bz2008282-pruning-sa
          restartPolicy: Never
          containers:
          - name: bz2008282-pruner
            image: quay.io/openshift/origin-cli:4.8 ## needs to be this instead of the local CLI image so that this can run always
            imagePullPolicy: Always
            args:
            - /bin/bash
            - -c
            - >-
              oc delete secret/samples-registry-credentials
              --namespace openshift
              --ignore-not-found
