Skip to content

Commit

Permalink
Merge pull request #845 from nilo19/cherry-pick-842-1.1
Browse files Browse the repository at this point in the history
fix: skip instance not found when decoupling vmss from lb
  • Loading branch information
k8s-ci-robot committed Oct 14, 2021
2 parents a2007fa + afeefaf commit b3b536c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
5 changes: 5 additions & 0 deletions pkg/provider/azure_vmss.go
Expand Up @@ -1517,6 +1517,11 @@ func (ss *ScaleSet) EnsureBackendPoolDeleted(service *v1.Service, backendPoolID,
continue
}

if errors.Is(err, cloudprovider.InstanceNotFound) {
klog.Infof("EnsureBackendPoolDeleted(%s): skipping ip config %s because the corresponding vmss vm is not found", getServiceName(service), ipConfigurationID)
continue
}

klog.Errorf("Failed to GetNodeNameByIPConfigurationID(%s): %v", ipConfigurationID, err)
allErrs = append(allErrs, err)
continue
Expand Down
23 changes: 21 additions & 2 deletions pkg/provider/azure_vmss_test.go
Expand Up @@ -2424,6 +2424,26 @@ func TestEnsureBackendPoolDeleted(t *testing.T) {
expectedErr: true,
vmClientErr: &retry.Error{RawError: fmt.Errorf("error")},
},
{
description: "EnsureBackendPoolDeleted should skip the node that doesn't exist",
backendpoolID: testLBBackendpoolID0,
backendAddressPools: &[]network.BackendAddressPool{
{
ID: to.StringPtr(testLBBackendpoolID0),
BackendAddressPoolPropertiesFormat: &network.BackendAddressPoolPropertiesFormat{
BackendIPConfigurations: &[]network.InterfaceIPConfiguration{
{
Name: to.StringPtr("ip-1"),
ID: to.StringPtr("/subscriptions/sub/resourceGroups/rg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss/virtualMachines/6/networkInterfaces/nic"),
},
},
},
},
{
ID: to.StringPtr(testLBBackendpoolID1),
},
},
},
}

for _, test := range testCases {
Expand Down Expand Up @@ -2477,7 +2497,6 @@ func TestEnsureBackendPoolDeletedConcurrently(t *testing.T) {
},
},
{
// this would fail
ID: to.StringPtr(testLBBackendpoolID2),
BackendAddressPoolPropertiesFormat: &network.BackendAddressPoolPropertiesFormat{
BackendIPConfigurations: &[]network.InterfaceIPConfiguration{
Expand Down Expand Up @@ -2516,7 +2535,7 @@ func TestEnsureBackendPoolDeletedConcurrently(t *testing.T) {
mockVMSSVMClient.EXPECT().UpdateVMs(gomock.Any(), ss.ResourceGroup, gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).Times(2)

backendpoolAddressIDs := []string{testLBBackendpoolID0, testLBBackendpoolID1, testLBBackendpoolID2}
testVMSSNames := []string{"vmss-0", "vmss-1", "vmss-0"}
testVMSSNames := []string{"vmss-0", "vmss-1", "vmss-2"}
testFunc := make([]func() error, 0)
for i, id := range backendpoolAddressIDs {
i := i
Expand Down

0 comments on commit b3b536c

Please sign in to comment.