kind: DaemonSet
apiVersion: apps/v1
metadata:
  name: ananas
  namespace: ananas
spec:
  selector:
    matchLabels:
      app: ananas
  template:
    metadata:
      labels:
        app: ananas
        role: csi-azure
    spec:
      serviceAccount: ananas
      hostNetwork: true
      containers:
        - name: driver-registrar
          image: mcr.microsoft.com/oss/kubernetes-csi/csi-node-driver-registrar:v2.2.0
          args:
            - --csi-address=$(ADDRESS)
            - --kubelet-registration-path=$(DRIVER_REG_SOCK_PATH)
            - --v=2
          volumeMounts:
            - name: plugin-dir
              mountPath: /csi
            - name: registration-dir
              mountPath: /registration
          env:
            - name: ADDRESS
              value: /csi/csi.sock
            - name: DRIVER_REG_SOCK_PATH
              value: /var/lib/kubelet/plugins/ananas.noah.csi.com/csi.sock
        - name: csi-ananas
          image: toughnoah/ananas:v1.0
          args :
            - "--node=$(KUBE_NODE_NAME)"
          env:
            - name: KUBE_NODE_NAME
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: spec.nodeName
          imagePullPolicy: "Always"
          securityContext:
            privileged: true
            capabilities:
              add: ["SYS_ADMIN"]
            allowPrivilegeEscalation: true
          volumeMounts:
            - name: plugin-dir
              mountPath: /csi
            - name: pods-mount-dir
              mountPath: /var/lib/kubelet
              mountPropagation: "Bidirectional"
            - name: device-dir
              mountPath: /dev
            - name: cloud-config-dir
              mountPath: /etc/kubernetes
      volumes:
        - name: plugin-dir
          hostPath:
            path: /var/lib/kubelet/plugins/ananas.noah.csi.com
            type: DirectoryOrCreate
        - name: pods-mount-dir
          hostPath:
            path: /var/lib/kubelet
            type: Directory
        - name: device-dir
          hostPath:
            path: /dev
        - name: cloud-config-dir
          hostPath:
            path: /etc/kubernetes
            type: Directory
        - hostPath:
            path: /var/lib/kubelet/plugins_registry/
            type: DirectoryOrCreate
          name: registration-dir
