kind: Deployment
apiVersion: apps/v1
metadata:
  name: px-csi-ext
  namespace: kube-test
spec:
  replicas: 3
  selector:
    matchLabels:
      app: px-csi-driver
  template:
    metadata:
      labels:
        app: px-csi-driver
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: px/enabled
                operator: NotIn
                values:
                - "false"
              - key: node-role.kubernetes.io/master
                operator: DoesNotExist
            - matchExpressions:
              - key: px/enabled
                operator: NotIn
                values:
                  - "false"
              - key: node-role.kubernetes.io/master
                operator: Exists
              - key: node-role.kubernetes.io/worker
                operator: Exists
      serviceAccountName: px-csi
      containers:
        - name: csi-external-provisioner
          imagePullPolicy: Always
          image: quay.io/k8scsi/csi-provisioner:v1.2.3
          args:
            - "--v=3"
            - "--provisioner=pxd.portworx.com"
            - "--csi-address=$(ADDRESS)"
            - "--enable-leader-election"
            - "--leader-election-type=leases"
          env:
            - name: ADDRESS
              value: /csi/csi.sock
          volumeMounts:
            - name: socket-dir
              mountPath: /csi
        - name: csi-snapshotter
          imagePullPolicy: Always
          image: quay.io/k8scsi/csi-snapshotter:v1.2.3
          args:
            - "--v=3"
            - "--csi-address=$(ADDRESS)"
            - "--leader-election=true"
          env:
            - name: ADDRESS
              value: /csi/csi.sock
          volumeMounts:
            - name: socket-dir
              mountPath: /csi
        - name: csi-resizer
          image: quay.io/k8scsi/csi-resizer:v1.2.3
          imagePullPolicy: Always
          args:
            - "--v=3"
            - "--csi-address=$(ADDRESS)"
            - "--leader-election=true"
          env:
            - name: ADDRESS
              value: /csi/csi.sock
          volumeMounts:
            - name: socket-dir
              mountPath: /csi
      volumes:
        - name: socket-dir
          hostPath:
            path: /var/lib/kubelet/plugins/pxd.portworx.com
            type: DirectoryOrCreate