---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: nfs-client-provisioner
  name: nfs-client-provisioner
  namespace: nfs-provisioner
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nfs-client-provisioner
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: nfs-client-provisioner
    spec:
      containers:
      - env:
        - name: NFS_SERVER
{%- if taskserv.ip == "$network_private_ip" %}
          value: "{{server.network_private_ip}}"
{%- else -%}
          value: "{{server.tasks[task_pos].ip}}"
{%- endif %}
        - name: NFS_PATH
          value: {{taskserv.shared}}
        - name: PROVISIONER_NAME
          value: k8s-sigs.io/nfs-subdir-external-provisioner
        image: registry.k8s.io/sig-storage/nfs-subdir-external-provisioner:v4.0.2
        name: nfs-client-provisioner
        volumeMounts:
        - mountPath: /persistentvolumes
          name: nfs-client-root
      serviceAccountName: nfs-client-provisioner
      volumes:
      - name: nfs-client-root
        nfs:
          path: {{taskserv.shared}}
{%- if taskserv.ip == "$network_private_ip" %}
          server: "{{server.network_private_ip}}"
{%- else -%}
          server: "{{server.tasks[task_pos].ip}}"
{%- endif %}
