Skip to content

Commit b8600d7

Browse files
authored
Merge pull request kubernetes#90273 from nilo19/cleanup/enrich-azure-vmss-unit-test
Provider/Azure: Enrich the unit tests for azure_vmss.go.
2 parents 1aa2c99 + 3fdceba commit b8600d7

File tree

4 files changed

+1607
-14
lines changed

4 files changed

+1607
-14
lines changed

staging/src/k8s.io/legacy-cloud-providers/azure/azure_fakes.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ func GetTestCloud(ctrl *gomock.Controller) (az *Cloud) {
6161
SecurityGroupName: "nsg",
6262
RouteTableName: "rt",
6363
PrimaryAvailabilitySetName: "as",
64+
PrimaryScaleSetName: "vmss",
6465
MaximumLoadBalancerRuleCount: 250,
6566
VMType: vmTypeStandard,
6667
},

staging/src/k8s.io/legacy-cloud-providers/azure/azure_loadbalancer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1731,7 +1731,7 @@ func subnet(service *v1.Service) *string {
17311731

17321732
// getServiceLoadBalancerMode parses the mode value.
17331733
// if the value is __auto__ it returns isAuto = TRUE.
1734-
// if anything else it returns the unique VM set names after triming spaces.
1734+
// if anything else it returns the unique VM set names after trimming spaces.
17351735
func getServiceLoadBalancerMode(service *v1.Service) (hasMode bool, isAuto bool, vmSetNames []string) {
17361736
mode, hasMode := service.Annotations[ServiceAnnotationLoadBalancerMode]
17371737
mode = strings.TrimSpace(mode)

staging/src/k8s.io/legacy-cloud-providers/azure/azure_vmss.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ var (
4444
// virtualMachineScaleSetsDeallocating indicates VMSS instances are in Deallocating state.
4545
virtualMachineScaleSetsDeallocating = "Deallocating"
4646

47-
// ErrorNotVmssInstance indicates an instance is not belongint to any vmss.
47+
// ErrorNotVmssInstance indicates an instance is not belonging to any vmss.
4848
ErrorNotVmssInstance = errors.New("not a vmss instance")
4949

5050
scaleSetNameRE = regexp.MustCompile(`.*/subscriptions/(?:.*)/Microsoft.Compute/virtualMachineScaleSets/(.+)/virtualMachines(?:.*)`)
@@ -289,7 +289,7 @@ func (ss *scaleSet) GetNodeNameByProviderID(providerID string) (types.NodeName,
289289
// NodeName is not part of providerID for vmss instances.
290290
scaleSetName, err := extractScaleSetNameByProviderID(providerID)
291291
if err != nil {
292-
klog.V(4).Infof("Can not extract scale set name from providerID (%s), assuming it is mananaged by availability set: %v", providerID, err)
292+
klog.V(4).Infof("Can not extract scale set name from providerID (%s), assuming it is managed by availability set: %v", providerID, err)
293293
return ss.availabilitySet.GetNodeNameByProviderID(providerID)
294294
}
295295

@@ -300,7 +300,7 @@ func (ss *scaleSet) GetNodeNameByProviderID(providerID string) (types.NodeName,
300300

301301
instanceID, err := getLastSegment(providerID)
302302
if err != nil {
303-
klog.V(4).Infof("Can not extract instanceID from providerID (%s), assuming it is mananaged by availability set: %v", providerID, err)
303+
klog.V(4).Infof("Can not extract instanceID from providerID (%s), assuming it is managed by availability set: %v", providerID, err)
304304
return ss.availabilitySet.GetNodeNameByProviderID(providerID)
305305
}
306306

@@ -433,11 +433,11 @@ func (ss *scaleSet) GetIPByNodeName(nodeName string) (string, string, error) {
433433
return internalIP, publicIP, nil
434434
}
435435

436-
func (ss *scaleSet) getVMSSPublicIPAddress(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string, publicIPAddressName string) (network.PublicIPAddress, bool, error) {
436+
func (ss *scaleSet) getVMSSPublicIPAddress(resourceGroupName string, virtualMachineScaleSetName string, virtualMachineIndex string, networkInterfaceName string, IPConfigurationName string, publicIPAddressName string) (network.PublicIPAddress, bool, error) {
437437
ctx, cancel := getContextWithCancel()
438438
defer cancel()
439439

440-
pip, err := ss.PublicIPAddressesClient.GetVirtualMachineScaleSetPublicIPAddress(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, IPConfigurationName, publicIPAddressName, "")
440+
pip, err := ss.PublicIPAddressesClient.GetVirtualMachineScaleSetPublicIPAddress(ctx, resourceGroupName, virtualMachineScaleSetName, virtualMachineIndex, networkInterfaceName, IPConfigurationName, publicIPAddressName, "")
441441
exists, rerr := checkResourceExistsFromError(err)
442442
if rerr != nil {
443443
return pip, false, rerr.Error()
@@ -712,7 +712,7 @@ func (ss *scaleSet) GetPrimaryInterface(nodeName string) (network.Interface, err
712712
exists, realErr := checkResourceExistsFromError(rerr)
713713
if realErr != nil {
714714
klog.Errorf("error: ss.GetPrimaryInterface(%s), ss.GetVirtualMachineScaleSetNetworkInterface.Get(%s, %s, %s), err=%v", nodeName, resourceGroup, ssName, nicName, realErr)
715-
return network.Interface{}, err
715+
return network.Interface{}, realErr.Error()
716716
}
717717

718718
if !exists {
@@ -956,7 +956,7 @@ func (ss *scaleSet) ensureVMSSInPool(service *v1.Service, nodes []*v1.Node, back
956956
}
957957

958958
if vmss.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations == nil {
959-
klog.V(4).Infof("EnsureHostInPool: cannot obtain the primary network interface configuration, of vmss %s", vmssName)
959+
klog.V(4).Infof("EnsureHostInPool: cannot obtain the primary network interface configuration of vmss %s", vmssName)
960960
continue
961961
}
962962
vmssNIC := *vmss.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations

0 commit comments

Comments
 (0)