apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: kube-job-cleaner
  namespace: kube-system
  labels:
    application: kube-job-cleaner
    version: "master-12"
spec:
  schedule: "*/5 * * * *"
  concurrencyPolicy: Forbid
  failedJobsHistoryLimit: 1
  jobTemplate:
    spec:
      activeDeadlineSeconds: 120
      template:
        metadata:
          labels:
            application: kube-job-cleaner
            version: "master-12"
        spec:
          serviceAccountName: system
          restartPolicy: Never
          containers:
          - name: cleaner
            # delete all completed jobs
            image: registry.opensource.zalan.do/teapot/kube-job-cleaner:master-12
            resources:
              limits:
                cpu: 100m
                memory: 100Mi
              requests:
                cpu: 100m
                memory: 100Mi
