# This YAML file demonstrates how to deploy the external
# provisioner for use with the mock CSI driver. It
# depends on the RBAC definitions from rbac.yaml.

kind: Deployment
apiVersion: apps/v1
metadata:
  name: csi-attacher
spec:
  replicas: 3
  selector:
    matchLabels:
      external-attacher: csi-attacher
  template:
    metadata:
      labels:
        external-attacher: csi-attacher
    spec:
      # debug only(connect to dlv 2345 port)
      #hostNetwork: true
      serviceAccountName: csi-attacher
      containers:
        - name: csi-attacher
          image: quay.io/k8scsi/csi-attacher:v2.2.0
          imagePullPolicy: IfNotPresent
          args:
            - "--v=5"
            - "--csi-address=$(CSI_ENDPOINT)"
            - "--leader-election"
          env:
            - name: CSI_ENDPOINT
              value: /csi/csi.sock
          volumeMounts:
            - name: socket-dir
              mountPath: /csi
        - name: csi-archetype
          image: gozap/csi-nfs:v1.0.2
          securityContext:
            privileged: true
            capabilities:
              add: ["SYS_ADMIN"]
          args:
            - "--nodeid=$(NODE_ID)"
            - "--endpoint=$(CSI_ENDPOINT)"
          imagePullPolicy: IfNotPresent
          env:
            - name: NODE_ID
              valueFrom:
                fieldRef:
                  fieldPath: spec.nodeName
            - name: CSI_ENDPOINT
              value: unix:///csi/csi.sock
          volumeMounts:
            - name: socket-dir
              mountPath: /csi
      volumes:
        - name: socket-dir
          emptyDir: {}
