Merge pull request #95174 from tsmetana/fix-openstack-pvlabeler-zone

Don't add empty AZ labels to OpenStack pre-provisioned PVs
This commit is contained in:
Kubernetes Prow Robot 2020-11-03 21:52:03 -08:00 committed by GitHub
commit ced9d07478
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -744,8 +744,12 @@ func (os *OpenStack) GetLabelsForVolume(ctx context.Context, pv *v1.PersistentVo
// Construct Volume Labels
labels := make(map[string]string)
labels[v1.LabelZoneFailureDomain] = volume.AvailabilityZone
labels[v1.LabelZoneRegion] = os.region
if volume.AvailabilityZone != "" {
labels[v1.LabelZoneFailureDomain] = volume.AvailabilityZone
}
if os.region != "" {
labels[v1.LabelZoneRegion] = os.region
}
klog.V(4).Infof("The Volume %s has labels %v", pv.Spec.Cinder.VolumeID, labels)
return labels, nil