apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: registry-image-pruner
spec:
  schedule: "0 0 * * *"
  jobTemplate:
    spec:
      template:
        metadata:
          labels:
            parent: "cronjob-registry-image-pruner"
        spec:
          serviceAccountName: image-pruner
          nodeSelector:
            type: 'master'
          containers:
          - name: registry-image-pruner
            image: "{{ registry_pruner_image }}"
            imagePullPolicy: Always
            env:
            - name: API_URL
              value: "{{ openshift_public_hostname }}"
            - name: KEEP_REVISIONS
              value: "{{ registry_pruner_keep_revisions|default('4') }}"
            - name: IMAGE_AGE
              value: "{{ registry_pruner_image_age|default('1000h') }}"
            command: ["/usr/bin/prune-images.sh"]
          restartPolicy: OnFailure
