kind: DaemonSet
apiVersion: extensions/v1beta1
metadata:
  name: {{ template "nfs.fullname" . }}
  labels:
    app: {{ template "nfs.name" . }}
    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
spec:
  template:
    metadata:
      labels:
        app: {{ template "nfs.name" . }}
        release: {{ .Release.Name }}
    spec:
      serviceAccount: {{ template "nfs.fullname" . }}
      containers:
        - name: nfs-provisioner
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          ports:
            - name: nfs
              containerPort: 2049
              hostPort: {{ .Values.nfs.hostPort }}
            - name: mountd
              containerPort: 20048
            - name: rpcbind
              containerPort: 111
            - name: rpcbind-udp
              containerPort: 111
              protocol: UDP
          securityContext:
            capabilities:
              add:
                - DAC_READ_SEARCH
                - SYS_RESOURCE
          args:
            - "-provisioner=local.net/{{ template "nfs.fullname" . }}"
          env:
            - name: POD_IP
              valueFrom:
                fieldRef:
                  fieldPath: status.podIP
            - name: NODE_NAME
              valueFrom:
                fieldRef:
                  fieldPath: status.hostIP
          volumeMounts:
            - name: export-volume
              mountPath: /export
      volumes:
        - name: export-volume
          hostPath:
            path: {{ .Values.persistence.hostPath }}
