Skip to content

Commit

Permalink
Promote Cinder topology labels to GA
Browse files Browse the repository at this point in the history
  • Loading branch information
jsafrane committed Mar 3, 2021
1 parent a6a66c3 commit 334c7df
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions pkg/volume/cinder/cinder_test.go
Expand Up @@ -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) {
labels = make(map[string]string)
labels[v1.LabelFailureDomainBetaZone] = "nova"
labels[v1.LabelTopologyZone] = "nova"
return "test-volume-name", 1, labels, "", nil
}

Expand Down Expand Up @@ -241,7 +241,7 @@ func TestPlugin(t *testing.T) {

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)
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/volume/cinder/cinder_util.go
Expand Up @@ -156,7 +156,7 @@ func getZonesFromNodes(kubeClient clientset.Interface) (sets.String, error) {
return zones, err
}
for _, node := range nodes.Items {
if zone, ok := node.Labels[v1.LabelFailureDomainBetaZone]; ok {
if zone, ok := node.Labels[v1.LabelTopologyZone]; ok {
zones.Insert(zone)
}
}
Expand Down Expand Up @@ -229,10 +229,10 @@ func (util *DiskUtil) CreateVolume(c *cinderVolumeProvisioner, node *v1.Node, al
volumeLabels = make(map[string]string)
if IgnoreVolumeAZ == false {
if volumeAZ != "" {
volumeLabels[v1.LabelFailureDomainBetaZone] = volumeAZ
volumeLabels[v1.LabelTopologyZone] = volumeAZ
}
if volumeRegion != "" {
volumeLabels[v1.LabelFailureDomainBetaRegion] = volumeRegion
volumeLabels[v1.LabelTopologyRegion] = volumeRegion
}
}
return volumeID, volSizeGiB, volumeLabels, fstype, nil
Expand Down
Expand Up @@ -748,10 +748,10 @@ func (os *OpenStack) GetLabelsForVolume(ctx context.Context, pv *v1.PersistentVo
// Construct Volume Labels
labels := make(map[string]string)
if volume.AvailabilityZone != "" {
labels[v1.LabelFailureDomainBetaZone] = volume.AvailabilityZone
labels[v1.LabelTopologyZone] = volume.AvailabilityZone
}
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)

Expand Down

0 comments on commit 334c7df

Please sign in to comment.