---
kind: StatefulSet
apiVersion: apps/v1
metadata:
  name: csi-provisioner-ntnx-plugin
  namespace: kube-system
spec:
  serviceName: "csi-provisioner-ntnx-plugin"
  replicas: 1
  selector:
    matchLabels:
      app: csi-provisioner-ntnx-plugin
  template:
    metadata:
      labels:
        app: csi-provisioner-ntnx-plugin
    spec:
      nodeSelector:
        kubernetes.io/role: interna
      serviceAccount: csi-provisioner
      containers:
        - name: csi-provisioner
          image: quay.io/k8scsi/csi-provisioner:v1.0.1
          args:
            - "--provisioner=com.nutanix.csi"
            - "--csi-address=$(ADDRESS)"
            - "--v=5"
          env:
            - name: ADDRESS
              value: /var/lib/csi/sockets/pluginproxy/csi.sock
          imagePullPolicy: "IfNotPresent"
          volumeMounts:
            - name: socket-dir
              mountPath: /var/lib/csi/sockets/pluginproxy/
        - name: nutanix-csi-plugin
          image: ntnx/ntnx-csi:v1.0.1
          securityContext:
            privileged: true
            allowPrivilegeEscalation: true
          args :
            - "--endpoint=$(CSI_ENDPOINT)"
            - "--nodeid=$(NODE_ID)"
          env:
            - name: CSI_ENDPOINT
              value: unix:///var/lib/csi/sockets/pluginproxy/csi.sock
            - name: NODE_ID
              valueFrom:
                fieldRef:
                  fieldPath: spec.nodeName
          volumeMounts:
            - name: socket-dir
              mountPath: /var/lib/csi/sockets/pluginproxy/
      volumes:
        - name: socket-dir
          emptyDir: {}
