hjacobs/kube-janitor

PVCs: also check for references by CronJob

hjacobs opened this issue · 0 comments

Some CronJobs use Persistent Volumes which not be deleted between CronJob runs, e.g:

apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: "foobar"
spec:
  schedule: "0 23 * * *"
  concurrencyPolicy: Forbid
  failedJobsHistoryLimit: 1
  jobTemplate:
    spec:
      template:
        metadata:
          labels:
            application: "foobar"
        spec:
          restartPolicy: Never
          containers:
            - name: cont
              image: "my-docker-image"
              volumeMounts:
                - mountPath: "/data"
                  name: "foobar-data"
          volumes:
            - name: "foobar-data"
              persistentVolumeClaim:
                claimName: "foobar-data"

_context.pvc_is_not_referenced should be false for the PVC foobar-data in this case.