Skip to content

Commit

Permalink
Ignore VMs in vmss delete backend pools
Browse files Browse the repository at this point in the history
Signed-off-by: ialidzhikov <i.alidjikov@gmail.com>
  • Loading branch information
ialidzhikov committed Oct 1, 2021
1 parent 8724967 commit be8efa6
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions staging/src/k8s.io/legacy-cloud-providers/azure/azure_vmss.go
Original file line number Diff line number Diff line change
Expand Up @@ -1558,7 +1558,7 @@ func (ss *scaleSet) EnsureBackendPoolDeleted(service *v1.Service, backendPoolID,

hostUpdates := make([]func() error, 0, len(ipConfigurationIDs))
nodeUpdates := make(map[vmssMetaInfo]map[string]compute.VirtualMachineScaleSetVM)
errors := make([]error, 0)
allErrs := make([]error, 0)
for i := range ipConfigurationIDs {
ipConfigurationID := ipConfigurationIDs[i]

Expand All @@ -1578,14 +1578,16 @@ func (ss *scaleSet) EnsureBackendPoolDeleted(service *v1.Service, backendPoolID,
}

klog.Errorf("Failed to GetNodeNameByIPConfigurationID(%s): %v", ipConfigurationID, err)
errors = append(errors, err)
allErrs = append(allErrs, err)
continue
}

nodeResourceGroup, nodeVMSS, nodeInstanceID, nodeVMSSVM, err := ss.ensureBackendPoolDeletedFromNode(nodeName, backendPoolID)
if err != nil {
klog.Errorf("EnsureBackendPoolDeleted(%s): backendPoolID(%s) - failed with error %v", getServiceName(service), backendPoolID, err)
errors = append(errors, err)
if !errors.Is(err, ErrorNotVmssInstance) { // Do nothing for the VMAS nodes.
klog.Errorf("EnsureBackendPoolDeleted(%s): backendPoolID(%s) - failed with error %v", getServiceName(service), backendPoolID, err)
allErrs = append(allErrs, err)
}
continue
}

Expand Down Expand Up @@ -1631,8 +1633,8 @@ func (ss *scaleSet) EnsureBackendPoolDeleted(service *v1.Service, backendPoolID,
}

// Fail if there are other errors.
if len(errors) > 0 {
return utilerrors.Flatten(utilerrors.NewAggregate(errors))
if len(allErrs) > 0 {
return utilerrors.Flatten(utilerrors.NewAggregate(allErrs))
}

// Ensure the backendPoolID is also deleted on VMSS itself.
Expand Down

0 comments on commit be8efa6

Please sign in to comment.