Skip to content
This repository was archived by the owner on Mar 22, 2018. It is now read-only.

Commit 9fc70f2

Browse files
author
Kubernetes Submit Queue
authored
Merge pull request #47274 from wongma7/accessmodes-provision
Automatic merge from submit-queue (batch tested with PRs 46929, 47391, 47399, 47428, 47274) Don't provision for PVCs with AccessModes unsupported by plugin Fail early in case the user actually expects e.g. RWM from AWS when in reality that isn't possible. @eparis @gnufied edit: this needs release note because it's a breaking bugfix; will write one. kubernetes/kubernetes#46540 ```release-note Fix dynamic provisioning of PVs with inaccurate AccessModes by refusing to provision when PVCs ask for AccessModes that can't be satisfied by the PVs' underlying volume plugin ```
2 parents bc6ffde + cfa50ae commit 9fc70f2

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

pkg/volume/cinder/cinder.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,10 @@ type cinderVolumeProvisioner struct {
482482
var _ volume.Provisioner = &cinderVolumeProvisioner{}
483483

484484
func (c *cinderVolumeProvisioner) Provision() (*v1.PersistentVolume, error) {
485+
if !volume.AccessModesContainedInAll(c.plugin.GetAccessModes(), c.options.PVC.Spec.AccessModes) {
486+
return nil, fmt.Errorf("invalid AccessModes %v: only AccessModes %v are supported", c.options.PVC.Spec.AccessModes, c.plugin.GetAccessModes())
487+
}
488+
485489
volumeID, sizeGB, labels, err := c.manager.CreateVolume(c)
486490
if err != nil {
487491
return nil, err

0 commit comments

Comments
 (0)