kind: StatefulSet
apiVersion: apps/v1
metadata:
  name: gcp-filestore-csi-controller
  namespace: gcp-filestore-csi-driver
spec:
  serviceName: "gcp-filestore-csi-driver"
  replicas: 1
  selector:
    matchLabels:
      app: gcp-filestore-csi-driver
  updateStrategy:
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: gcp-filestore-csi-driver
    spec:
      serviceAccount: gcp-filestore-csi-controller-sa
      containers:
        - name: csi-external-attacher
          imagePullPolicy: Always
          image: gcr.io/gke-release/csi-attacher:v0.4.1-gke.0
          args:
            - "--v=4"
            - "--csi-address=/csi/csi.sock"
          volumeMounts:
            - name: socket-dir
              mountPath: /csi
        - name: csi-external-provisioner
          imagePullPolicy: Always
          image: gcr.io/gke-release/csi-provisioner:v0.4.1-gke.0
          args:
            - "--v=4"
            # Remove when https://github.com/kubernetes-csi/external-provisioner/issues/108 is fixed
            - "--provisioner=filestore.csi.storage.gke.io"
            - "--csi-address=/csi/csi.sock"
          volumeMounts:
            - name: socket-dir
              mountPath: /csi
        - name: gcp-filestore-driver
          imagePullPolicy: Always
          image: gcr.io/gke-release/gcp-filestore-csi-driver:v0.2.0-gke.0
          args:
            - "--v=4"
            - "--endpoint=unix:/csi/csi.sock"
            - "--nodeid=$(KUBE_NODE_NAME)"
            - "--controller=true"
          env:
            - name: KUBE_NODE_NAME
              valueFrom:
                fieldRef:
                  fieldPath: spec.nodeName
            - name: GOOGLE_APPLICATION_CREDENTIALS
              value: "/etc/cloud_sa/gcp_filestore_csi_driver_sa.json"
          volumeMounts:
            - name: socket-dir
              mountPath: /csi
            - name: cloud-sa-volume
              readOnly: true
              mountPath: "/etc/cloud_sa"
      volumes:
        - name: socket-dir
          emptyDir: {}
        - name: cloud-sa-volume
          secret:
            secretName: gcp-filestore-csi-driver-sa
