Skip to content

Commit

Permalink
fix: replace deprecated labels with new labels in nodeCache update
Browse files Browse the repository at this point in the history
  • Loading branch information
andyzhangx committed Jun 6, 2023
1 parent 9216589 commit 16545eb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/provider/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -1077,7 +1077,7 @@ func (az *Cloud) updateNodeCaches(prevNode, newNode *v1.Node) {
az.nodeNames.Delete(prevNode.ObjectMeta.Name)

// Remove from nodeZones cache.
prevZone, ok := prevNode.ObjectMeta.Labels[consts.LabelFailureDomainBetaZone]
prevZone, ok := prevNode.ObjectMeta.Labels[v1.LabelTopologyZone]
if ok && az.isAvailabilityZone(prevZone) {
az.nodeZones[prevZone].Delete(prevNode.ObjectMeta.Name)
if az.nodeZones[prevZone].Len() == 0 {
Expand Down Expand Up @@ -1119,7 +1119,7 @@ func (az *Cloud) updateNodeCaches(prevNode, newNode *v1.Node) {
az.nodeNames.Insert(newNode.ObjectMeta.Name)

// Add to nodeZones cache.
newZone, ok := newNode.ObjectMeta.Labels[consts.LabelFailureDomainBetaZone]
newZone, ok := newNode.ObjectMeta.Labels[v1.LabelTopologyZone]
if ok && az.isAvailabilityZone(newZone) {
if az.nodeZones[newZone] == nil {
az.nodeZones[newZone] = sets.New[string]()
Expand Down
4 changes: 2 additions & 2 deletions pkg/provider/azure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3675,7 +3675,7 @@ func TestUpdateNodeCaches(t *testing.T) {
prevNode := v1.Node{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{
consts.LabelFailureDomainBetaZone: zone,
v1.LabelTopologyZone: zone,
consts.ExternalResourceGroupLabel: consts.TrueAnnotationValue,
consts.ManagedByAzureLabel: "false",
},
Expand All @@ -3694,7 +3694,7 @@ func TestUpdateNodeCaches(t *testing.T) {
newNode := v1.Node{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{
consts.LabelFailureDomainBetaZone: zone,
v1.LabelTopologyZone: zone,
consts.ExternalResourceGroupLabel: consts.TrueAnnotationValue,
consts.ManagedByAzureLabel: "false",
v1.LabelNodeExcludeBalancers: "true",
Expand Down

0 comments on commit 16545eb

Please sign in to comment.