kind: StatefulSet
apiVersion: apps/v1
metadata:
  name: csi-ananas-controller
  namespace: ananas
spec:
  serviceName: "csi-ananas"
  selector:
    matchLabels:
      app: ananas
  replicas: 1
  template:
    metadata:
      labels:
        app: ananas
        role: csi-azure
    spec:
      serviceAccount: ananas
      containers:
        - name: csi-provisioner
          image: mcr.microsoft.com/oss/kubernetes-csi/csi-provisioner:v2.1.1
          args:
            - "--feature-gates=Topology=true"
            - "--csi-address=$(ADDRESS)"
            - "--v=2"
            - "--timeout=15s"
            - "--leader-election"
            - "--worker-threads=40"
            - "--extra-create-metadata=true"
            - "--strict-topology=true"
          env:
            - name: ADDRESS
              value: /csi/csi.sock
          volumeMounts:
            - mountPath: /csi
              name: socket-dir
          resources:
            limits:
              cpu: 100m
              memory: 300Mi
            requests:
              cpu: 10m
              memory: 20Mi
        - name: csi-snapshotter
          image: mcr.microsoft.com/oss/kubernetes-csi/csi-snapshotter:v3.0.3
          args:
            - "-csi-address=$(ADDRESS)"
            - "-leader-election"
            - "--v=2"
          env:
            - name: ADDRESS
              value: /csi/csi.sock
          volumeMounts:
            - name: socket-dir
              mountPath: /csi
          resources:
            limits:
              cpu: 100m
              memory: 100Mi
            requests:
              cpu: 10m
              memory: 20Mi
        - name: csi-attacher
          image: mcr.microsoft.com/oss/kubernetes-csi/csi-attacher:v3.1.0
          args:
            - "-v=2"
            - "-csi-address=$(ADDRESS)"
            - "-timeout=600s"
            - "-leader-election"
            - "-worker-threads=500"
          env:
            - name: ADDRESS
              value: /csi/csi.sock
          volumeMounts:
            - name: socket-dir
              mountPath: /csi
        - name: csi-ananas
          image: toughnoah/ananas:v1.0
          args :
            - "--node=$(KUBE_NODE_NAME)"
          env:
            - name: KUBE_NODE_NAME
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: spec.nodeName
          imagePullPolicy: "Always"
          volumeMounts:
            - name: socket-dir
              mountPath: /csi
            - name: cloud-config-dir
              mountPath: /etc/kubernetes
      volumes:
        - name: socket-dir
          emptyDir: {}
        - name: cloud-config-dir
          hostPath:
            path: /etc/kubernetes
            type: Directory
