Merge pull request #99719 from jsafrane/cinder-label-ga

Promote Cinder topology labels to GA
This commit is contained in:
Kubernetes Prow Robot 2021-03-04 00:29:55 -08:00 committed by GitHub
commit cdd80af120
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 7 deletions

View File

@ -123,7 +123,7 @@ func (fake *fakePDManager) DetachDisk(c *cinderVolumeUnmounter) error {
func (fake *fakePDManager) CreateVolume(c *cinderVolumeProvisioner, node *v1.Node, allowedTopologies []v1.TopologySelectorTerm) (volumeID string, volumeSizeGB int, labels map[string]string, fstype string, err error) { func (fake *fakePDManager) CreateVolume(c *cinderVolumeProvisioner, node *v1.Node, allowedTopologies []v1.TopologySelectorTerm) (volumeID string, volumeSizeGB int, labels map[string]string, fstype string, err error) {
labels = make(map[string]string) labels = make(map[string]string)
labels[v1.LabelFailureDomainBetaZone] = "nova" labels[v1.LabelTopologyZone] = "nova"
return "test-volume-name", 1, labels, "", nil return "test-volume-name", 1, labels, "", nil
} }
@ -241,7 +241,7 @@ func TestPlugin(t *testing.T) {
req := persistentSpec.Spec.NodeAffinity.Required.NodeSelectorTerms[0].MatchExpressions[0] req := persistentSpec.Spec.NodeAffinity.Required.NodeSelectorTerms[0].MatchExpressions[0]
if req.Key != v1.LabelFailureDomainBetaZone { if req.Key != v1.LabelTopologyZone {
t.Errorf("Provision() returned unexpected requirement key in NodeAffinity %v", req.Key) t.Errorf("Provision() returned unexpected requirement key in NodeAffinity %v", req.Key)
} }

View File

@ -156,7 +156,7 @@ func getZonesFromNodes(kubeClient clientset.Interface) (sets.String, error) {
return zones, err return zones, err
} }
for _, node := range nodes.Items { for _, node := range nodes.Items {
if zone, ok := node.Labels[v1.LabelFailureDomainBetaZone]; ok { if zone, ok := node.Labels[v1.LabelTopologyZone]; ok {
zones.Insert(zone) zones.Insert(zone)
} }
} }
@ -229,10 +229,10 @@ func (util *DiskUtil) CreateVolume(c *cinderVolumeProvisioner, node *v1.Node, al
volumeLabels = make(map[string]string) volumeLabels = make(map[string]string)
if IgnoreVolumeAZ == false { if IgnoreVolumeAZ == false {
if volumeAZ != "" { if volumeAZ != "" {
volumeLabels[v1.LabelFailureDomainBetaZone] = volumeAZ volumeLabels[v1.LabelTopologyZone] = volumeAZ
} }
if volumeRegion != "" { if volumeRegion != "" {
volumeLabels[v1.LabelFailureDomainBetaRegion] = volumeRegion volumeLabels[v1.LabelTopologyRegion] = volumeRegion
} }
} }
return volumeID, volSizeGiB, volumeLabels, fstype, nil return volumeID, volSizeGiB, volumeLabels, fstype, nil

View File

@ -748,10 +748,10 @@ func (os *OpenStack) GetLabelsForVolume(ctx context.Context, pv *v1.PersistentVo
// Construct Volume Labels // Construct Volume Labels
labels := make(map[string]string) labels := make(map[string]string)
if volume.AvailabilityZone != "" { if volume.AvailabilityZone != "" {
labels[v1.LabelFailureDomainBetaZone] = volume.AvailabilityZone labels[v1.LabelTopologyZone] = volume.AvailabilityZone
} }
if os.region != "" { if os.region != "" {
labels[v1.LabelFailureDomainBetaRegion] = os.region labels[v1.LabelTopologyRegion] = os.region
} }
klog.V(4).Infof("The Volume %s has labels %v", pv.Spec.Cinder.VolumeID, labels) klog.V(4).Infof("The Volume %s has labels %v", pv.Spec.Cinder.VolumeID, labels)