Skip to content

Commit

Permalink
Fix cloudprovider to also support nodes with only beta topology labels
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiawei0227 committed Jan 7, 2021
1 parent 5fd4001 commit e623dc8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions staging/src/k8s.io/cloud-provider/volume/helpers/zones.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,10 @@ func SelectZonesForVolume(zoneParameterPresent, zonesParameterPresent bool, zone
var ok bool
zoneFromNode, ok = node.ObjectMeta.Labels[v1.LabelTopologyZone]
if !ok {
return nil, fmt.Errorf("%s Label for node missing", v1.LabelTopologyZone)
zoneFromNode, ok = node.ObjectMeta.Labels[v1.LabelFailureDomainBetaZone]
if !ok {
return nil, fmt.Errorf("Either %s or %s Label for node missing", v1.LabelTopologyZone, v1.LabelFailureDomainBetaZone)
}
}
// if single replica volume and node with zone found, return immediately
if numReplicas == 1 {
Expand Down Expand Up @@ -185,7 +188,7 @@ func ZonesFromAllowedTopologies(allowedTopologies []v1.TopologySelectorTerm) (se
zones := make(sets.String)
for _, term := range allowedTopologies {
for _, exp := range term.MatchLabelExpressions {
if exp.Key == v1.LabelTopologyZone {
if exp.Key == v1.LabelTopologyZone || exp.Key == v1.LabelFailureDomainBetaZone {
for _, value := range exp.Values {
zones.Insert(value)
}
Expand Down

0 comments on commit e623dc8

Please sign in to comment.