Don't add empty AZ labels to OpenStack volumes

This commit is contained in:
Tomas Smetana 2020-09-30 11:02:36 +02:00
parent 604569482f
commit e9ca265901

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