kind: StatefulSet
apiVersion: apps/v1
metadata:
  name: nfs
  namespace: storageos
spec:
  serviceName: "nfs"
  replicas: 1 # Only one is permitted to register as a provisioner
  selector:
    matchLabels:
      app: nfs
  template:
    metadata:
      labels:
        app: nfs
      annotations:
        pod.alpha.kubernetes.io/initialized: "true"
    spec:
      serviceAccount: nfs-provisioner
      terminationGracePeriodSeconds: 0
      containers:
        - name: nfs-provisioner
          image: arau/nfs:v3
          ports:
            - name: nfs
              containerPort: 2049
            - 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=storageos/nfs"
          env:
            - name: POD_IP
              valueFrom:
                fieldRef:
                  fieldPath: status.podIP
            - name: SERVICE_NAME
              value: nfs
            - name: POD_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
          imagePullPolicy: "Always"
          volumeMounts:
            - name: "config"
              mountPath: /export/ganesha
            - name: "partition1"
              mountPath: /export/partition1
            - name: "partition2"
              mountPath: /export/partition2
            - name: "partition3"
              mountPath: /export/partition3
            - name: "partition4"
              mountPath: /export/partition4
  volumeClaimTemplates:
    -
      metadata:
        name: "config"
      spec:
          accessModes: [ "ReadWriteOnce" ]
          storageClassName: "fast"
          resources:
              requests:
                  storage: 1Gi
    -
      metadata:
        name: "partition1"
      spec:
          accessModes: [ "ReadWriteOnce" ]
          storageClassName: "fast"
          resources:
              requests:
                  storage: 30Gi
    -
      metadata:
        name: "partition2"
      spec:
          accessModes: [ "ReadWriteOnce" ]
          storageClassName: "fast"
          resources:
              requests:
                  storage: 30Gi
    -
      metadata:
        name: "partition3"
      spec:
          accessModes: [ "ReadWriteOnce" ]
          storageClassName: "fast"
          resources:
              requests:
                  storage: 30Gi
    -
      metadata:
        name: "partition4"
      spec:
          accessModes: [ "ReadWriteOnce" ]
          storageClassName: "fast"
          resources:
              requests:
                  storage: 30Gi
