kind: DaemonSet
apiVersion: apps/v1
metadata:
  name: csi-secrets-store-windows
spec:
  selector:
    matchLabels:
      app: csi-secrets-store
  template:
    metadata:
      labels:
        app: csi-secrets-store
    spec:
      nodeSelector:
        beta.kubernetes.io/os: windows
      serviceAccountName: secrets-store-csi-driver
      containers:
        - name: node-driver-registrar
          image: mcr.microsoft.com/oss/kubernetes-csi/csi-node-driver-registrar:v1.2.1-alpha.1-windows-1809-amd64
          args:
            - --v=5
            - "--csi-address=unix://C:\\csi\\csi.sock"
            - "--kubelet-registration-path=C:\\var\\lib\\kubelet\\plugins\\csi-secrets-store\\csi.sock"
          lifecycle:
              preStop:
                exec:
                  command:
                    [
                      "cmd",
                      "/c",
                      "del /f C:\\registration\\secrets-store.csi.k8s.io-reg.sock",
                    ]
          env:
            - name: KUBE_NODE_NAME
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: spec.nodeName
          imagePullPolicy: IfNotPresent
          volumeMounts:
            - name: plugin-dir
              mountPath: C:\csi
            - name: registration-dir
              mountPath: C:\registration
        - name: secrets-store
          image: mcr.microsoft.com/k8s/csi/secrets-store/driver:v0.0.9
          args:
            - "--debug=true"
            - "--endpoint=$(CSI_ENDPOINT)"
            - "--nodeid=$(KUBE_NODE_NAME)"
            - "--provider-volume=C:\\k\\secrets-store-csi-providers"
          env:
            - name: CSI_ENDPOINT
              value: unix://C:\\csi\\csi.sock
            - name: KUBE_NODE_NAME
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: spec.nodeName
          imagePullPolicy: Always
          securityContext:
            privileged: true
          ports:
            - containerPort: 9808
              name: healthz
              protocol: TCP
          livenessProbe:
              failureThreshold: 5
              httpGet:
                path: /healthz
                port: healthz
              initialDelaySeconds: 30
              timeoutSeconds: 10
              periodSeconds: 15
          volumeMounts:
            - name: plugin-dir
              mountPath: C:\csi
            - name: mountpoint-dir
              mountPath: "C:\\var\\lib\\kubelet\\pods"
              mountPropagation: Bidirectional
            - name: providers-dir
              mountPath: C:\k\secrets-store-csi-providers
        - name: liveness-probe
          image: mcr.microsoft.com/oss/kubernetes-csi/livenessprobe:v2.0.1-alpha.1-windows-1809-amd64
          imagePullPolicy: IfNotPresent
          args:
          - "--csi-address=unix://C:\\csi\\csi.sock"
          - --probe-timeout=3s
          - --health-port=9808
          volumeMounts:
            - name: plugin-dir
              mountPath: C:\csi
      volumes:
        - name: mountpoint-dir
          hostPath:
            path: C:\var\lib\kubelet\pods\
            type: DirectoryOrCreate
        - name: registration-dir
          hostPath:
            path: C:\var\lib\kubelet\plugins_registry\
            type: Directory
        - name: plugin-dir
          hostPath:
            path: C:\var\lib\kubelet\plugins\csi-secrets-store\
            type: DirectoryOrCreate
        - name: providers-dir
          hostPath:
            path: C:\k\secrets-store-csi-providers\
            type: DirectoryOrCreate
