kind: Deployment
apiVersion: apps/v1
metadata:
  name: hcloud-csi-controller
  namespace: kube-system
spec:
  selector:
    matchLabels:
      app: hcloud-csi-controller
  replicas: 1
  template:
    metadata:
      labels:
        app: hcloud-csi-controller
    spec:
      serviceAccountName: hcloud-csi-controller
      containers:
      - name: csi-attacher
        image: k8s.gcr.io/sig-storage/csi-attacher:v3.2.1
        volumeMounts:
        - name: socket-dir
          mountPath: /run/csi
      - name: csi-resizer
        image: k8s.gcr.io/sig-storage/csi-resizer:v1.2.0
        volumeMounts:
        - name: socket-dir
          mountPath: /run/csi
      - name: csi-provisioner
        image: k8s.gcr.io/sig-storage/csi-provisioner:v2.2.2
        args:
        - --feature-gates=Topology=true
        - --default-fstype=ext4
        volumeMounts:
        - name: socket-dir
          mountPath: /run/csi
      - name: hcloud-csi-driver
        image: hetznercloud/hcloud-csi-driver:latest
        imagePullPolicy: Always
        command: [/bin/hcloud-csi-driver-controller]
        env:
        - name: CSI_ENDPOINT
          value: unix:///run/csi/socket
        - name: METRICS_ENDPOINT
          value: 0.0.0.0:9189
        - name: ENABLE_METRICS
          value: "true"
        - name: KUBE_NODE_NAME
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: spec.nodeName
        - name: HCLOUD_TOKEN
          valueFrom:
            secretKeyRef:
              name: hcloud
              key: token
        volumeMounts:
        - name: socket-dir
          mountPath: /run/csi
        ports:
        - containerPort: 9189
          name: metrics
        - name: healthz
          containerPort: 9808
          protocol: TCP
        livenessProbe:
          failureThreshold: 5
          httpGet:
            path: /healthz
            port: healthz
          initialDelaySeconds: 10
          timeoutSeconds: 3
          periodSeconds: 2
      - name: liveness-probe
        imagePullPolicy: Always
        image: k8s.gcr.io/sig-storage/livenessprobe:v2.3.0
        volumeMounts:
        - mountPath: /run/csi
          name: socket-dir
      volumes:
      - name: socket-dir
        emptyDir: {}
