kind: DaemonSet
apiVersion: apps/v1
metadata:
  name: csi-gce-pd-node
  namespace: testNamespace
spec:
  selector:
    matchLabels:
      app: gcp-compute-persistent-disk-csi-driver
  template:
    metadata:
      labels:
        app: gcp-compute-persistent-disk-csi-driver
    spec:
      priorityClassName: csi-gce-pd-node
      serviceAccountName: csi-gce-pd-node-sa
      nodeSelector:
        kubernetes.io/os: linux
      containers:
        - name: csi-driver-registrar
          image: csi-registrar:v0.0.0
          imagePullPolicy: IfNotPresent
          args:
            - "--v=5"
            - "--csi-address=/csi/csi.sock"
            - "--kubelet-registration-path=/var/lib/kubelet/plugins/gcp.csi.confidential.cloud/csi.sock"
          env:
            - name: KUBE_NODE_NAME
              valueFrom:
                fieldRef:
                  fieldPath: spec.nodeName
          volumeMounts:
            - name: plugin-dir
              mountPath: /csi
            - name: registration-dir
              mountPath: /registration
        - name: gce-pd-driver
          image: csi-driver:v0.0.0
          imagePullPolicy: IfNotPresent
          args:
            - "--v=5"
            - "--endpoint=unix:/csi/csi.sock"
            - "--run-controller-service=false"
            - "--kms-addr=kms.testNamespace:9000"
          securityContext:
            privileged: true
          volumeMounts:
            - name: kubelet-dir
              mountPath: /var/lib/kubelet
              mountPropagation: "Bidirectional"
            - name: plugin-dir
              mountPath: /csi
            - name: device-dir
              mountPath: /dev
            # The following mounts are required to trigger host udevadm from
            # container
            # But we don't want that, because it breaks cryptsetup
            # - name: udev-rules-etc
            #   mountPath: /etc/udev
            # - name: udev-rules-lib
            #   mountPath: /lib/udev
            # - name: udev-socket
            #   mountPath: /run/udev
            - name: sys
              mountPath: /sys
            - name: cryptsetup
              mountPath: /run/cryptsetup
      volumes:
        - name: registration-dir
          hostPath:
            path: /var/lib/kubelet/plugins_registry/
            type: Directory
        - name: kubelet-dir
          hostPath:
            path: /var/lib/kubelet
            type: Directory
        - name: plugin-dir
          hostPath:
            path: /var/lib/kubelet/plugins/gcp.csi.confidential.cloud/
            type: DirectoryOrCreate
        - name: device-dir
          hostPath:
            path: /dev
            type: Directory
        # The following mounts are required to trigger host udevadm from
        # container
        # But we don't want that, because it breaks cryptsetup
        # - name: udev-rules-etc
        #   hostPath:
        #     path: /etc/udev
        #     type: Directory
        # - name: udev-rules-lib
        #   hostPath:
        #     path: /lib/udev
        #     type: Directory
        # - name: udev-socket
        #   hostPath:
        #     path: /run/udev
        #     type: Directory
        - name: sys
          hostPath:
            path: /sys
            type: Directory
        - name: cryptsetup
          hostPath:
            path: /run/cryptsetup
            type: Directory
      # https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
      # See "special case". This will tolerate everything. Node component should
      # be scheduled on all nodes.
      tolerations:
      - operator: Exists
