apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: etcd-empty-dir-cleanup
  namespace: kube-system
spec:
  schedule: "0 2 * * *"
  concurrencyPolicy: "Forbid"
  jobTemplate:
    spec:
      template:
        metadata:
          name: etcd-empty-dir-cleanup
        spec:
          hostNetwork: true
          nodeSelector:
            kubernetes.io/role: master
          tolerations:
          - effect: NoSchedule
            key: node-role.kubernetes.io/master
          restartPolicy: OnFailure
          containers:
          - name: k8s-cleanup
            image: ghcr.io/anyfavors/k8s-cleanup:1.0.2
            command: ["/bin/bash", "/bin/etcd-empty-dir-cleanup.sh"]
            resources:
              requests:
                cpu: 100m
                memory: 50Mi
