kind: StatefulSet
apiVersion: apps/v1
metadata:
  name: csi-hostpath-snapshotter
spec:
  serviceName: "csi-hostpath-snapshotter"
  replicas: 1
  selector:
    matchLabels:
      app: csi-hostpath-snapshotter
  template:
    metadata:
      labels:
        app: csi-hostpath-snapshotter
    spec:
      affinity:
        podAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
          - labelSelector:
              matchExpressions:
              - key: app
                operator: In
                values:
                - csi-hostpathplugin
            topologyKey: kubernetes.io/hostname
      serviceAccount: csi-snapshotter
      containers:
        - name: csi-snapshotter
          image: registry.edoc2.com:5000/library/csi-snapshotter:v4.0.0
          args:
            - -v=5
            - --csi-address=/csi/csi.sock
          securityContext:
            # This is necessary only for systems with SELinux, where
            # non-privileged sidecar containers cannot access unix domain socket
            # created by privileged CSI driver container.
            privileged: true
          volumeMounts:
            - mountPath: /csi
              name: socket-dir
      volumes:
        - hostPath:
            path: /var/lib/kubelet/plugins/csi-hostpath
            type: DirectoryOrCreate
          name: socket-dir
