---
apiVersion: apps/v1
kind: DaemonSet
metadata:
  labels:
    app: umount-mnt-dir
  name: umount-mnt-dir
  namespace: kube-system
spec:
  selector:
    matchLabels:
      app: umount-mnt-dir
  template:
    metadata:
      labels:
        app: umount-mnt-dir
    spec:
      containers:
        - command:
            - nsenter
            - --target
            - "1"
            - --mount
            - --uts
            - --ipc
            - --net
            - --pid
            - --
            - sh
            - -c
            - |
              echo "before umount:"
              df -h
              umount /mnt
              echo "after umount:"
              df -h
              sleep 600000000s
          image: mcr.microsoft.com/oss/nginx/nginx:1.17.3-alpine
          imagePullPolicy: IfNotPresent
          name: umount-mnt-dir
          resources:
            requests:
              cpu: 10m
          securityContext:
            privileged: true
      hostPID: true
      nodeSelector:
        kubernetes.io/os: linux
      tolerations:
        - effect: NoSchedule
          operator: Exists
      restartPolicy: Always
  updateStrategy:
    type: OnDelete
