apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: execpid-cleaner
  namespace: kube-system
spec:
  selector:
    matchLabels:
      name: execpid-cleaner
  template:
    metadata:
      labels:
        name: execpid-cleaner
    spec:
      tolerations:
      - operator: Exists
        effect: NoSchedule
      terminationGracePeriodSeconds: 5
      containers:
      - name: execpid-cleaner
        image: image-registry.openshift-image-registry.svc:5000/openshift/tools:latest
        command:
        - sh
        - -c
        - |
          set -euo pipefail
          while true; do
              printf "%s Running cleanup:\n" "$(date)"
              set -x
              find /run/crio/exec-pid-dir -type f -mmin +15 -exec rm -f {} \;
              sleep 15m
              set +x
          done
        securityContext:
          privileged: true
        resources:
          limits:
            memory: 64Mi
          requests:
            memory: 64Mi
        volumeMounts:
        - name: exec-pid-dir
          mountPath: /run/crio/exec-pid-dir
      volumes:
      - name: exec-pid-dir
        hostPath:
          path: /run/crio/exec-pid-dir
