kubernetes-csi/csi-driver-nfs

dynamic provisioning of existing data

dart-mtucker opened this issue · 2 comments

Is your feature request related to a problem?/Why is this needed
It would be helpful if the driver supported dynamic provisioning of persistent volumes without the creation of the randomly named subdirectory. We have several nfs exports that are shared across many containers as well as non-containerized apps. These contain literally millions of files. Manually creating persistent volumes and volume claims for each application is adding a lot of management overhead and it would extremely useful to simply define a class for each export to make it available to all of the pods that need it.

Describe the solution you'd like in detail
When defining/creating a storageClass with this provisioner, perhaps adding a key/value pair in the yaml to disable the creation of the subdirectory (ex. "dynamicSubdir: false")

Describe alternatives you've considered
Manual creation of PV is a lot of overhead given that a pv/pvc pair must be done for each deployment. I've looked into other nfs provisioners but haven't found anything that fits this need.

Additional context
N/A

@dart-mtucker you could specify subDir: xxx parameter in storage class to achieve your goal. if sub directory does not exist, this driver would create a new one for every pvc.

---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: nfs-csi
provisioner: nfs.csi.k8s.io
parameters:
  server: nfs-server.default.svc.cluster.local
  share: /sharename
  subDir: xxx

@andyzhangx This appears to be working perfectly in my test environment. Thank you!