apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: nfs-data
spec:
  storageClassName: local
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 30Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nfs-server
  labels:
    app: "nfs-server"
    cdi.kubevirt.io/testing: ""
spec:
  selector:
    matchLabels:
      app: nfs-server
  replicas: 1
  template:
    metadata:
      labels:
        app: nfs-server
        cdi.kubevirt.io/testing: ""
    spec:
      containers:
      - image: quay.io/awels/nfs-server-alpine:12
        imagePullPolicy: IfNotPresent
        name: nfs-server
        env:
        - name: SHARED_DIRECTORY
          value: /data/nfs
        securityContext:
          privileged: true
        volumeMounts:
        - mountPath: "/data/nfs"
          name: nfsdata
        command: ["/bin/bash", "-c"]
        args:
          - |
            chmod 777 /data/nfs;
            mkdir /data/nfs/disk1;
            chmod 777 /data/nfs/disk1;
            mkdir /data/nfs/disk2;
            chmod 777 /data/nfs/disk2;
            mkdir /data/nfs/disk3;
            chmod 777 /data/nfs/disk3;
            mkdir /data/nfs/disk4;
            chmod 777 /data/nfs/disk4;
            mkdir /data/nfs/disk5;
            chmod 777 /data/nfs/disk5;
            mkdir /data/nfs/disk6;
            chmod 777 /data/nfs/disk6;
            mkdir /data/nfs/disk7;
            chmod 777 /data/nfs/disk7;
            mkdir /data/nfs/disk8;
            chmod 777 /data/nfs/disk8;
            mkdir /data/nfs/disk9;
            chmod 777 /data/nfs/disk9;
            mkdir /data/nfs/disk10;
            chmod 777 /data/nfs/disk10;
            mkdir /data/nfs/extraDisk1;
            chmod 777 /data/nfs/extraDisk1;
            mkdir /data/nfs/extraDisk2;
            chmod 777 /data/nfs/extraDisk2;
            /usr/bin/nfsd.sh
      volumes:
      - name: nfsdata
        persistentVolumeClaim:
          claimName: nfs-data
