From ea5bea2b9fc44060ab9c9852a045654391a0d825 Mon Sep 17 00:00:00 2001 From: Hemant Kumar Date: Fri, 21 Feb 2020 22:12:58 -0500 Subject: [PATCH] Respect ignore-volume-az option in admission plugin We appear to be respecting this options when provisioning the volume but when PV is admitted the zone/region fields get added back to the PV and hence defeating the purpose of the option. --- .../legacy-cloud-providers/openstack/openstack_volumes.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/staging/src/k8s.io/legacy-cloud-providers/openstack/openstack_volumes.go b/staging/src/k8s.io/legacy-cloud-providers/openstack/openstack_volumes.go index 95e38854912..4e36987c9df 100644 --- a/staging/src/k8s.io/legacy-cloud-providers/openstack/openstack_volumes.go +++ b/staging/src/k8s.io/legacy-cloud-providers/openstack/openstack_volumes.go @@ -726,6 +726,11 @@ func (os *OpenStack) GetLabelsForVolume(ctx context.Context, pv *v1.PersistentVo return nil, nil } + // if volume az is to be ignored we should return nil from here + if os.bsOpts.IgnoreVolumeAZ { + return nil, nil + } + // Get Volume volume, err := os.getVolume(pv.Spec.Cinder.VolumeID) if err != nil {