kind: Deployment
apiVersion: apps/v1
metadata:
  name: gcp-filestore-csi-controller
spec:
  replicas: 1
  selector:
    matchLabels:
      app: gcp-filestore-csi-driver
  template:
    metadata:
      labels:
        app: gcp-filestore-csi-driver
    spec:
      # Host network must be used for interaction with Workload Identity in GKE
      # since it replaces GCE Metadata Server with GKE Metadata Server. Remove
      # this requirement when issue is resolved and before any exposure of
      # metrics ports
      hostNetwork: true
      nodeSelector:
        kubernetes.io/os: linux
      serviceAccount: gcp-filestore-csi-controller-sa
      priorityClassName: csi-gcp-fs-controller
      containers:
        - name: csi-external-provisioner
          image: k8s.gcr.io/sig-storage/csi-provisioner
          args:
            - "--v=5"
            - "--csi-address=/csi/csi.sock"
            - "--timeout=250s"
            - "--feature-gates=Topology=true"
            - "--extra-create-metadata"
            - "--http-endpoint=:22021"
            - "--leader-election-namespace=$(FILESTORECSI_NAMESPACE)"
            - "--leader-election"
          env:
            - name: FILESTORECSI_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
          ports:
            - containerPort: 22021
              name: http-endpoint
              protocol: TCP
          livenessProbe:
            failureThreshold: 1
            httpGet:
              path: /healthz/leader-election
              port: http-endpoint
            initialDelaySeconds: 10
            timeoutSeconds: 10
            periodSeconds: 20
          volumeMounts:
            - name: socket-dir
              mountPath: /csi
        - name: csi-external-resizer
          image: k8s.gcr.io/sig-storage/csi-resizer
          args:
            - "--v=5"
            - "--csi-address=/csi/csi.sock"
            - "--timeout=120s"
            - "--http-endpoint=:22022"
            - "--leader-election"
            - "--leader-election-namespace=$(FILESTORECSI_NAMESPACE)"
          env:
            - name: FILESTORECSI_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
          ports:
            - containerPort: 22022
              name: http-endpoint
              protocol: TCP
          livenessProbe:
            failureThreshold: 1
            httpGet:
              path: /healthz/leader-election
              port: http-endpoint
            initialDelaySeconds: 10
            timeoutSeconds: 10
            periodSeconds: 20
          volumeMounts:
            - name: socket-dir
              mountPath: /csi
        - name: csi-external-snapshotter
          image: k8s.gcr.io/sig-storage/csi-snapshotter
          args:
            - "--v=5"
            - "--csi-address=/csi/csi.sock"
            - "--timeout=300s"
            - "--metrics-address=:22023"
            - "--leader-election"
            - "--leader-election-namespace=$(FILESTORECSI_NAMESPACE)"
          env:
            - name: FILESTORECSI_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
          ports:
            - containerPort: 22023
              name: metrics
          volumeMounts:
            - name: socket-dir
              mountPath: /csi
        - name: gcp-filestore-driver
          image: k8s.gcr.io/cloud-provider-gcp/gcp-filestore-csi-driver
          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
