kind: StatefulSet
apiVersion: apps/v1
metadata:
  name: datamon-csi-controller
  namespace: dev
spec:
  serviceName: "datamon-csi-driver"
  replicas: 1
  selector:
    matchLabels:
      app: datamon-csi-driver
  updateStrategy:
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: datamon-csi-driver
    spec:
      serviceAccountName: datamon-csi-controller-sa
      containers:
        - name: csi-external-attacher
          imagePullPolicy: Always
          image: quay.io/k8scsi/csi-attacher:v0.4.1
          args:
            - "--v=10"
            - "--csi-address=$(ADDRESS)"
          env:
            - name: ADDRESS
              value: /csi/csi.sock
          volumeMounts:
            - name: socket-dir
              mountPath: /csi
        - name: csi-external-provisioner
          imagePullPolicy: Always
          image: gcr.io/onec-co/csi-provisioner:v0.4-canary
          args:
            - "--v=10"
            - "--provisioner=com.datamon.csi"
            - "--csi-address=$(ADDRESS)"
          env:
            - name: ADDRESS
              value: /csi/csi.sock
          volumeMounts:
            - name: socket-dir
              mountPath: /csi
        - name: datamon-driver
          imagePullPolicy: Always
          image: gcr.io/onec-co/datamon-csi:csi
          args:
            - "--endpoint=$(CSI_ENDPOINT)"
            - "--nodeid=$(KUBE_NODE_NAME)"
            - "--controller=true"
            - "--log-level=debug"
            - "--credential=/etc/datamon-creds/gcp-storage-admin.json"
          env:
            - name: CSI_ENDPOINT
              value: unix:/csi/csi.sock
            - name: KUBE_NODE_NAME
              valueFrom:
                fieldRef:
                  fieldPath: spec.nodeName
            - name: GOOGLE_APPLICATION_CREDENTIALS
              value: "/etc/datamon-creds/gcp-storage-admin.json"
          volumeMounts:
            - name: socket-dir
              mountPath: /csi
            - name: credentials
              readOnly: true
              mountPath: "/etc/datamon-creds"
      volumes:
        - name: socket-dir
          emptyDir: {}
        - name: credentials
          secret:
            secretName: gcs-credentials
