kind: DaemonSet
apiVersion: apps/v1
metadata:
  name: datamon-csi-node-test
spec:
  selector:
    matchLabels:
      app: datamon-csi-driver
  updateStrategy:
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: datamon-csi-driver
    spec:
      serviceAccountName: datamon-csi-controller-sa
      hostNetwork: true
      containers:
        - name: csi-driver-registrar
          imagePullPolicy: Always
          image: quay.io/k8scsi/driver-registrar:v0.4.2
          args:
            - "--v=10"
            - "--csi-address=$(ADDRESS)"
            - "--kubelet-registration-path=/var/lib/kubelet/plugins/com.test.datamon.csi/csi.sock"
          env:
            - name: ADDRESS
              value: /var/lib/kubelet/plugins/com.test.datamon.csi/csi.sock
            - name: KUBE_NODE_NAME
              valueFrom:
                fieldRef:
                  fieldPath: spec.nodeName
          volumeMounts:
            - name: plugin-dir
              mountPath: /var/lib/kubelet/plugins/com.test.datamon.csi/
            - name: registration-dir
              mountPath: /registration
        - name: datamon-node-driver
          securityContext:
            privileged: true
          imagePullPolicy: Always
          image: gcr.io/onec-co/datamon-csi:csi
          args:
            - "--endpoint=$(CSI_ENDPOINT)"
            - "--nodeid=$(KUBE_NODE_NAME)"
            - "--server=true"
            - "--log-level=debug"
            - "--credential=/etc/datamon-creds/gcp-storage-admin.json"
            - "--localfs=/tmp"
          env:
            - name: CSI_ENDPOINT
              value: unix:/csi/csi.sock
            - name: KUBE_NODE_NAME
              valueFrom:
                fieldRef:
                  fieldPath: spec.nodeName
            - name: GOOGLE_APPLICATION_CREDENTIALS
              value: "/etc/datamon-creds/gcp-storage-admin.json"
          volumeMounts:
            - name: kubelet-dir
              mountPath: /var/lib/kubelet
              mountPropagation: "Bidirectional"
            - name: plugin-dir
              mountPath: /csi
            - name: credentials
              readOnly: true
              mountPath: "/etc/datamon-creds"
      volumes:
        - name: registration-dir
          hostPath:
            path: /var/lib/kubelet/plugins/
            type: Directory
        - name: kubelet-dir
          hostPath:
            path: /var/lib/kubelet
            type: Directory
        - name: plugin-dir
          hostPath:
            path: /var/lib/kubelet/plugins/com.test.datamon.csi/
            type: DirectoryOrCreate
        - name: credentials
          secret:
            secretName: gcs-credentials
