-
Notifications
You must be signed in to change notification settings - Fork 136
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
Cannot mount an existing share via subDir parameter #428
Comments
I think this driver only honors kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: pvc-tsmb-12
spec:
storageClassName: test-csi-smb
accessModes:
- ReadWriteMany
resources:
requests:
storage: 1Mi
csi:
volumeAttributes:
subDir: "anotherSHARE" # k apply -f /tmp/a.yaml
error: error validating "/tmp/a.patch2": error validating data: ValidationError(PersistentVolumeClaim.spec): unknown field "csi" in io.k8s.api.core.v1.PersistentVolumeClaimSpec; if you choose to ignore these errors, turn validation off with --validate=false |
if you want to create sub dir with pvc annotation, you could try like this: apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: test-csi-smb
provisioner: smb.csi.k8s.io
reclaimPolicy: Delete
parameters:
source: "//NAS_FILER/"
subDir: ${pvc.annotations['team.example.com/key']}
csi.storage.k8s.io/provisioner-secret-name: "smbcreds"
csi.storage.k8s.io/provisioner-secret-namespace: "aatest-storage"
csi.storage.k8s.io/node-stage-secret-name: "smbcreds"
csi.storage.k8s.io/node-stage-secret-namespace: "aatest-storage"
volumeBindingMode: Immediate
mountOptions:
- dir_mode=0777
- file_mode=0777 |
You are right! The PVC definition I've provided is not correct. I'll try to use the annotation as you suggested. Please let me have some time to do some tests. |
Unfortunately the configuration you suggested does not work since the PVC annotations are not expanded and so the subdir value is treated literally. |
I went a big further on this issue discovering that it depends on the csi-external-provisioner which is used as sidecar container in the deployment. Currently the csi-external-provisioner does not pass extra parameters nor annotations to the CSI driver and there are a couple of issues open on this: https://github.com/kubernetes-csi/external-provisioner/issues/714 and https://github.com/kubernetes-csi/external-provisioner/issues/86 So to have this working I guess that the csi-external-provisioner has to be modified or a different controller has to be used. |
Are any context variables expanded? pod namespace? pvc namespace? |
with PR #503
|
Hi @andyzhangx - is there any plans to support annotations as described in #428 (comment)? |
@servo1x there is no clear plan yet, and it depends on kubernetes-csi/external-provisioner#86 |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /close not-planned |
@k8s-triage-robot: Closing this issue, marking it as "Not Planned". In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
What happened:
The subDir parameter is not honoured in PVC and, when used in a storage class causes all the volumes to be attached to the share/directory specified in the SC definition.
What you expected to happen:
AFAIK the subDir parameter should allow the PVC to request a volume bounded to an existing share as per issue [#398]
How to reproduce it:
To reproduce just define a SC like this
and a PVC like this
As a result the volume will be bounded to //NAS_FILER/TESTSHARE and not to //NAS_FILER/anotherSHARE.
The same occurs when the subDir parameters is not specified into the PVC.
Anything else we need to know?:
Not defining the subDir parameter into the SC causes the PV to be bounded to a subdirectory of //NAS_FILER/TESTSHARE created "on the fly" no matter if the volumeAttributes.subDir parameters is defined into the PVC.
Also defining the volumeAttributes.source into the PVC has no effect.
Environment:
The text was updated successfully, but these errors were encountered: