Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature request] Dynamic provisioning of PVs referring existing SMB shares of NAS filers #398

Closed
ppenzo opened this issue Dec 28, 2021 · 3 comments · Fixed by #400
Closed

Comments

@ppenzo
Copy link

ppenzo commented Dec 28, 2021

Is your feature request related to a problem?/Why is this needed
This driver can be use to dynamically create PV as a subpath of an existing SMB share but it cannot be used to dynamically create PV referencing existing shares since it does not handles extra parameters in the storageclass definition.

Describe the solution you'd like in detail
Dynamic provisioning of PV referring existing shares could be achieved by indicating the share name into the PVC (for instance using a specific annotation) and then by introducing a parameter into the storageclass definition allowing the share name indicated by the PVC to be honored.

Describe alternatives you've considered
Per share PVs can be manually created but this requires cluster-admin privileges and a lot of manual work and time.

Additional context
This feature is suited for NAS filers and it assumes that each NAS node has its own storageclass definition.

@ppenzo ppenzo changed the title Dynamic provisioning of PVs referring existing SMB shares of NAS filers [feature request] Dynamic provisioning of PVs referring existing SMB shares of NAS filers Dec 28, 2021
@andyzhangx
Copy link
Member

andyzhangx commented Dec 29, 2021

you mean add a volumeAttributes.folderName in PV setting? is it possible append folderName into volumeAttributes.source?

csi:
driver: smb.csi.k8s.io
readOnly: false
volumeHandle: unique-volumeid # make sure it's a unique id in the cluster
volumeAttributes:
source: "//smb-server.default.svc.cluster.local/share"

@ppenzo
Copy link
Author

ppenzo commented Dec 29, 2021

Not exactly.
The one you pointed out is the manual PV definition which IMHO tought to maintain and which requires cluster admin privilege, at least on Openshift, since it is related to the PV creation.
I would like to implement a dynamic creation of these PVs using PV claimns and storageclasses:


kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  annotations:
    csi-smb/storagepath: myNASShare
  name: NASfilerpvc
spec:
  storageClassName: NASfilernode01
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 1Mi
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: NASfilernode01
provisioner: smb.csi.k8s.io
reclaimPolicy: Delete
parameters:
  source: "//myNASfilerNode01/"
  shareName: ${pvc.annotations['csi-smb/storagepath']}
  csi.storage.k8s.io/provisioner-secret-name: "smbcreds"
  csi.storage.k8s.io/provisioner-secret-namespace: "defaults"
  csi.storage.k8s.io/node-stage-secret-name: "smbcreds"
  csi.storage.k8s.io/node-stage-secret-namespace: "application-ns"
volumeBindingMode: Immediate
mountOptions:
  - dir_mode=0777
  - file_mode=0777

Obviously the SMB path //myNASfilerNode01/myNASShare must be existing and accessible with the credentials provided by the application.

@MiddleMan5
Copy link

@andyzhangx I don't think the subDir parameter fully addresses this issue. From the example given above, subDir should be allowed to be a non-static string (a string template).

It's not clear if this is currently possible or not; can we use PVC metadata in the subDir parameter?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants