# This YAML file demonstrates how to deploy the external
# provisioner for use with the mock CSI driver. It
# depends on the RBAC definitions from rbac.yaml.

kind: Service
apiVersion: v1
metadata:
  name: csi-attacher
  labels:
    app: csi-attacher
spec:
  selector:
    app: csi-attacher
  ports:
    - name: dummy
      port: 12345

---
kind: Deployment
apiVersion: apps/v1
metadata:
  name: csi-attacher
spec:
  replicas: 3
  selector:
    matchLabels:
      external-attacher: mock-driver
  template:
    metadata:
      labels:
        external-attacher: mock-driver
    spec:
      serviceAccount: csi-attacher
      containers:
        - name: csi-attacher
          image: gcr.io/k8s-staging-sig-storage/csi-attacher:canary
          args:
            - "--v=5"
            - "--csi-address=$(ADDRESS)"
            - "--leader-election"
            - "--http-endpoint=:8080"
          env:
            - name: MY_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: ADDRESS
              value: /var/lib/csi/sockets/pluginproxy/mock.socket
          imagePullPolicy: "IfNotPresent"
          volumeMounts:
            - name: socket-dir
              mountPath: /var/lib/csi/sockets/pluginproxy/
          ports:
            - containerPort: 8080
              name: http-endpoint
              protocol: TCP
          livenessProbe:
            failureThreshold: 1
            httpGet:
              path: /healthz/leader-election
              port: http-endpoint
            initialDelaySeconds: 10
            timeoutSeconds: 10
            periodSeconds: 20
        - name: mock-driver
          image: quay.io/k8scsi/mock-driver:canary
          imagePullPolicy: "IfNotPresent"
          env:
            - name: CSI_ENDPOINT
              value: /var/lib/csi/sockets/pluginproxy/mock.socket
          volumeMounts:
            - name: socket-dir
              mountPath: /var/lib/csi/sockets/pluginproxy/

      volumes:
        - name: socket-dir
          emptyDir:
