Skip to content

Check if volumeHandler was set#125

Closed
cwdsuzhou wants to merge 1 commit intokubernetes-csi:masterfrom
cwdsuzhou:master
Closed

Check if volumeHandler was set#125
cwdsuzhou wants to merge 1 commit intokubernetes-csi:masterfrom
cwdsuzhou:master

Conversation

@cwdsuzhou
Copy link
Copy Markdown
Contributor

Check if volumeHandler was set before call "Attach". If a PV was created by storgeClasses, volumeHandler must not be empty. However, if it was created by a user, it is possible empty, e.g.

apiVersion: v1
kind: PersistentVolume
metadata:
name: test
namespace: "default"
spec:
accessModes:

  • ReadWriteOnce
    capacity:
    storage: 5Gi
    csi:
    driver: "XXX"
    volumeHandle: " "

I think, attacher should not call "Attach" in this scenario.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 22, 2019
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: cwdsuzhou
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: msau42

If they are not already assigned, you can assign the PR to them by writing /assign @msau42 in a comment when ready.

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Feb 22, 2019
@jsafrane
Copy link
Copy Markdown
Contributor

CSI does not describe format of volume_id and does not explicitly forbid empty space there. In addition, such validation should be done on PV creation so such invalid PV can't be even created.

https://github.com/kubernetes/kubernetes/blob/master/pkg/apis/core/validation/validation.go#L1460

@cwdsuzhou
Copy link
Copy Markdown
Contributor Author

cwdsuzhou commented Feb 22, 2019

Though CSI does not describe the format of volume_id and does not forbid empty space, it is meaningless for out-tree csi drivers if volume_id is a space.

https://github.com/kubernetes/kubernetes/blob/master/pkg/apis/core/validation/validation.go#L1460

Validation forbids empty volume_id, but it does not forbid spaces, so a pv actually can be created

@jsafrane

@msau42
Copy link
Copy Markdown
Collaborator

msau42 commented Feb 26, 2019

I think it should be up to the plugin to validate that the volume handle is in their supported format, since the csi spec does not define any syntax rules.

@cwdsuzhou cwdsuzhou closed this Mar 3, 2019
pohly added a commit to pohly/external-attacher that referenced this pull request Jan 26, 2021
1d60e779 Merge pull request kubernetes-csi#131 from pohly/kubernetes-1.20-tag
9f104590 prow.sh: support building Kubernetes for a specific version
fe1f2848 Merge pull request kubernetes-csi#121 from kvaps/namespace-check
8fdf0f78 Merge pull request kubernetes-csi#128 from fengzixu/master
1c94220d fix: fix a bug of csi-sanity
a4c41e6a Merge pull request kubernetes-csi#127 from pohly/fix-boilerplate
ece0f500 check namespace for snapshot-controller
dbd89672 verify-boilerplate.sh: fix path to script
9289fd16 Merge pull request kubernetes-csi#125 from sachinkumarsingh092/optional-spelling-boilerplate-checks
ad29307f Make the spelling and boilerplate checks optional
5f06d024 Merge pull request kubernetes-csi#124 from sachinkumarsingh092/fix-spellcheck-boilerplate-tests
48186eba Fix spelling and boilerplate errors
71690aff Merge pull request kubernetes-csi#122 from sachinkumarsingh092/include-spellcheck-boilerplate-tests
981be3fe Adding spelling and boilerplate checks.
2bb75253 Merge pull request kubernetes-csi#117 from fengzixu/master
3b6d17b1 Merge pull request kubernetes-csi#118 from pohly/cloud-build-timeout
9318c6cc cloud build: double the timeout, now 1 hour
4ab8b154 use the tag to replace commit of csi-test
5d74e455 change the csi-test import path to v4
7dcd0a99 upgrade csi-test to v4.0.2
86ff5802 Merge pull request kubernetes-csi#116 from andyzhangx/export-image-name
c3a96625 allow export image name and registry name

git-subtree-dir: release-tools
git-subtree-split: 1d60e7792624a9938c0bd1b045211fbb89e513d6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants