apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: longhorn-flexvolume-driver-deployer
  namespace: {{ .Release.Namespace }}
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: longhorn-flexvolume-driver-deployer
    spec:
      containers:
        - name: longhorn-flexvolume-driver-deployer
          image: "{{ .Values.image.longhorn.manager }}:{{ .Values.image.longhorn.managerTag }}"
          imagePullPolicy: Always
          command:
          - longhorn-manager
          - -d
          - deploy-flexvolume-driver
          - --manager-image
          - "{{ .Values.image.longhorn.manager }}:{{ .Values.image.longhorn.managerTag }}"
          env:
          - name: POD_NAMESPACE
            valueFrom:
              fieldRef:
                fieldPath: metadata.namespace
          - name: NODE_NAME
            valueFrom:
              fieldRef:
                fieldPath: spec.nodeName
          - name: FLEXVOLUME_DIR
            value: {{ .Values.persistence.flexvolumePath }}
      serviceAccountName: longhorn-service-account
