apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: pmem-csi-intel-com-node-testing
  namespace: default
  labels:
    app.kubernetes.io/name: pmem-csi-node-testing
    app.kubernetes.io/part-of: pmem-csi
    app.kubernetes.io/component: node-testing
    app.kubernetes.io/instance: pmem-csi.intel.com
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: pmem-csi-node-testing
      app.kubernetes.io/instance: pmem-csi.intel.com
  template:
    metadata:
      labels:
        app.kubernetes.io/name: pmem-csi-node-testing
        app.kubernetes.io/part-of: pmem-csi
        app.kubernetes.io/component: node-testing
        app.kubernetes.io/instance: pmem-csi.intel.com
        pmem-csi.intel.com/webhook: ignore
    spec:
      hostNetwork: true
      containers:
      - name: socat
        image: alpine/socat:1.0.3
        args:
        - -s
        - tcp-listen:9735,fork,reuseaddr # port 9735 *on the host*
        - unix-connect:/csi/csi.sock
        securityContext:
          privileged: true
        volumeMounts:
        - name: socket-dir
          mountPath: /csi
        # mountpoint-dir and staging-dir are needed for creating directories during sanity testing.
        - name: mountpoint-dir
          mountPath: /var/lib/kubelet/pods
          mountPropagation: Bidirectional
        - name: staging-dir
          mountPath: /var/lib/kubelet/plugins/kubernetes.io/csi/pv # preliminary (?), https://github.com/kubernetes-csi/docs/issues/130
          mountPropagation: Bidirectional
      volumes:
      - hostPath:
          path: /var/lib/kubelet/plugins/pmem-csi.intel.com
          type: DirectoryOrCreate
        name: socket-dir
      - hostPath:
          path: /var/lib/kubelet/plugins/kubernetes.io/csi/pv
          type: DirectoryOrCreate
        name: staging-dir
      - hostPath:
          path: /var/lib/kubelet/pods
          type: DirectoryOrCreate
        name: mountpoint-dir
