Repository: kubernetes-sigs/cloud-provider-azure
Pull request #2665 (2022-10-31 08:47:47)

fix: should update dns label if target pip already have one and it needs update

<!--  Thanks for sending a pull request!  Here are some tips for you:

1. If this is your first time, please read our contributor guidelines: https://git.k8s.io/community/contributors/guide/first-contribution.md#your-first-contribution and developer guide https://git.k8s.io/community/contributors/devel/development.md#development-guide
2. Please label this pull request according to what type of issue you are addressing, especially if this is a release targeted pull request. For reference on required PR/issue labels, read here:
https://git.k8s.io/community/contributors/devel/sig-release/release.md#issuepr-kind-label
3. Ensure you have added or ran the appropriate tests for your PR: https://git.k8s.io/community/contributors/devel/sig-testing/testing.md
4. If you want *faster* PR reviews, read how: https://git.k8s.io/community/contributors/guide/pull-requests.md#best-practices-for-faster-reviews
5. If the PR is unfinished, see how to mark it: https://git.k8s.io/community/contributors/guide/pull-requests.md#marking-unfinished-pull-requests
-->

#### What type of PR is this?
/kind bug
/kind regression

<!--
Add one of the following kinds:
/kind bug
/kind cleanup
/kind documentation
/kind feature
/kind design

Optionally add one or more of the following kinds if applicable:
/kind api-change
/kind deprecation
/kind failing-test
/kind flake
/kind regression
-->

#### What this PR does / why we need it:
fix: should update dns label if target pip already have one and it needs update
#### Which issue(s) this PR fixes:
<!--
*Automatically closes linked issue when PR is merged.
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
_If PR is about `failing-tests or flakes`, please post the related issues/tests in a comment and do not use `Fixes`_*
-->
Fixes #

#### Special notes for your reviewer:

#### Does this PR introduce a user-facing change?
<!--
If no, just write "NONE" in the release-note block below.
If yes, a release note is required:
Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required".

For more information on release notes see: https://git.k8s.io/community/contributors/guide/release-notes.md
-->
```release-note
Fix an issue when DNS label of public ip is not updated when service.beta.kubernetes.io/azure-dns-label-name is changed. 
```

#### Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

<!--
This section can be blank if this pull request does not require a release note.

When adding links which point to resources within git repositories, like
KEPs or supporting documentation, please reference a specific commit and avoid
linking directly to the master branch. This ensures that links reference a
specific point in time, rather than a document that may change over time.

See here for guidance on getting permanent links to files: https://help.github.com/en/articles/getting-permanent-links-to-files

Please use the following format for linking documentation:
- [KEP]: <link>
- [Usage]: <link>
- [Other doc]: <link>
-->
```docs

```


netlify[bot]: ### <span aria-hidden="true">👷</span> Deploy Preview for *kubernetes-sigs-cloud-provide-azure* processing.


|  Name | Link |
|---------------------------------|------------------------|
|<span aria-hidden="true">🔨</span> Latest commit | 34230e388ac6d0a4855a33c6455446da021a7d1d |
|<span aria-hidden="true">🔍</span> Latest deploy log | https://app.netlify.com/sites/kubernetes-sigs-cloud-provide-azure/deploys/635f8bb5fb45ac0009b5c9af |
k8s-ci-robot: [APPROVALNOTIFIER] This PR is **APPROVED**

This pull-request has been approved by: *<a href="https://github.com/kubernetes-sigs/cloud-provider-azure/pull/2665#" title="Author self-approved">MartinForReal</a>*

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=kubernetes-sigs%2Fcloud-provider-azure).

The pull request process is described [here](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process)

<details >
Needs approval from an approver in each of these files:

- ~~[OWNERS](https://github.com/kubernetes-sigs/cloud-provider-azure/blob/master/OWNERS)~~ [MartinForReal]

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":[]} -->

Patch:
diff --git a/pkg/cache/azure_cache.go b/pkg/cache/azure_cache.go
index d88041de6..dd936db48 100644
--- a/pkg/cache/azure_cache.go
+++ b/pkg/cache/azure_cache.go
@@ -22,8 +22,6 @@ import (
 	"time"
 
 	"k8s.io/client-go/tools/cache"
-
-	"sigs.k8s.io/cloud-provider-azure/pkg/util/deepcopy"
 )
 
 // AzureCacheReadType defines the read type for cache data
@@ -122,14 +120,8 @@ func (t *TimedCache) getInternal(key string) (*AzureCacheEntry, error) {
 	return newEntry, nil
 }
 
-// Get returns the requested item by key with deep copy.
+// Get returns the requested item by key.
 func (t *TimedCache) Get(key string, crt AzureCacheReadType) (interface{}, error) {
-	data, err := t.get(key, crt)
-	copied := deepcopy.Copy(data)
-	return copied, err
-}
-
-func (t *TimedCache) get(key string, crt AzureCacheReadType) (interface{}, error) {
 	entry, err := t.getInternal(key)
 	if err != nil {
 		return nil, err
diff --git a/pkg/provider/azure_controller_vmssflex.go b/pkg/provider/azure_controller_vmssflex.go
index cba270185..ce4a6c598 100644
--- a/pkg/provider/azure_controller_vmssflex.go
+++ b/pkg/provider/azure_controller_vmssflex.go
@@ -99,14 +99,14 @@ func (fs *FlexScaleSet) AttachDisk(ctx context.Context, nodeName types.NodeName,
 
 	klog.V(2).Infof("azureDisk - update(%s): vm(%s) - attach disk list(%s)", nodeResourceGroup, vmName, diskMap)
 
-	future, rerr := fs.VirtualMachinesClient.UpdateAsync(ctx, nodeResourceGroup, *vm.Name, newVM, "attach_disk")
+	future, rerr := fs.VirtualMachinesClient.UpdateAsync(ctx, nodeResourceGroup, vmName, newVM, "attach_disk")
 	if rerr != nil {
 		klog.Errorf("azureDisk - attach disk list(%s) on rg(%s) vm(%s) failed, err: %v", diskMap, nodeResourceGroup, vmName, rerr)
 		if rerr.HTTPStatusCode == http.StatusNotFound {
 			klog.Errorf("azureDisk - begin to filterNonExistingDisks(%v) on rg(%s) vm(%s)", diskMap, nodeResourceGroup, vmName)
 			disks := fs.filterNonExistingDisks(ctx, *newVM.VirtualMachineProperties.StorageProfile.DataDisks)
 			newVM.VirtualMachineProperties.StorageProfile.DataDisks = &disks
-			future, rerr = fs.VirtualMachinesClient.UpdateAsync(ctx, nodeResourceGroup, *vm.Name, newVM, "attach_disk")
+			future, rerr = fs.VirtualMachinesClient.UpdateAsync(ctx, nodeResourceGroup, vmName, newVM, "attach_disk")
 		}
 	}
 
@@ -179,14 +179,14 @@ func (fs *FlexScaleSet) DetachDisk(ctx context.Context, nodeName types.NodeName,
 
 	klog.V(2).Infof("azureDisk - update(%s): vm(%s) - detach disk list(%s)", nodeResourceGroup, vmName, nodeName, diskMap)
 
-	rerr := fs.VirtualMachinesClient.Update(ctx, nodeResourceGroup, *vm.Name, newVM, "detach_disk")
+	rerr := fs.VirtualMachinesClient.Update(ctx, nodeResourceGroup, vmName, newVM, "detach_disk")
 	if rerr != nil {
 		klog.Errorf("azureDisk - detach disk list(%s) on rg(%s) vm(%s) failed, err: %v", diskMap, nodeResourceGroup, vmName, rerr)
 		if rerr.HTTPStatusCode == http.StatusNotFound {
 			klog.Errorf("azureDisk - begin to filterNonExistingDisks(%v) on rg(%s) vm(%s)", diskMap, nodeResourceGroup, vmName)
 			disks := fs.filterNonExistingDisks(ctx, *vm.StorageProfile.DataDisks)
 			newVM.VirtualMachineProperties.StorageProfile.DataDisks = &disks
-			rerr = fs.VirtualMachinesClient.Update(ctx, nodeResourceGroup, *vm.Name, newVM, "detach_disk")
+			rerr = fs.VirtualMachinesClient.Update(ctx, nodeResourceGroup, vmName, newVM, "detach_disk")
 		}
 	}
 
@@ -208,12 +208,6 @@ func (fs *FlexScaleSet) WaitForUpdateResult(ctx context.Context, future *azure.F
 // UpdateVM updates a vm
 func (fs *FlexScaleSet) UpdateVM(ctx context.Context, nodeName types.NodeName) error {
 	vmName := mapNodeNameToVMName(nodeName)
-	vm, err := fs.getVmssFlexVM(vmName, azcache.CacheReadTypeDefault)
-	if err != nil {
-		// if host doesn't exist, no need to update
-		klog.Warningf("azureDisk - cannot find node %s, skip updating vm)", nodeName)
-		return nil
-	}
 	nodeResourceGroup, err := fs.GetNodeResourceGroup(vmName)
 	if err != nil {
 		return err
@@ -225,7 +219,7 @@ func (fs *FlexScaleSet) UpdateVM(ctx context.Context, nodeName types.NodeName) e
 
 	klog.V(2).Infof("azureDisk - update(%s): vm(%s)", nodeResourceGroup, vmName)
 
-	rerr := fs.VirtualMachinesClient.Update(ctx, nodeResourceGroup, *vm.Name, compute.VirtualMachineUpdate{}, "update_vm")
+	rerr := fs.VirtualMachinesClient.Update(ctx, nodeResourceGroup, vmName, compute.VirtualMachineUpdate{}, "update_vm")
 	klog.V(2).Infof("azureDisk - update(%s): vm(%s) - returned with %v", nodeResourceGroup, vmName, rerr)
 	if rerr != nil {
 		return rerr.Error()
diff --git a/pkg/provider/azure_loadbalancer.go b/pkg/provider/azure_loadbalancer.go
index 0d32a3cdf..fde9fe6bc 100644
--- a/pkg/provider/azure_loadbalancer.go
+++ b/pkg/provider/azure_loadbalancer.go
@@ -1191,7 +1191,8 @@ func reconcileDNSSettings(pip *network.PublicIPAddress, domainNameLabel, service
 		} else {
 			existingDNSLabel := pip.PublicIPAddressPropertiesFormat.DNSSettings.DomainNameLabel
 			if !strings.EqualFold(to.String(existingDNSLabel), domainNameLabel) {
-				return false, fmt.Errorf("ensurePublicIPExists for service(%s): pip(%s) - there is an existing DNS label %s on the public IP", serviceName, pipName, *existingDNSLabel)
+				pip.PublicIPAddressPropertiesFormat.DNSSettings.DomainNameLabel = &domainNameLabel
+				changed = true
 			}
 		}
 
diff --git a/pkg/provider/azure_standard.go b/pkg/provider/azure_standard.go
index ffdfef624..1210c6e54 100644
--- a/pkg/provider/azure_standard.go
+++ b/pkg/provider/azure_standard.go
@@ -449,9 +449,9 @@ type availabilitySet struct {
 	vmasCache *azcache.TimedCache
 }
 
-type AvailabilitySetEntry struct {
-	VMAS          *compute.AvailabilitySet
-	ResourceGroup string
+type availabilitySetEntry struct {
+	vmas          *compute.AvailabilitySet
+	resourceGroup string
 }
 
 func (as *availabilitySet) newVMASCache() (*azcache.TimedCache, error) {
@@ -476,9 +476,9 @@ func (as *availabilitySet) newVMASCache() (*azcache.TimedCache, error) {
 					klog.Warning("failed to get the name of the VMAS")
 					continue
 				}
-				localCache.Store(to.String(vmas.Name), &AvailabilitySetEntry{
-					VMAS:          &vmas,
-					ResourceGroup: resourceGroup,
+				localCache.Store(to.String(vmas.Name), &availabilitySetEntry{
+					vmas:          &vmas,
+					resourceGroup: resourceGroup,
 				})
 			}
 		}
@@ -1249,8 +1249,8 @@ func (as *availabilitySet) getAvailabilitySetByNodeName(nodeName string, crt azc
 
 	var result *compute.AvailabilitySet
 	vmasList.Range(func(_, value interface{}) bool {
-		vmasEntry := value.(*AvailabilitySetEntry)
-		vmas := vmasEntry.VMAS
+		vmasEntry := value.(*availabilitySetEntry)
+		vmas := vmasEntry.vmas
 		if vmas != nil && vmas.AvailabilitySetProperties != nil && vmas.VirtualMachines != nil {
 			for _, vmIDRef := range *vmas.VirtualMachines {
 				if vmIDRef.ID != nil {
diff --git a/pkg/provider/azure_vmss.go b/pkg/provider/azure_vmss.go
index cc7a0fabf..8e4d5a613 100644
--- a/pkg/provider/azure_vmss.go
+++ b/pkg/provider/azure_vmss.go
@@ -144,8 +144,8 @@ func (ss *ScaleSet) getVMSS(vmssName string, crt azcache.AzureCacheReadType) (*c
 
 		vmsses := cached.(*sync.Map)
 		if vmss, ok := vmsses.Load(vmssName); ok {
-			result := vmss.(*VMSSEntry)
-			return result.VMSS, nil
+			result := vmss.(*vmssEntry)
+			return result.vmss, nil
 		}
 
 		return nil, nil
@@ -189,13 +189,13 @@ func (ss *ScaleSet) getVmssVMByNodeIdentity(node *nodeIdentity, crt azcache.Azur
 
 		virtualMachines := cached.(*sync.Map)
 		if entry, ok := virtualMachines.Load(nodeName); ok {
-			result := entry.(*VMSSVirtualMachinesEntry)
-			if result.VirtualMachine == nil {
+			result := entry.(*vmssVirtualMachinesEntry)
+			if result.virtualMachine == nil {
 				klog.Warningf("VM is nil on Node %q, VM is in deleting state", nodeName)
 				return nil, true, nil
 			}
 			found = true
-			return virtualmachine.FromVirtualMachineScaleSetVM(result.VirtualMachine, virtualmachine.ByVMSS(result.VMSSName)), found, nil
+			return virtualmachine.FromVirtualMachineScaleSetVM(result.virtualMachine, virtualmachine.ByVMSS(result.vmssName)), found, nil
 		}
 
 		return nil, found, nil
@@ -336,11 +336,11 @@ func (ss *ScaleSet) getVmssVMByInstanceID(resourceGroup, scaleSetName, instanceI
 
 		virtualMachines := cached.(*sync.Map)
 		virtualMachines.Range(func(key, value interface{}) bool {
-			vmEntry := value.(*VMSSVirtualMachinesEntry)
-			if strings.EqualFold(vmEntry.ResourceGroup, resourceGroup) &&
-				strings.EqualFold(vmEntry.VMSSName, scaleSetName) &&
-				strings.EqualFold(vmEntry.InstanceID, instanceID) {
-				vm = vmEntry.VirtualMachine
+			vmEntry := value.(*vmssVirtualMachinesEntry)
+			if strings.EqualFold(vmEntry.resourceGroup, resourceGroup) &&
+				strings.EqualFold(vmEntry.vmssName, scaleSetName) &&
+				strings.EqualFold(vmEntry.instanceID, instanceID) {
+				vm = vmEntry.virtualMachine
 				found = true
 				return false
 			}
@@ -794,21 +794,21 @@ func (ss *ScaleSet) getNodeIdentityByNodeName(nodeName string, crt azcache.Azure
 
 		vmsses := cached.(*sync.Map)
 		vmsses.Range(func(key, value interface{}) bool {
-			v := value.(*VMSSEntry)
-			if v.VMSS.Name == nil {
+			v := value.(*vmssEntry)
+			if v.vmss.Name == nil {
 				return true
 			}
 
-			vmssPrefix := *v.VMSS.Name
-			if v.VMSS.VirtualMachineProfile != nil &&
-				v.VMSS.VirtualMachineProfile.OsProfile != nil &&
-				v.VMSS.VirtualMachineProfile.OsProfile.ComputerNamePrefix != nil {
-				vmssPrefix = *v.VMSS.VirtualMachineProfile.OsProfile.ComputerNamePrefix
+			vmssPrefix := *v.vmss.Name
+			if v.vmss.VirtualMachineProfile != nil &&
+				v.vmss.VirtualMachineProfile.OsProfile != nil &&
+				v.vmss.VirtualMachineProfile.OsProfile.ComputerNamePrefix != nil {
+				vmssPrefix = *v.vmss.VirtualMachineProfile.OsProfile.ComputerNamePrefix
 			}
 
 			if strings.EqualFold(vmssPrefix, nodeName[:len(nodeName)-6]) {
-				node.vmssName = *v.VMSS.Name
-				node.resourceGroup = v.ResourceGroup
+				node.vmssName = *v.vmss.Name
+				node.resourceGroup = v.resourceGroup
 				return false
 			}
 
@@ -1703,8 +1703,8 @@ func (ss *ScaleSet) ensureBackendPoolDeletedFromVMSS(backendPoolID, vmSetName st
 		var errorList []error
 		walk := func(key, value interface{}) bool {
 			var vmss *compute.VirtualMachineScaleSet
-			if vmssEntry, ok := value.(*VMSSEntry); ok {
-				vmss = vmssEntry.VMSS
+			if vmssEntry, ok := value.(*vmssEntry); ok {
+				vmss = vmssEntry.vmss
 			} else if v, ok := value.(*compute.VirtualMachineScaleSet); ok {
 				vmss = v
 			}
diff --git a/pkg/provider/azure_vmss_cache.go b/pkg/provider/azure_vmss_cache.go
index e406d3eca..c200deb46 100644
--- a/pkg/provider/azure_vmss_cache.go
+++ b/pkg/provider/azure_vmss_cache.go
@@ -33,26 +33,26 @@ import (
 	"sigs.k8s.io/cloud-provider-azure/pkg/consts"
 )
 
-type VMSSVirtualMachinesEntry struct {
-	ResourceGroup  string
-	VMSSName       string
-	InstanceID     string
-	VirtualMachine *compute.VirtualMachineScaleSetVM
-	LastUpdate     time.Time
+type vmssVirtualMachinesEntry struct {
+	resourceGroup  string
+	vmssName       string
+	instanceID     string
+	virtualMachine *compute.VirtualMachineScaleSetVM
+	lastUpdate     time.Time
 }
 
-type VMSSEntry struct {
-	VMSS          *compute.VirtualMachineScaleSet
-	ResourceGroup string
-	LastUpdate    time.Time
+type vmssEntry struct {
+	vmss          *compute.VirtualMachineScaleSet
+	resourceGroup string
+	lastUpdate    time.Time
 }
 
-type NonVmssUniformNodesEntry struct {
-	VMSSFlexVMNodeNames   sets.String
-	VMSSFlexVMProviderIDs sets.String
-	AvSetVMNodeNames      sets.String
-	AvSetVMProviderIDs    sets.String
-	ClusterNodeNames      sets.String
+type nonVmssUniformNodesEntry struct {
+	vmssFlexVMNodeNames   sets.String
+	vmssFlexVMProviderIDs sets.String
+	avSetVMNodeNames      sets.String
+	avSetVMProviderIDs    sets.String
+	clusterNodeNames      sets.String
 }
 
 type VMManagementType string
@@ -93,10 +93,10 @@ func (ss *ScaleSet) newVMSSCache() (*azcache.TimedCache, error) {
 					continue
 				}
 				if scaleSet.OrchestrationMode == "" || scaleSet.OrchestrationMode == compute.Uniform {
-					localCache.Store(*scaleSet.Name, &VMSSEntry{
-						VMSS:          &scaleSet,
-						ResourceGroup: resourceGroup,
-						LastUpdate:    time.Now().UTC(),
+					localCache.Store(*scaleSet.Name, &vmssEntry{
+						vmss:          &scaleSet,
+						resourceGroup: resourceGroup,
+						lastUpdate:    time.Now().UTC(),
 					})
 				}
 			}
@@ -165,7 +165,27 @@ func (ss *ScaleSet) getVMSSVMCache(resourceGroup, vmssName string) (string, *azc
 
 // gcVMSSVMCache delete stale VMSS VMs caches from deleted VMSSes.
 func (ss *ScaleSet) gcVMSSVMCache() error {
-	return ss.vmssCache.Delete(consts.VMSSKey)
+	cached, err := ss.vmssCache.Get(consts.VMSSKey, azcache.CacheReadTypeUnsafe)
+	if err != nil {
+		return err
+	}
+
+	vmsses := cached.(*sync.Map)
+	removed := map[string]bool{}
+	ss.vmssVMCache.Range(func(key, value interface{}) bool {
+		cacheKey := key.(string)
+		vlistIdx := cacheKey[strings.LastIndex(cacheKey, "/")+1:]
+		if _, ok := vmsses.Load(vlistIdx); !ok {
+			removed[cacheKey] = true
+		}
+		return true
+	})
+
+	for key := range removed {
+		ss.vmssVMCache.Delete(key)
+	}
+
+	return nil
 }
 
 // newVMSSVirtualMachinesCache instantiates a new VMs cache for VMs belonging to the provided VMSS.
@@ -175,7 +195,7 @@ func (ss *ScaleSet) newVMSSVirtualMachinesCache(resourceGroupName, vmssName, cac
 	getter := func(key string) (interface{}, error) {
 		localCache := &sync.Map{} // [nodeName]*vmssVirtualMachinesEntry
 
-		oldCache := make(map[string]VMSSVirtualMachinesEntry)
+		oldCache := make(map[string]vmssVirtualMachinesEntry)
 
 		if vmssCache, ok := ss.vmssVMCache.Load(cacheKey); ok {
 			// get old cache before refreshing the cache
@@ -189,7 +209,7 @@ func (ss *ScaleSet) newVMSSVirtualMachinesCache(resourceGroupName, vmssName, cac
 				if cached != nil {
 					virtualMachines := cached.(*sync.Map)
 					virtualMachines.Range(func(key, value interface{}) bool {
-						oldCache[key.(string)] = *value.(*VMSSVirtualMachinesEntry)
+						oldCache[key.(string)] = *value.(*vmssVirtualMachinesEntry)
 						return true
 					})
 				}
@@ -214,18 +234,18 @@ func (ss *ScaleSet) newVMSSVirtualMachinesCache(resourceGroupName, vmssName, cac
 				continue
 			}
 
-			vmssVMCacheEntry := &VMSSVirtualMachinesEntry{
-				ResourceGroup:  resourceGroupName,
-				VMSSName:       vmssName,
-				InstanceID:     to.String(vm.InstanceID),
-				VirtualMachine: &vm,
-				LastUpdate:     time.Now().UTC(),
+			vmssVMCacheEntry := &vmssVirtualMachinesEntry{
+				resourceGroup:  resourceGroupName,
+				vmssName:       vmssName,
+				instanceID:     to.String(vm.InstanceID),
+				virtualMachine: &vm,
+				lastUpdate:     time.Now().UTC(),
 			}
 			// set cache entry to nil when the VM is under deleting.
 			if vm.VirtualMachineScaleSetVMProperties != nil &&
 				strings.EqualFold(to.String(vm.VirtualMachineScaleSetVMProperties.ProvisioningState), string(compute.ProvisioningStateDeleting)) {
 				klog.V(4).Infof("VMSS virtualMachine %q is under deleting, setting its cache to nil", computerName)
-				vmssVMCacheEntry.VirtualMachine = nil
+				vmssVMCacheEntry.virtualMachine = nil
 			}
 			localCache.Store(computerName, vmssVMCacheEntry)
 
@@ -237,24 +257,24 @@ func (ss *ScaleSet) newVMSSVirtualMachinesCache(resourceGroupName, vmssName, cac
 		for name, vmEntry := range oldCache {
 			// if the nil cache entry has existed for vmssVirtualMachinesCacheTTL in the cache
 			// then it should not be added back to the cache
-			if vmEntry.VirtualMachine == nil && time.Since(vmEntry.LastUpdate) > vmssVirtualMachinesCacheTTL {
+			if vmEntry.virtualMachine == nil && time.Since(vmEntry.lastUpdate) > vmssVirtualMachinesCacheTTL {
 				klog.V(5).Infof("ignoring expired entries from old cache for %s", name)
 				continue
 			}
-			LastUpdate := time.Now().UTC()
-			if vmEntry.VirtualMachine == nil {
+			lastUpdate := time.Now().UTC()
+			if vmEntry.virtualMachine == nil {
 				// if this is already a nil entry then keep the time the nil
 				// entry was first created, so we can cleanup unwanted entries
-				LastUpdate = vmEntry.LastUpdate
+				lastUpdate = vmEntry.lastUpdate
 			}
 
 			klog.V(5).Infof("adding old entries to new cache for %s", name)
-			localCache.Store(name, &VMSSVirtualMachinesEntry{
-				ResourceGroup:  vmEntry.ResourceGroup,
-				VMSSName:       vmEntry.VMSSName,
-				InstanceID:     vmEntry.InstanceID,
-				VirtualMachine: nil,
-				LastUpdate:     LastUpdate,
+			localCache.Store(name, &vmssVirtualMachinesEntry{
+				resourceGroup:  vmEntry.resourceGroup,
+				vmssName:       vmEntry.vmssName,
+				instanceID:     vmEntry.instanceID,
+				virtualMachine: nil,
+				lastUpdate:     lastUpdate,
 			})
 		}
 
@@ -264,7 +284,6 @@ func (ss *ScaleSet) newVMSSVirtualMachinesCache(resourceGroupName, vmssName, cac
 	return azcache.NewTimedcache(vmssVirtualMachinesCacheTTL, getter)
 }
 
-// DeleteCacheForNode deletes Node from VMSS VM and VM caches.
 func (ss *ScaleSet) DeleteCacheForNode(nodeName string) error {
 	vmManagementType, err := ss.getVMManagementTypeByNodeName(nodeName, azcache.CacheReadTypeUnsafe)
 	if err != nil {
@@ -293,13 +312,14 @@ func (ss *ScaleSet) DeleteCacheForNode(nodeName string) error {
 		return err
 	}
 
-	err = timedcache.Delete(cacheKey)
+	vmcache, err := timedcache.Get(cacheKey, azcache.CacheReadTypeUnsafe)
 	if err != nil {
 		klog.Errorf("DeleteCacheForNode(%s) failed with error: %v", nodeName, err)
 		return err
 	}
+	virtualMachines := vmcache.(*sync.Map)
+	virtualMachines.Delete(nodeName)
 
-	// Delete in VMSS VM cache
 	if err := ss.gcVMSSVMCache(); err != nil {
 		klog.Errorf("DeleteCacheForNode(%s) failed to gc stale vmss caches: %v", nodeName, err)
 	}
@@ -347,12 +367,12 @@ func (ss *ScaleSet) newNonVmssUniformNodesCache() (*azcache.TimedCache, error) {
 			return nil, err
 		}
 
-		localCache := NonVmssUniformNodesEntry{
-			VMSSFlexVMNodeNames:   vmssFlexVMNodeNames,
-			VMSSFlexVMProviderIDs: vmssFlexVMProviderIDs,
-			AvSetVMNodeNames:      avSetVMNodeNames,
-			AvSetVMProviderIDs:    avSetVMProviderIDs,
-			ClusterNodeNames:      nodeNames,
+		localCache := nonVmssUniformNodesEntry{
+			vmssFlexVMNodeNames:   vmssFlexVMNodeNames,
+			vmssFlexVMProviderIDs: vmssFlexVMProviderIDs,
+			avSetVMNodeNames:      avSetVMNodeNames,
+			avSetVMProviderIDs:    avSetVMProviderIDs,
+			clusterNodeNames:      nodeNames,
 		}
 
 		return localCache, nil
@@ -375,19 +395,19 @@ func (ss *ScaleSet) getVMManagementTypeByNodeName(nodeName string, crt azcache.A
 		return ManagedByUnknownVMSet, err
 	}
 
-	cachedNodes := cached.(NonVmssUniformNodesEntry).ClusterNodeNames
+	cachedNodes := cached.(nonVmssUniformNodesEntry).clusterNodeNames
 
 	// if the node is not in the cache, assume the node has joined after the last cache refresh and attempt to refresh the cache.
 	if !cachedNodes.Has(nodeName) {
-		klog.V(2).Infof("Node %s has joined the cluster since the last VM cache refresh in NonVmssUniformNodesEntry, refreshing the cache", nodeName)
+		klog.V(2).Infof("Node %s has joined the cluster since the last VM cache refresh in nonVmssUniformNodesEntry, refreshing the cache", nodeName)
 		cached, err = ss.nonVmssUniformNodesCache.Get(consts.NonVmssUniformNodesKey, azcache.CacheReadTypeForceRefresh)
 		if err != nil {
 			return ManagedByUnknownVMSet, err
 		}
 	}
 
-	cachedAvSetVMs := cached.(NonVmssUniformNodesEntry).AvSetVMNodeNames
-	cachedVmssFlexVMs := cached.(NonVmssUniformNodesEntry).VMSSFlexVMNodeNames
+	cachedAvSetVMs := cached.(nonVmssUniformNodesEntry).avSetVMNodeNames
+	cachedVmssFlexVMs := cached.(nonVmssUniformNodesEntry).vmssFlexVMNodeNames
 
 	if cachedAvSetVMs.Has(nodeName) {
 		return ManagedByAvSet, nil
@@ -414,8 +434,8 @@ func (ss *ScaleSet) getVMManagementTypeByProviderID(providerID string, crt azcac
 		return ManagedByUnknownVMSet, err
 	}
 
-	cachedVmssFlexVMProviderIDs := cached.(NonVmssUniformNodesEntry).VMSSFlexVMProviderIDs
-	cachedAvSetVMProviderIDs := cached.(NonVmssUniformNodesEntry).AvSetVMProviderIDs
+	cachedVmssFlexVMProviderIDs := cached.(nonVmssUniformNodesEntry).vmssFlexVMProviderIDs
+	cachedAvSetVMProviderIDs := cached.(nonVmssUniformNodesEntry).avSetVMProviderIDs
 
 	if cachedAvSetVMProviderIDs.Has(providerID) {
 		return ManagedByAvSet, nil
@@ -456,7 +476,7 @@ func (ss *ScaleSet) getVMManagementTypeByIPConfigurationID(ipConfigurationID str
 
 	vmName := strings.Replace(nicName, "-nic", "", 1)
 
-	cachedAvSetVMs := cached.(NonVmssUniformNodesEntry).AvSetVMNodeNames
+	cachedAvSetVMs := cached.(nonVmssUniformNodesEntry).avSetVMNodeNames
 
 	if cachedAvSetVMs.Has(vmName) {
 		return ManagedByAvSet, nil
diff --git a/pkg/provider/azure_vmssflex.go b/pkg/provider/azure_vmssflex.go
index 44c5e2eab..391846071 100644
--- a/pkg/provider/azure_vmssflex.go
+++ b/pkg/provider/azure_vmssflex.go
@@ -394,23 +394,7 @@ func (fs *FlexScaleSet) getNodeInformationByIPConfigurationID(ipConfigurationID
 		return "", "", "", fmt.Errorf("invalid ip config ID %s", ipConfigurationID)
 	}
 
-	// get vmName by nic name
-	ctx, cancel := getContextWithCancel()
-	defer cancel()
-	nic, rerr := fs.InterfacesClient.Get(ctx, nicResourceGroup, nicName, "")
-	if rerr != nil {
-		return "", "", "", fmt.Errorf("getNodeInformationByIPConfigurationID(%s): failed to get interface of name %s: %w", ipConfigurationID, nicName, rerr.Error())
-	}
-	if nic.InterfacePropertiesFormat == nil || nic.InterfacePropertiesFormat.VirtualMachine == nil || nic.InterfacePropertiesFormat.VirtualMachine.ID == nil {
-		return "", "", "", fmt.Errorf("failed to get vm ID of ip config ID %s", ipConfigurationID)
-	}
-	vmID := to.String(nic.InterfacePropertiesFormat.VirtualMachine.ID)
-	matches = vmIDRE.FindStringSubmatch(vmID)
-	if len(matches) != 2 {
-		return "", "", "", fmt.Errorf("invalid virtual machine ID %s", vmID)
-	}
-	vmName := matches[1]
-
+	vmName := strings.Replace(nicName, "-nic", "", 1)
 	nodeName, err := fs.getNodeNameByVMName(vmName)
 	if err != nil {
 		return "", "", "", fmt.Errorf("failed to map VM Name to NodeName: VM Name %s", vmName)
diff --git a/pkg/provider/azure_vmssflex_cache.go b/pkg/provider/azure_vmssflex_cache.go
index 7e5055ca7..78341d0cd 100644
--- a/pkg/provider/azure_vmssflex_cache.go
+++ b/pkg/provider/azure_vmssflex_cache.go
@@ -33,6 +33,7 @@ import (
 )
 
 func (fs *FlexScaleSet) newVmssFlexCache() (*azcache.TimedCache, error) {
+
 	getter := func(key string) (interface{}, error) {
 		localCache := &sync.Map{}
 
@@ -220,13 +221,13 @@ func (fs *FlexScaleSet) getVmssFlexVM(nodeName string, crt azcache.AzureCacheRea
 	}
 
 	vmMap := cached.(*sync.Map)
-	cachedVM, ok := vmMap.Load(nodeName)
+	cachvmedVM, ok := vmMap.Load(nodeName)
 	if !ok {
 		klog.V(2).Infof("did not find node (%s) in the existing cache, which means it is deleted...", nodeName)
 		return vm, cloudprovider.InstanceNotFound
 	}
 
-	return *(cachedVM.(*compute.VirtualMachine)), nil
+	return *(cachvmedVM.(*compute.VirtualMachine)), nil
 }
 
 func (fs *FlexScaleSet) getVmssFlexByVmssFlexID(vmssFlexID string, crt azcache.AzureCacheReadType) (*compute.VirtualMachineScaleSet, error) {
diff --git a/pkg/util/deepcopy/deepcopy.go b/pkg/util/deepcopy/deepcopy.go
deleted file mode 100644
index 4282ad14a..000000000
--- a/pkg/util/deepcopy/deepcopy.go
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
-Copyright 2022 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package deepcopy
-
-import (
-	"reflect"
-	"sync"
-)
-
-type deepCopyInterface interface {
-	DeepCopy() interface{}
-}
-
-// Copy deepcopies from v.
-func Copy(src interface{}) interface{} {
-	if src == nil {
-		return nil
-	}
-
-	if fromSyncMap, ok := src.(*sync.Map); ok {
-		to := copySyncMap(fromSyncMap)
-		return to
-	}
-
-	return copyNormal(src)
-}
-
-// copySyncMap copies with sync.Map but not nested
-// Targets are vmssVMCache, vmssFlexVMCache, etc.
-func copySyncMap(from *sync.Map) *sync.Map {
-	to := &sync.Map{}
-
-	from.Range(func(k, v interface{}) bool {
-		vm, ok := v.(*sync.Map)
-		if ok {
-			to.Store(k, copySyncMap(vm))
-		} else {
-			to.Store(k, copyNormal(v))
-		}
-		return true
-	})
-
-	return to
-}
-
-func copyNormal(src interface{}) interface{} {
-	if src == nil {
-		return nil
-	}
-
-	from := reflect.ValueOf(src)
-
-	to := reflect.New(from.Type()).Elem()
-
-	copy(from, to)
-
-	return to.Interface()
-}
-
-func copy(from, to reflect.Value) {
-	// Check if DeepCopy() is already implemented for the interface
-	if from.CanInterface() {
-		if deepcopy, ok := from.Interface().(deepCopyInterface); ok {
-			to.Set(reflect.ValueOf(deepcopy.DeepCopy()))
-			return
-		}
-	}
-
-	switch from.Kind() {
-	case reflect.Pointer:
-		fromValue := from.Elem()
-		if !fromValue.IsValid() {
-			return
-		}
-
-		to.Set(reflect.New(fromValue.Type()))
-		copy(fromValue, to.Elem())
-
-	case reflect.Interface:
-		if from.IsNil() {
-			return
-		}
-
-		fromValue := from.Elem()
-		toValue := reflect.New(fromValue.Type()).Elem()
-		copy(fromValue, toValue)
-		to.Set(toValue)
-
-	case reflect.Struct:
-		for i := 0; i < from.NumField(); i++ {
-			if from.Type().Field(i).PkgPath != "" {
-				// It is an unexported field.
-				continue
-			}
-			copy(from.Field(i), to.Field(i))
-		}
-
-	case reflect.Slice:
-		if from.IsNil() {
-			return
-		}
-
-		to.Set(reflect.MakeSlice(from.Type(), from.Len(), from.Cap()))
-		for i := 0; i < from.Len(); i++ {
-			copy(from.Index(i), to.Index(i))
-		}
-
-	case reflect.Map:
-		if from.IsNil() {
-			return
-		}
-
-		to.Set(reflect.MakeMap(from.Type()))
-		for _, key := range from.MapKeys() {
-			fromValue := from.MapIndex(key)
-			toValue := reflect.New(fromValue.Type()).Elem()
-			copy(fromValue, toValue)
-			copiedKey := Copy(key.Interface())
-			to.SetMapIndex(reflect.ValueOf(copiedKey), toValue)
-		}
-
-	default:
-		to.Set(from)
-	}
-}
diff --git a/site/content/en/blog/releases/v1.1.26.md b/site/content/en/blog/releases/v1.1.26.md
deleted file mode 100644
index 5bd72e8d2..000000000
--- a/site/content/en/blog/releases/v1.1.26.md
+++ /dev/null
@@ -1,32 +0,0 @@
----
-title: v1.1.26
-linkTitle: v1.1.26
-date: 2022-10-31
-description: Cloud Provider Azure v1.1.26
----
-
-
-## Changes by Kind
-
-### Other (Cleanup or Flake)
-
-- Bump azure compute to 2022-03-01 ([#2643](https://github.com/kubernetes-sigs/cloud-provider-azure/pull/2643), [@MartinForReal](https://github.com/MartinForReal))
-
-## Dependencies
-
-### Added
-_Nothing has changed._
-
-### Changed
-- github.com/stretchr/objx: [v0.4.0 → v0.5.0](https://github.com/stretchr/objx/compare/v0.4.0...v0.5.0)
-- github.com/stretchr/testify: [v1.8.0 → v1.8.1](https://github.com/stretchr/testify/compare/v1.8.0...v1.8.1)
-- k8s.io/api: v0.22.12 → v0.22.15
-- k8s.io/apimachinery: v0.22.12 → v0.22.15
-- k8s.io/apiserver: v0.22.12 → v0.22.15
-- k8s.io/client-go: v0.22.12 → v0.22.15
-- k8s.io/cloud-provider: v0.22.12 → v0.22.15
-- k8s.io/component-base: v0.22.12 → v0.22.15
-- k8s.io/controller-manager: v0.22.12 → v0.22.15
-
-### Removed
-_Nothing has changed._
diff --git a/site/content/en/blog/releases/v1.23.23.md b/site/content/en/blog/releases/v1.23.23.md
deleted file mode 100644
index 78c319d97..000000000
--- a/site/content/en/blog/releases/v1.23.23.md
+++ /dev/null
@@ -1,24 +0,0 @@
----
-title: v1.23.23
-linkTitle: v1.23.23
-date: 2022-10-31
-description: Cloud Provider Azure v1.23.23
----
-
-
-## Changes by Kind
-
-### Other (Cleanup or Flake)
-
-- Bump azure compute to 2022-03-01 ([#2642](https://github.com/kubernetes-sigs/cloud-provider-azure/pull/2642), [@MartinForReal](https://github.com/MartinForReal))
-
-## Dependencies
-
-### Added
-_Nothing has changed._
-
-### Changed
-_Nothing has changed._
-
-### Removed
-_Nothing has changed._
diff --git a/site/content/en/blog/releases/v1.24.10.md b/site/content/en/blog/releases/v1.24.10.md
deleted file mode 100644
index ae59c07db..000000000
--- a/site/content/en/blog/releases/v1.24.10.md
+++ /dev/null
@@ -1,26 +0,0 @@
----
-title: v1.24.10
-linkTitle: v1.24.10
-date: 2022-10-31
-description: Cloud Provider Azure v1.24.10
----
-
-
-## Changes by Kind
-
-### Other (Cleanup or Flake)
-
-- Bump azure compute to 2022-03-01 ([#2633](https://github.com/kubernetes-sigs/cloud-provider-azure/pull/2633), [@MartinForReal](https://github.com/MartinForReal))
-
-## Dependencies
-
-### Added
-_Nothing has changed._
-
-### Changed
-- github.com/google/go-cmp: [v0.5.8 → v0.5.9](https://github.com/google/go-cmp/compare/v0.5.8...v0.5.9)
-- github.com/onsi/gomega: [v1.22.1 → v1.23.0](https://github.com/onsi/gomega/compare/v1.22.1...v1.23.0)
-- github.com/spf13/cobra: [v1.6.0 → v1.6.1](https://github.com/spf13/cobra/compare/v1.6.0...v1.6.1)
-
-### Removed
-_Nothing has changed._
diff --git a/site/content/en/blog/releases/v1.25.4.md b/site/content/en/blog/releases/v1.25.4.md
deleted file mode 100644
index ff952d4a4..000000000
--- a/site/content/en/blog/releases/v1.25.4.md
+++ /dev/null
@@ -1,33 +0,0 @@
----
-title: v1.25.4
-linkTitle: v1.25.4
-date: 2022-10-31
-description: Cloud Provider Azure v1.25.4
----
-
-
-## Changes by Kind
-
-### Other (Cleanup or Flake)
-
-- Bump azure compute version to 2022-03-01 ([#2632](https://github.com/kubernetes-sigs/cloud-provider-azure/pull/2632), [@MartinForReal](https://github.com/MartinForReal))
-
-## Dependencies
-
-### Added
-_Nothing has changed._
-
-### Changed
-- github.com/google/go-cmp: [v0.5.8 → v0.5.9](https://github.com/google/go-cmp/compare/v0.5.8...v0.5.9)
-- github.com/onsi/ginkgo/v2: [v2.3.1 → v2.4.0](https://github.com/onsi/ginkgo/v2/compare/v2.3.1...v2.4.0)
-- github.com/onsi/gomega: [v1.22.1 → v1.23.0](https://github.com/onsi/gomega/compare/v1.22.1...v1.23.0)
-- github.com/spf13/cobra: [v1.6.0 → v1.6.1](https://github.com/spf13/cobra/compare/v1.6.0...v1.6.1)
-- github.com/stretchr/objx: [v0.4.0 → v0.5.0](https://github.com/stretchr/objx/compare/v0.4.0...v0.5.0)
-- github.com/stretchr/testify: [v1.8.0 → v1.8.1](https://github.com/stretchr/testify/compare/v1.8.0...v1.8.1)
-- golang.org/x/net: f3363e0 → v0.1.0
-- golang.org/x/sys: 2771309 → v0.1.0
-- golang.org/x/term: 03fcf44 → v0.1.0
-- golang.org/x/tools: v0.1.12 → v0.2.0
-
-### Removed
-_Nothing has changed._


Test patch:
diff --git a/pkg/cache/azure_cache_test.go b/pkg/cache/azure_cache_test.go
index 50b110d59..dd3a32c1e 100644
--- a/pkg/cache/azure_cache_test.go
+++ b/pkg/cache/azure_cache_test.go
@@ -30,7 +30,7 @@ const (
 	fakeCacheTTL = 2 * time.Second
 )
 
-type fakeDataObj struct{ Data string }
+type fakeDataObj struct{}
 
 type fakeDataSource struct {
 	called int
@@ -118,40 +118,6 @@ func TestCacheGetError(t *testing.T) {
 	assert.Nil(t, val)
 }
 
-func TestCacheGetWithDeepCopy(t *testing.T) {
-	changed, unchanged := "changed", "unchanged"
-	valFake := &fakeDataObj{unchanged}
-	cases := []struct {
-		name     string
-		data     map[string]*fakeDataObj
-		key      string
-		expected interface{}
-	}{
-		{
-			name:     "cache should return data for existing key",
-			data:     map[string]*fakeDataObj{"key1": valFake},
-			key:      "key1",
-			expected: unchanged,
-		},
-	}
-
-	for _, c := range cases {
-		t.Run(c.name, func(t *testing.T) {
-			dataSource, cache := newFakeCache(t)
-			dataSource.set(c.data)
-			cache.Set(c.key, valFake)
-			val, err := cache.Get(c.key, CacheReadTypeDefault)
-			assert.NoError(t, err)
-			assert.Equal(t, c.expected, val.(*fakeDataObj).Data)
-
-			// Change the value
-			valFake.Data = changed
-			cache.Set(c.key, valFake)
-			assert.Equal(t, c.expected, val.(*fakeDataObj).Data)
-		})
-	}
-}
-
 func TestCacheDelete(t *testing.T) {
 	val := &fakeDataObj{}
 	data := map[string]*fakeDataObj{
diff --git a/pkg/provider/azure_controller_vmssflex_test.go b/pkg/provider/azure_controller_vmssflex_test.go
index e6196663e..71355bd07 100644
--- a/pkg/provider/azure_controller_vmssflex_test.go
+++ b/pkg/provider/azure_controller_vmssflex_test.go
@@ -42,7 +42,6 @@ func TestAttachDiskWithVmssFlex(t *testing.T) {
 	testCases := []struct {
 		description                    string
 		nodeName                       types.NodeName
-		vmName                         string
 		testVMListWithoutInstanceView  []compute.VirtualMachine
 		testVMListWithOnlyInstanceView []compute.VirtualMachine
 		vmListErr                      error
@@ -51,8 +50,7 @@ func TestAttachDiskWithVmssFlex(t *testing.T) {
 	}{
 		{
 			description:                    "AttachDisk should work as expected with managed disk",
-			nodeName:                       types.NodeName(testVM1Spec.ComputerName),
-			vmName:                         testVM1Spec.VMName,
+			nodeName:                       "vmssflex1000001",
 			testVMListWithoutInstanceView:  testVMListWithoutInstanceView,
 			testVMListWithOnlyInstanceView: testVMListWithOnlyInstanceView,
 			vmListErr:                      nil,
@@ -70,8 +68,7 @@ func TestAttachDiskWithVmssFlex(t *testing.T) {
 		},
 		{
 			description:                    "AttachDisk should return error if update VM fails",
-			nodeName:                       types.NodeName(testVM1Spec.ComputerName),
-			vmName:                         testVM1Spec.VMName,
+			nodeName:                       "vmssflex1000001",
 			testVMListWithoutInstanceView:  testVMListWithoutInstanceView,
 			testVMListWithOnlyInstanceView: testVMListWithOnlyInstanceView,
 			vmListErr:                      nil,
@@ -91,7 +88,7 @@ func TestAttachDiskWithVmssFlex(t *testing.T) {
 		mockVMClient.EXPECT().ListVmssFlexVMsWithoutInstanceView(gomock.Any(), gomock.Any()).Return(tc.testVMListWithoutInstanceView, tc.vmListErr).AnyTimes()
 		mockVMClient.EXPECT().ListVmssFlexVMsWithOnlyInstanceView(gomock.Any(), gomock.Any()).Return(tc.testVMListWithOnlyInstanceView, tc.vmListErr).AnyTimes()
 
-		mockVMClient.EXPECT().UpdateAsync(gomock.Any(), gomock.Any(), tc.vmName, gomock.Any(), gomock.Any()).Return(nil, tc.vmssFlexVMUpdateError).AnyTimes()
+		mockVMClient.EXPECT().UpdateAsync(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil, tc.vmssFlexVMUpdateError).AnyTimes()
 
 		options := AttachDiskOptions{
 			lun:                     0,
@@ -122,7 +119,6 @@ func TestDettachDiskWithVmssFlex(t *testing.T) {
 	testCases := []struct {
 		description                    string
 		nodeName                       types.NodeName
-		vmName                         string
 		testVMListWithoutInstanceView  []compute.VirtualMachine
 		testVMListWithOnlyInstanceView []compute.VirtualMachine
 		vmListErr                      error
@@ -132,8 +128,7 @@ func TestDettachDiskWithVmssFlex(t *testing.T) {
 	}{
 		{
 			description:                    "DetachDisk should work as expected with managed disk",
-			nodeName:                       types.NodeName(testVM1Spec.ComputerName),
-			vmName:                         testVM1Spec.VMName,
+			nodeName:                       "vmssflex1000001",
 			testVMListWithoutInstanceView:  testVMListWithoutInstanceView,
 			testVMListWithOnlyInstanceView: testVMListWithOnlyInstanceView,
 			vmListErr:                      nil,
@@ -153,8 +148,7 @@ func TestDettachDiskWithVmssFlex(t *testing.T) {
 		},
 		{
 			description:                    "DetachDisk should should do nothing if there's a corresponding disk",
-			nodeName:                       types.NodeName(testVM1Spec.ComputerName),
-			vmName:                         testVM1Spec.VMName,
+			nodeName:                       "vmssflex1000001",
 			testVMListWithoutInstanceView:  testVMListWithoutInstanceView,
 			testVMListWithOnlyInstanceView: testVMListWithOnlyInstanceView,
 			vmListErr:                      nil,
@@ -164,8 +158,7 @@ func TestDettachDiskWithVmssFlex(t *testing.T) {
 		},
 		{
 			description:                    "AttachDisk should return error if update VM fails",
-			nodeName:                       types.NodeName(testVM1Spec.ComputerName),
-			vmName:                         testVM1Spec.VMName,
+			nodeName:                       "vmssflex1000001",
 			testVMListWithoutInstanceView:  testVMListWithoutInstanceView,
 			testVMListWithOnlyInstanceView: testVMListWithOnlyInstanceView,
 			vmListErr:                      nil,
@@ -186,7 +179,7 @@ func TestDettachDiskWithVmssFlex(t *testing.T) {
 		mockVMClient.EXPECT().ListVmssFlexVMsWithoutInstanceView(gomock.Any(), gomock.Any()).Return(tc.testVMListWithoutInstanceView, tc.vmListErr).AnyTimes()
 		mockVMClient.EXPECT().ListVmssFlexVMsWithOnlyInstanceView(gomock.Any(), gomock.Any()).Return(tc.testVMListWithOnlyInstanceView, tc.vmListErr).AnyTimes()
 
-		mockVMClient.EXPECT().Update(gomock.Any(), gomock.Any(), tc.vmName, gomock.Any(), "detach_disk").Return(tc.vmssFlexVMUpdateError).AnyTimes()
+		mockVMClient.EXPECT().Update(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), "detach_disk").Return(tc.vmssFlexVMUpdateError).AnyTimes()
 
 		err = fs.DetachDisk(ctx, tc.nodeName, tc.diskMap)
 		if tc.expectedErr == nil {
@@ -208,7 +201,6 @@ func TestUpdateVMWithVmssFlex(t *testing.T) {
 	testCases := []struct {
 		description                    string
 		nodeName                       types.NodeName
-		vmName                         string
 		testVMListWithoutInstanceView  []compute.VirtualMachine
 		testVMListWithOnlyInstanceView []compute.VirtualMachine
 		vmListErr                      error
@@ -217,8 +209,7 @@ func TestUpdateVMWithVmssFlex(t *testing.T) {
 	}{
 		{
 			description:                    "UpdateVM should work as expected if vm client update succeeds",
-			nodeName:                       types.NodeName(testVM1Spec.ComputerName),
-			vmName:                         testVM1Spec.VMName,
+			nodeName:                       "vmssflex1000001",
 			testVMListWithoutInstanceView:  testVMListWithoutInstanceView,
 			testVMListWithOnlyInstanceView: testVMListWithOnlyInstanceView,
 			vmListErr:                      nil,
@@ -227,8 +218,7 @@ func TestUpdateVMWithVmssFlex(t *testing.T) {
 		},
 		{
 			description:                    "UpdateVM should return error if update VM fails",
-			nodeName:                       types.NodeName(testVM1Spec.ComputerName),
-			vmName:                         testVM1Spec.VMName,
+			nodeName:                       "vmssflex1000001",
 			testVMListWithoutInstanceView:  testVMListWithoutInstanceView,
 			testVMListWithOnlyInstanceView: testVMListWithOnlyInstanceView,
 			vmListErr:                      nil,
@@ -247,7 +237,7 @@ func TestUpdateVMWithVmssFlex(t *testing.T) {
 		mockVMClient := fs.VirtualMachinesClient.(*mockvmclient.MockInterface)
 		mockVMClient.EXPECT().ListVmssFlexVMsWithoutInstanceView(gomock.Any(), gomock.Any()).Return(tc.testVMListWithoutInstanceView, tc.vmListErr).AnyTimes()
 		mockVMClient.EXPECT().ListVmssFlexVMsWithOnlyInstanceView(gomock.Any(), gomock.Any()).Return(tc.testVMListWithOnlyInstanceView, tc.vmListErr).AnyTimes()
-		mockVMClient.EXPECT().Update(gomock.Any(), gomock.Any(), tc.vmName, gomock.Any(), "update_vm").Return(tc.vmssFlexVMUpdateError).AnyTimes()
+		mockVMClient.EXPECT().Update(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), "update_vm").Return(tc.vmssFlexVMUpdateError).AnyTimes()
 
 		err = fs.UpdateVM(ctx, tc.nodeName)
 
diff --git a/pkg/provider/azure_loadbalancer_test.go b/pkg/provider/azure_loadbalancer_test.go
index bd3824bef..8deccf35b 100644
--- a/pkg/provider/azure_loadbalancer_test.go
+++ b/pkg/provider/azure_loadbalancer_test.go
@@ -4086,11 +4086,6 @@ func TestEnsurePublicIPExists(t *testing.T) {
 				Name: to.StringPtr("pip1"),
 				ID: to.StringPtr("/subscriptions/subscription/resourceGroups/rg" +
 					"/providers/Microsoft.Network/publicIPAddresses/pip1"),
-				PublicIPAddressPropertiesFormat: &network.PublicIPAddressPropertiesFormat{
-					PublicIPAddressVersion:   network.IPVersionIPv4,
-					PublicIPAllocationMethod: network.IPAllocationMethodStatic,
-				},
-				Tags: map[string]*string{},
 			},
 			shouldPutPIP: true,
 		},
@@ -4118,7 +4113,6 @@ func TestEnsurePublicIPExists(t *testing.T) {
 					},
 					PublicIPAddressVersion: "IPv4",
 				},
-				Tags: map[string]*string{consts.ServiceUsingDNSKey: to.StringPtr("default/test1")},
 			},
 			shouldPutPIP: true,
 		},
@@ -4141,7 +4135,6 @@ func TestEnsurePublicIPExists(t *testing.T) {
 					DNSSettings:            nil,
 					PublicIPAddressVersion: "IPv4",
 				},
-				Tags: map[string]*string{},
 			},
 			shouldPutPIP: true,
 		},
@@ -4188,7 +4181,69 @@ func TestEnsurePublicIPExists(t *testing.T) {
 					PublicIPAllocationMethod: "Dynamic",
 					PublicIPAddressVersion:   "IPv6",
 				},
-				Tags: map[string]*string{consts.ServiceUsingDNSKey: to.StringPtr("default/test1")},
+			},
+			shouldPutPIP: true,
+		},
+		{
+			desc:                    "shall update existed PIP's dns label for IPv6",
+			inputDNSLabel:           "newdns",
+			foundDNSLabelAnnotation: true,
+			isIPv6:                  true,
+			existingPIPs: []network.PublicIPAddress{{
+				Name: to.StringPtr("pip1"),
+				PublicIPAddressPropertiesFormat: &network.PublicIPAddressPropertiesFormat{
+					DNSSettings: &network.PublicIPAddressDNSSettings{
+						DomainNameLabel: to.StringPtr("previousdns"),
+					},
+				},
+			}},
+			expectedPIP: &network.PublicIPAddress{
+				Name: to.StringPtr("pip1"),
+				ID: to.StringPtr("/subscriptions/subscription/resourceGroups/rg" +
+					"/providers/Microsoft.Network/publicIPAddresses/pip1"),
+				PublicIPAddressPropertiesFormat: &network.PublicIPAddressPropertiesFormat{
+					DNSSettings: &network.PublicIPAddressDNSSettings{
+						DomainNameLabel: to.StringPtr("newdns"),
+					},
+					PublicIPAllocationMethod: "Dynamic",
+					PublicIPAddressVersion:   "IPv6",
+				},
+				Tags: map[string]*string{
+					"k8s-azure-dns-label-service": to.StringPtr("default/test1"),
+				},
+			},
+			shouldPutPIP: true,
+		},
+		{
+			desc:                    "shall update existed PIP's dns label for IPv4",
+			inputDNSLabel:           "newdns",
+			foundDNSLabelAnnotation: true,
+			isIPv6:                  false,
+			existingPIPs: []network.PublicIPAddress{{
+
+				Name: to.StringPtr("pip1"),
+				PublicIPAddressPropertiesFormat: &network.PublicIPAddressPropertiesFormat{
+					DNSSettings: &network.PublicIPAddressDNSSettings{
+						DomainNameLabel: to.StringPtr("previousdns"),
+					},
+					PublicIPAllocationMethod: "Dynamic",
+					PublicIPAddressVersion:   "IPv4",
+				},
+			}},
+			expectedPIP: &network.PublicIPAddress{
+				Name: to.StringPtr("pip1"),
+				ID: to.StringPtr("/subscriptions/subscription/resourceGroups/rg" +
+					"/providers/Microsoft.Network/publicIPAddresses/pip1"),
+				PublicIPAddressPropertiesFormat: &network.PublicIPAddressPropertiesFormat{
+					DNSSettings: &network.PublicIPAddressDNSSettings{
+						DomainNameLabel: to.StringPtr("newdns"),
+					},
+					PublicIPAllocationMethod: "Dynamic",
+					PublicIPAddressVersion:   "IPv4",
+				},
+				Tags: map[string]*string{
+					"k8s-azure-dns-label-service": to.StringPtr("default/test1"),
+				},
 			},
 			shouldPutPIP: true,
 		},
@@ -4254,11 +4309,6 @@ func TestEnsurePublicIPExists(t *testing.T) {
 				Name: to.StringPtr("pip1"),
 				ID: to.StringPtr("/subscriptions/subscription/resourceGroups/rg" +
 					"/providers/Microsoft.Network/publicIPAddresses/pip1"),
-				PublicIPAddressPropertiesFormat: &network.PublicIPAddressPropertiesFormat{
-					PublicIPAddressVersion:   network.IPVersionIPv4,
-					PublicIPAllocationMethod: network.IPAllocationMethodStatic,
-				},
-				Tags: map[string]*string{},
 			},
 			shouldPutPIP: true,
 		},
@@ -4283,7 +4333,6 @@ func TestEnsurePublicIPExists(t *testing.T) {
 					PublicIPAddressVersion:   network.IPVersionIPv6,
 					PublicIPAllocationMethod: network.IPAllocationMethodDynamic,
 				},
-				Tags: map[string]*string{},
 			},
 			shouldPutPIP: true,
 		},
@@ -4291,14 +4340,9 @@ func TestEnsurePublicIPExists(t *testing.T) {
 			desc:         "shall update pip tags if there is any change",
 			existingPIPs: []network.PublicIPAddress{{Name: to.StringPtr("pip1"), Tags: map[string]*string{"a": to.StringPtr("b")}}},
 			expectedPIP: &network.PublicIPAddress{
-				Name: to.StringPtr("pip1"),
-				Tags: map[string]*string{"a": to.StringPtr("c")},
+				Name: to.StringPtr("pip1"), Tags: map[string]*string{"a": to.StringPtr("c")},
 				ID: to.StringPtr("/subscriptions/subscription/resourceGroups/rg" +
 					"/providers/Microsoft.Network/publicIPAddresses/pip1"),
-				PublicIPAddressPropertiesFormat: &network.PublicIPAddressPropertiesFormat{
-					PublicIPAddressVersion:   network.IPVersionIPv4,
-					PublicIPAllocationMethod: network.IPAllocationMethodStatic,
-				},
 			},
 			additionalAnnotations: map[string]string{
 				consts.ServiceAnnotationAzurePIPTags: "a=c",
@@ -4318,12 +4362,7 @@ func TestEnsurePublicIPExists(t *testing.T) {
 			service.ObjectMeta.Annotations = test.additionalAnnotations
 			mockPIPsClient := az.PublicIPAddressesClient.(*mockpublicipclient.MockInterface)
 			if test.shouldPutPIP {
-				mockPIPsClient.EXPECT().CreateOrUpdate(gomock.Any(), "rg", gomock.Any(), gomock.Any()).DoAndReturn(func(ctx context.Context, resourceGroupName string, publicIPAddressName string, parameters network.PublicIPAddress) *retry.Error {
-					if len(test.existingPIPs) != 0 {
-						test.existingPIPs[0] = parameters
-					}
-					return nil
-				}).AnyTimes()
+				mockPIPsClient.EXPECT().CreateOrUpdate(gomock.Any(), "rg", gomock.Any(), gomock.Any()).Return(nil)
 			}
 			mockPIPsClient.EXPECT().Get(gomock.Any(), "rg", "pip1", gomock.Any()).DoAndReturn(func(ctx context.Context, resourceGroupName string, publicIPAddressName string, expand string) (network.PublicIPAddress, *retry.Error) {
 				var basicPIP network.PublicIPAddress
diff --git a/pkg/provider/azure_routes_test.go b/pkg/provider/azure_routes_test.go
index 1b1dad432..7a5510f44 100644
--- a/pkg/provider/azure_routes_test.go
+++ b/pkg/provider/azure_routes_test.go
@@ -168,8 +168,7 @@ func TestDeleteRouteDualStack(t *testing.T) {
 			Routes: &[]network.Route{},
 		},
 	}
-	routeTableClient.EXPECT().Get(gomock.Any(), cloud.RouteTableResourceGroup, cloud.RouteTableName, "").Return(routeTables, nil)
-	routeTableClient.EXPECT().Get(gomock.Any(), cloud.RouteTableResourceGroup, cloud.RouteTableName, "").Return(routeTablesAfterFirstDeletion, nil)
+	routeTableClient.EXPECT().Get(gomock.Any(), cloud.RouteTableResourceGroup, cloud.RouteTableName, "").Return(routeTables, nil).AnyTimes()
 	routeTableClient.EXPECT().CreateOrUpdate(gomock.Any(), cloud.RouteTableResourceGroup, cloud.RouteTableName, routeTablesAfterFirstDeletion, "").Return(nil)
 	routeTableClient.EXPECT().CreateOrUpdate(gomock.Any(), cloud.RouteTableResourceGroup, cloud.RouteTableName, routeTablesAfterSecondDeletion, "").Return(nil)
 	err := cloud.DeleteRoute(context.TODO(), "cluster", &route)
diff --git a/pkg/provider/azure_test.go b/pkg/provider/azure_test.go
index a52f91ee6..71ca4b658 100644
--- a/pkg/provider/azure_test.go
+++ b/pkg/provider/azure_test.go
@@ -2550,14 +2550,13 @@ func TestIfServicesSpecifySharedRuleButDifferentPortsThenSeparateRulesAreCreated
 	svc2.Annotations[consts.ServiceAnnotationSharedSecurityRule] = consts.TrueAnnotationValue
 
 	sg := getTestSecurityGroup(az)
-
 	setMockSecurityGroup(az, ctrl, sg)
-	sg, err := az.reconcileSecurityGroup(testClusterName, &svc1, to.StringPtr(getServiceLoadBalancerIP(&svc1)), nil, true)
+
+	_, err := az.reconcileSecurityGroup(testClusterName, &svc1, to.StringPtr(getServiceLoadBalancerIP(&svc1)), nil, true)
 	if err != nil {
 		t.Errorf("Unexpected error adding svc1: %q", err)
 	}
 
-	setMockSecurityGroup(az, ctrl, sg)
 	sg, err = az.reconcileSecurityGroup(testClusterName, &svc2, to.StringPtr(getServiceLoadBalancerIP(&svc2)), nil, true)
 	if err != nil {
 		t.Errorf("Unexpected error adding svc2: %q", err)
@@ -2623,14 +2622,13 @@ func TestIfServicesSpecifySharedRuleButDifferentProtocolsThenSeparateRulesAreCre
 	testRuleName3 := "shared-UDP-4444-Internet"
 
 	sg := getTestSecurityGroup(az)
-
 	setMockSecurityGroup(az, ctrl, sg)
-	sg, err := az.reconcileSecurityGroup(testClusterName, &svc1, to.StringPtr(getServiceLoadBalancerIP(&svc1)), nil, true)
+
+	_, err := az.reconcileSecurityGroup(testClusterName, &svc1, to.StringPtr(getServiceLoadBalancerIP(&svc1)), nil, true)
 	if err != nil {
 		t.Errorf("Unexpected error adding svc1: %q", err)
 	}
 
-	setMockSecurityGroup(az, ctrl, sg)
 	sg, err = az.reconcileSecurityGroup(testClusterName, &svc2, to.StringPtr(getServiceLoadBalancerIP(&svc2)), nil, true)
 	if err != nil {
 		t.Errorf("Unexpected error adding svc2: %q", err)
@@ -2696,14 +2694,13 @@ func TestIfServicesSpecifySharedRuleButDifferentSourceAddressesThenSeparateRules
 	testRuleName3 := "shared-TCP-80-192.168.34.0_24"
 
 	sg := getTestSecurityGroup(az)
-
 	setMockSecurityGroup(az, ctrl, sg)
-	sg, err := az.reconcileSecurityGroup(testClusterName, &svc1, to.StringPtr(getServiceLoadBalancerIP(&svc1)), nil, true)
+
+	_, err := az.reconcileSecurityGroup(testClusterName, &svc1, to.StringPtr(getServiceLoadBalancerIP(&svc1)), nil, true)
 	if err != nil {
 		t.Errorf("Unexpected error adding svc1: %q", err)
 	}
 
-	setMockSecurityGroup(az, ctrl, sg)
 	sg, err = az.reconcileSecurityGroup(testClusterName, &svc2, to.StringPtr(getServiceLoadBalancerIP(&svc2)), nil, true)
 	if err != nil {
 		t.Errorf("Unexpected error adding svc2: %q", err)
@@ -2771,20 +2768,18 @@ func TestIfServicesSpecifySharedRuleButSomeAreOnDifferentPortsThenRulesAreSepara
 
 	testRuleName23 := testRuleName2
 	sg := getTestSecurityGroup(az)
-
 	setMockSecurityGroup(az, ctrl, sg)
-	sg, err := az.reconcileSecurityGroup(testClusterName, &svc1, to.StringPtr(getServiceLoadBalancerIP(&svc1)), nil, true)
+
+	_, err := az.reconcileSecurityGroup(testClusterName, &svc1, to.StringPtr(getServiceLoadBalancerIP(&svc1)), nil, true)
 	if err != nil {
 		t.Errorf("Unexpected error adding svc1: %q", err)
 	}
 
-	setMockSecurityGroup(az, ctrl, sg)
-	sg, err = az.reconcileSecurityGroup(testClusterName, &svc2, to.StringPtr(getServiceLoadBalancerIP(&svc2)), nil, true)
+	_, err = az.reconcileSecurityGroup(testClusterName, &svc2, to.StringPtr(getServiceLoadBalancerIP(&svc2)), nil, true)
 	if err != nil {
 		t.Errorf("Unexpected error adding svc2: %q", err)
 	}
 
-	setMockSecurityGroup(az, ctrl, sg)
 	sg, err = az.reconcileSecurityGroup(testClusterName, &svc3, to.StringPtr(getServiceLoadBalancerIP(&svc3)), nil, true)
 	if err != nil {
 		t.Errorf("Unexpected error adding svc3: %q", err)
@@ -2871,14 +2866,13 @@ func TestIfServiceSpecifiesSharedRuleAndServiceIsDeletedThenTheServicesPortAndAd
 	expectedRuleName := testRuleName
 
 	sg := getTestSecurityGroup(az)
-
 	setMockSecurityGroup(az, ctrl, sg)
-	sg, err := az.reconcileSecurityGroup(testClusterName, &svc1, to.StringPtr(getServiceLoadBalancerIP(&svc1)), nil, true)
+
+	_, err := az.reconcileSecurityGroup(testClusterName, &svc1, to.StringPtr(getServiceLoadBalancerIP(&svc1)), nil, true)
 	if err != nil {
 		t.Errorf("Unexpected error adding svc1: %q", err)
 	}
 
-	setMockSecurityGroup(az, ctrl, sg)
 	sg, err = az.reconcileSecurityGroup(testClusterName, &svc2, to.StringPtr(getServiceLoadBalancerIP(&svc2)), nil, true)
 	if err != nil {
 		t.Errorf("Unexpected error adding svc2: %q", err)
@@ -2886,7 +2880,6 @@ func TestIfServiceSpecifiesSharedRuleAndServiceIsDeletedThenTheServicesPortAndAd
 
 	validateSecurityGroup(t, sg, svc1, svc2)
 
-	setMockSecurityGroup(az, ctrl, sg)
 	sg, err = az.reconcileSecurityGroup(testClusterName, &svc1, to.StringPtr(getServiceLoadBalancerIP(&svc1)), nil, false)
 	if err != nil {
 		t.Errorf("Unexpected error removing svc1: %q", err)
@@ -2934,20 +2927,18 @@ func TestIfSomeServicesShareARuleAndOneIsDeletedItIsRemovedFromTheRightRule(t *t
 
 	testRuleName23 := testRuleName2
 	sg := getTestSecurityGroup(az)
-
 	setMockSecurityGroup(az, ctrl, sg)
-	sg, err := az.reconcileSecurityGroup(testClusterName, &svc1, to.StringPtr(getServiceLoadBalancerIP(&svc1)), nil, true)
+
+	_, err := az.reconcileSecurityGroup(testClusterName, &svc1, to.StringPtr(getServiceLoadBalancerIP(&svc1)), nil, true)
 	if err != nil {
 		t.Errorf("Unexpected error adding svc1: %q", err)
 	}
 
-	setMockSecurityGroup(az, ctrl, sg)
-	sg, err = az.reconcileSecurityGroup(testClusterName, &svc2, to.StringPtr(getServiceLoadBalancerIP(&svc2)), nil, true)
+	_, err = az.reconcileSecurityGroup(testClusterName, &svc2, to.StringPtr(getServiceLoadBalancerIP(&svc2)), nil, true)
 	if err != nil {
 		t.Errorf("Unexpected error adding svc2: %q", err)
 	}
 
-	setMockSecurityGroup(az, ctrl, sg)
 	sg, err = az.reconcileSecurityGroup(testClusterName, &svc3, to.StringPtr(getServiceLoadBalancerIP(&svc3)), nil, true)
 	if err != nil {
 		t.Errorf("Unexpected error adding svc3: %q", err)
@@ -2955,7 +2946,6 @@ func TestIfSomeServicesShareARuleAndOneIsDeletedItIsRemovedFromTheRightRule(t *t
 
 	validateSecurityGroup(t, sg, svc1, svc2, svc3)
 
-	setMockSecurityGroup(az, ctrl, sg)
 	sg, err = az.reconcileSecurityGroup(testClusterName, &svc1, to.StringPtr(getServiceLoadBalancerIP(&svc1)), nil, false)
 	if err != nil {
 		t.Errorf("Unexpected error removing svc1: %q", err)
@@ -3045,20 +3035,18 @@ func TestIfServiceSpecifiesSharedRuleAndLastServiceIsDeletedThenRuleIsDeleted(t
 
 	testRuleName23 := testRuleName2
 	sg := getTestSecurityGroup(az)
-
 	setMockSecurityGroup(az, ctrl, sg)
-	sg, err := az.reconcileSecurityGroup(testClusterName, &svc1, to.StringPtr(getServiceLoadBalancerIP(&svc1)), nil, true)
+
+	_, err := az.reconcileSecurityGroup(testClusterName, &svc1, to.StringPtr(getServiceLoadBalancerIP(&svc1)), nil, true)
 	if err != nil {
 		t.Errorf("Unexpected error adding svc1: %q", err)
 	}
 
-	setMockSecurityGroup(az, ctrl, sg)
-	sg, err = az.reconcileSecurityGroup(testClusterName, &svc2, to.StringPtr(getServiceLoadBalancerIP(&svc2)), nil, true)
+	_, err = az.reconcileSecurityGroup(testClusterName, &svc2, to.StringPtr(getServiceLoadBalancerIP(&svc2)), nil, true)
 	if err != nil {
 		t.Errorf("Unexpected error adding svc2: %q", err)
 	}
 
-	setMockSecurityGroup(az, ctrl, sg)
 	sg, err = az.reconcileSecurityGroup(testClusterName, &svc3, to.StringPtr(getServiceLoadBalancerIP(&svc3)), nil, true)
 	if err != nil {
 		t.Errorf("Unexpected error adding svc3: %q", err)
@@ -3066,13 +3054,11 @@ func TestIfServiceSpecifiesSharedRuleAndLastServiceIsDeletedThenRuleIsDeleted(t
 
 	validateSecurityGroup(t, sg, svc1, svc2, svc3)
 
-	setMockSecurityGroup(az, ctrl, sg)
-	sg, err = az.reconcileSecurityGroup(testClusterName, &svc1, to.StringPtr(getServiceLoadBalancerIP(&svc1)), nil, false)
+	_, err = az.reconcileSecurityGroup(testClusterName, &svc1, to.StringPtr(getServiceLoadBalancerIP(&svc1)), nil, false)
 	if err != nil {
 		t.Errorf("Unexpected error removing svc1: %q", err)
 	}
 
-	setMockSecurityGroup(az, ctrl, sg)
 	sg, err = az.reconcileSecurityGroup(testClusterName, &svc3, to.StringPtr(getServiceLoadBalancerIP(&svc3)), nil, false)
 	if err != nil {
 		t.Errorf("Unexpected error removing svc3: %q", err)
@@ -3144,11 +3130,11 @@ func TestCanCombineSharedAndPrivateRulesInSameGroup(t *testing.T) {
 	expectedRuleName5 := az.getSecurityRuleName(&svc5, v1.ServicePort{Port: 8888, Protocol: v1.ProtocolTCP}, "Internet")
 
 	sg := getTestSecurityGroup(az)
+	setMockSecurityGroup(az, ctrl, sg)
 
 	for i, svc := range testServices {
 		svc := svc
-		setMockSecurityGroup(az, ctrl, sg)
-		sg, err = az.reconcileSecurityGroup(testClusterName, &testServices[i], to.StringPtr(getServiceLoadBalancerIP(&svc)), nil, true)
+		_, err := az.reconcileSecurityGroup(testClusterName, &testServices[i], to.StringPtr(getServiceLoadBalancerIP(&svc)), nil, true)
 		if err != nil {
 			t.Errorf("Unexpected error adding svc%d: %q", i+1, err)
 		}
@@ -3240,13 +3226,11 @@ func TestCanCombineSharedAndPrivateRulesInSameGroup(t *testing.T) {
 		}
 	}
 
-	setMockSecurityGroup(az, ctrl, sg)
-	sg, err = az.reconcileSecurityGroup(testClusterName, &svc1, to.StringPtr(getServiceLoadBalancerIP(&svc1)), nil, false)
+	_, err = az.reconcileSecurityGroup(testClusterName, &svc1, to.StringPtr(getServiceLoadBalancerIP(&svc1)), nil, false)
 	if err != nil {
 		t.Errorf("Unexpected error removing svc1: %q", err)
 	}
 
-	setMockSecurityGroup(az, ctrl, sg)
 	sg, err = az.reconcileSecurityGroup(testClusterName, &svc5, to.StringPtr(getServiceLoadBalancerIP(&svc5)), nil, false)
 	if err != nil {
 		t.Errorf("Unexpected error removing svc5: %q", err)
diff --git a/pkg/provider/azure_vmss_cache_test.go b/pkg/provider/azure_vmss_cache_test.go
index 3895938b7..00c7de9b1 100644
--- a/pkg/provider/azure_vmss_cache_test.go
+++ b/pkg/provider/azure_vmss_cache_test.go
@@ -20,6 +20,7 @@ import (
 	"fmt"
 	"net/http"
 	"strings"
+	"sync"
 	"testing"
 
 	"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2022-03-01/compute"
@@ -108,7 +109,6 @@ func TestVMSSVMCache(t *testing.T) {
 		vmName := to.String(vm.OsProfile.ComputerName)
 		realVM, err := ss.getVmssVM(vmName, azcache.CacheReadTypeDefault)
 		assert.NoError(t, err)
-		assert.NotNil(t, realVM)
 		assert.Equal(t, "vmss", realVM.VMSSName)
 		assert.Equal(t, to.String(vm.InstanceID), realVM.InstanceID)
 		assert.Equal(t, &vm, realVM.AsVirtualMachineScaleSetVM())
@@ -120,7 +120,16 @@ func TestVMSSVMCache(t *testing.T) {
 	err = ss.DeleteCacheForNode(vmName)
 	assert.NoError(t, err)
 
-	// the VM should be in cache after refresh.
+	// the VM should be removed from cache after DeleteCacheForNode().
+	cacheKey, cache, err := ss.getVMSSVMCache("rg", testVMSSName)
+	assert.NoError(t, err)
+	cached, err := cache.Get(cacheKey, azcache.CacheReadTypeDefault)
+	assert.NoError(t, err)
+	cachedVirtualMachines := cached.(*sync.Map)
+	_, ok := cachedVirtualMachines.Load(vmName)
+	assert.Equal(t, false, ok)
+
+	// the VM should be back after another cache refresh.
 	realVM, err := ss.getVmssVM(vmName, azcache.CacheReadTypeDefault)
 	assert.NoError(t, err)
 	assert.Equal(t, "vmss", realVM.VMSSName)
diff --git a/pkg/provider/azure_vmss_test.go b/pkg/provider/azure_vmss_test.go
index 885950632..b4ae25b80 100644
--- a/pkg/provider/azure_vmss_test.go
+++ b/pkg/provider/azure_vmss_test.go
@@ -962,13 +962,12 @@ func TestGetVmssVMByNodeIdentity(t *testing.T) {
 			assert.Nil(t, err)
 			virtualMachines := cached.(*sync.Map)
 			for _, vm := range test.goneVMList {
-				entry := VMSSVirtualMachinesEntry{
-					ResourceGroup: ss.ResourceGroup,
-					VMSSName:      testVMSSName,
+				entry := vmssVirtualMachinesEntry{
+					resourceGroup: ss.ResourceGroup,
+					vmssName:      testVMSSName,
 				}
 				virtualMachines.Store(vm, &entry)
 			}
-			cache.Set(cacheKey, cached)
 
 			for i := 0; i < len(test.vmList); i++ {
 				node := nodeIdentity{ss.ResourceGroup, testVMSSName, test.vmList[i]}
diff --git a/pkg/provider/azure_vmssflex_test.go b/pkg/provider/azure_vmssflex_test.go
index 9eb44d227..bf9594303 100644
--- a/pkg/provider/azure_vmssflex_test.go
+++ b/pkg/provider/azure_vmssflex_test.go
@@ -72,12 +72,12 @@ var (
 		},
 	}
 
-	testNic1 = generateTestNic("testvm1-nic", false, network.ProvisioningStateSucceeded, "/subscriptions/sub/resourceGroups/rg/providers/Microsoft.Compute/virtualMachines/testvm1")
+	testNic1 = generateTestNic("testvm1-nic", false, network.ProvisioningStateSucceeded)
 
-	testNic2 = generateTestNic("testvm2-nic", true, network.ProvisioningStateSucceeded, "/subscriptions/sub/resourceGroups/rg/providers/Microsoft.Compute/virtualMachines/testvm2")
+	testNic2 = generateTestNic("testvm2-nic", true, network.ProvisioningStateSucceeded)
 )
 
-func generateTestNic(nicName string, isIPConfigurationsNil bool, provisioningState network.ProvisioningState, vmID string) network.Interface {
+func generateTestNic(nicName string, isIPConfigurationsNil bool, provisioningState network.ProvisioningState) network.Interface {
 	result := network.Interface{
 		ID:   to.StringPtr("/subscriptions/sub/resourceGroups/rg/providers/Microsoft.Network/networkInterfaces/" + nicName),
 		Name: to.StringPtr(nicName),
@@ -96,9 +96,6 @@ func generateTestNic(nicName string, isIPConfigurationsNil bool, provisioningSta
 				},
 			},
 			ProvisioningState: provisioningState,
-			VirtualMachine: &network.SubResource{
-				ID: to.StringPtr(vmID),
-			},
 		},
 	}
 	if isIPConfigurationsNil {
@@ -774,7 +771,6 @@ func TestGetNodeNameByIPConfigurationIDVmssFlex(t *testing.T) {
 		testVMListWithoutInstanceView  []compute.VirtualMachine
 		testVMListWithOnlyInstanceView []compute.VirtualMachine
 		vmListErr                      error
-		nic                            network.Interface
 		expectedNodeName               string
 		expectedVMSetName              string
 		expectedErr                    error
@@ -785,7 +781,6 @@ func TestGetNodeNameByIPConfigurationIDVmssFlex(t *testing.T) {
 			testVMListWithoutInstanceView:  testVMListWithoutInstanceView,
 			testVMListWithOnlyInstanceView: testVMListWithOnlyInstanceView,
 			vmListErr:                      nil,
-			nic:                            generateTestNic("testvm1-nic", false, network.ProvisioningStateSucceeded, "/subscriptions/sub/resourceGroups/rg/providers/Microsoft.Compute/virtualMachines/testvm1"),
 			expectedNodeName:               "vmssflex1000001",
 			expectedVMSetName:              "vmssflex1",
 			expectedErr:                    nil,
@@ -796,7 +791,6 @@ func TestGetNodeNameByIPConfigurationIDVmssFlex(t *testing.T) {
 			testVMListWithoutInstanceView:  testVMListWithoutInstanceView,
 			testVMListWithOnlyInstanceView: testVMListWithOnlyInstanceView,
 			vmListErr:                      nil,
-			nic:                            generateTestNic("testvm1-nic", false, network.ProvisioningStateSucceeded, fmt.Sprintf("/subscriptions/sub/resourceGroups/rg/providers/Microsoft.Compute/virtualMachines/%s", nonExistingNodeName)),
 			expectedNodeName:               "",
 			expectedVMSetName:              "",
 			expectedErr:                    fmt.Errorf("failed to map VM Name to NodeName: VM Name NonExistingNodeName"),
@@ -824,9 +818,6 @@ func TestGetNodeNameByIPConfigurationIDVmssFlex(t *testing.T) {
 		mockVMClient.EXPECT().ListVmssFlexVMsWithoutInstanceView(gomock.Any(), gomock.Any()).Return(tc.testVMListWithoutInstanceView, tc.vmListErr).AnyTimes()
 		mockVMClient.EXPECT().ListVmssFlexVMsWithOnlyInstanceView(gomock.Any(), gomock.Any()).Return(tc.testVMListWithOnlyInstanceView, tc.vmListErr).AnyTimes()
 
-		mockInterfacesClient := fs.InterfacesClient.(*mockinterfaceclient.MockInterface)
-		mockInterfacesClient.EXPECT().Get(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(tc.nic, nil).AnyTimes()
-
 		nodeName, vmSetName, err := fs.GetNodeNameByIPConfigurationID(tc.ipConfigurationID)
 		assert.Equal(t, tc.expectedNodeName, nodeName)
 		assert.Equal(t, tc.expectedVMSetName, vmSetName)
@@ -1039,7 +1030,7 @@ func TestEnsureHostInPoolVmssFlex(t *testing.T) {
 			testVMListWithoutInstanceView:  testVMListWithoutInstanceView,
 			testVMListWithOnlyInstanceView: testVMListWithOnlyInstanceView,
 			vmListErr:                      nil,
-			nic:                            generateTestNic("testvm1-nic", false, network.ProvisioningStateSucceeded, "/subscriptions/sub/resourceGroups/rg/providers/Microsoft.Compute/virtualMachines/testvm1"),
+			nic:                            generateTestNic("testvm1-nic", false, network.ProvisioningStateSucceeded),
 			nicGetErr:                      nil,
 			expectedNodeResourceGroup:      "rg",
 			expectedVMSetName:              "vmssflex1",
@@ -1093,7 +1084,7 @@ func TestEnsureHostInPoolVmssFlex(t *testing.T) {
 			testVMListWithoutInstanceView:  testVMListWithoutInstanceView,
 			testVMListWithOnlyInstanceView: testVMListWithOnlyInstanceView,
 			vmListErr:                      nil,
-			nic:                            generateTestNic("testvm1-nic", false, network.ProvisioningStateSucceeded, "/subscriptions/sub/resourceGroups/rg/providers/Microsoft.Compute/virtualMachines/testvm1"),
+			nic:                            generateTestNic("testvm1-nic", false, network.ProvisioningStateSucceeded),
 			nicGetErr:                      nil,
 			nicPutErr:                      &retry.Error{RawError: fmt.Errorf("failed to update nic")},
 			expectedNodeResourceGroup:      "",
@@ -1112,7 +1103,7 @@ func TestEnsureHostInPoolVmssFlex(t *testing.T) {
 			testVMListWithoutInstanceView:  testVMListWithoutInstanceView,
 			testVMListWithOnlyInstanceView: testVMListWithOnlyInstanceView,
 			vmListErr:                      nil,
-			nic:                            generateTestNic("testvm1-nic", false, network.ProvisioningStateFailed, "/subscriptions/sub/resourceGroups/rg/providers/Microsoft.Compute/virtualMachines/testvm1"),
+			nic:                            generateTestNic("testvm1-nic", false, network.ProvisioningStateFailed),
 			nicGetErr:                      nil,
 			nicPutErr:                      nil,
 			expectedNodeResourceGroup:      "",
@@ -1709,7 +1700,7 @@ func TestEnsureBackendPoolDeletedFromNodeVmssFlex(t *testing.T) {
 				"vmssflex1000001": "testvm1-nic",
 			},
 			backendPoolID: "/subscriptions/sub/resourceGroups/rg/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/backendpool-0",
-			nic:           generateTestNic("testvm1-nic", false, network.ProvisioningStateSucceeded, "/subscriptions/sub/resourceGroups/rg/providers/Microsoft.Compute/virtualMachines/testvm1"),
+			nic:           generateTestNic("testvm1-nic", false, network.ProvisioningStateSucceeded),
 			nicGetErr:     nil,
 			expectedErr:   nil,
 		},
@@ -1719,7 +1710,7 @@ func TestEnsureBackendPoolDeletedFromNodeVmssFlex(t *testing.T) {
 				"vmssflex1000001": "testvm1-nic",
 			},
 			backendPoolID: "/subscriptions/sub/resourceGroups/rg/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/backendpool-0",
-			nic:           generateTestNic("testvm1-nic", false, network.ProvisioningStateSucceeded, "/subscriptions/sub/resourceGroups/rg/providers/Microsoft.Compute/virtualMachines/testvm1"),
+			nic:           generateTestNic("testvm1-nic", false, network.ProvisioningStateSucceeded),
 			nicGetErr:     &retry.Error{RawError: fmt.Errorf("failed to get nic")},
 			expectedErr:   fmt.Errorf("ensureBackendPoolDeletedFromNode: failed to get interface of name testvm1-nic: Retriable: false, RetryAfter: 0s, HTTPStatusCode: 0, RawError: failed to get nic"),
 		},
@@ -1729,7 +1720,7 @@ func TestEnsureBackendPoolDeletedFromNodeVmssFlex(t *testing.T) {
 				"vmssflex1000001": "testvm1-nic",
 			},
 			backendPoolID: "/subscriptions/sub/resourceGroups/rg/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/backendpool-0",
-			nic:           generateTestNic("testvm1-nic", false, network.ProvisioningStateFailed, "/subscriptions/sub/resourceGroups/rg/providers/Microsoft.Compute/virtualMachines/testvm1"),
+			nic:           generateTestNic("testvm1-nic", false, network.ProvisioningStateFailed),
 			nicGetErr:     nil,
 			expectedErr:   nil,
 		},
@@ -1739,7 +1730,7 @@ func TestEnsureBackendPoolDeletedFromNodeVmssFlex(t *testing.T) {
 				"vmssflex1000001": "testvm1-nic",
 			},
 			backendPoolID: "/subscriptions/sub/resourceGroups/rg/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/backendpool-0",
-			nic:           generateTestNic("testvm1-nic", false, network.ProvisioningStateSucceeded, "/subscriptions/sub/resourceGroups/rg/providers/Microsoft.Compute/virtualMachines/testvm1"),
+			nic:           generateTestNic("testvm1-nic", false, network.ProvisioningStateSucceeded),
 			nicGetErr:     nil,
 			nicPutErr:     &retry.Error{RawError: fmt.Errorf("failed to update nic")},
 			expectedErr:   fmt.Errorf("Retriable: false, RetryAfter: 0s, HTTPStatusCode: 0, RawError: failed to update nic"),
@@ -1802,7 +1793,7 @@ func TestEnsureBackendPoolDeletedVmssFlex(t *testing.T) {
 			testVMListWithoutInstanceView:  testVMListWithoutInstanceView,
 			testVMListWithOnlyInstanceView: testVMListWithOnlyInstanceView,
 			vmListErr:                      nil,
-			nic:                            generateTestNic("testvm1-nic", false, network.ProvisioningStateSucceeded, "/subscriptions/sub/resourceGroups/rg/providers/Microsoft.Compute/virtualMachines/testvm1"),
+			nic:                            generateTestNic("testvm1-nic", false, network.ProvisioningStateSucceeded),
 			nicGetErr:                      nil,
 			expectedErr:                    nil,
 		},
@@ -1818,7 +1809,7 @@ func TestEnsureBackendPoolDeletedVmssFlex(t *testing.T) {
 			testVMListWithoutInstanceView:  testVMListWithoutInstanceView,
 			testVMListWithOnlyInstanceView: testVMListWithOnlyInstanceView,
 			vmListErr:                      nil,
-			nic:                            generateTestNic("testvm1-nic", false, network.ProvisioningStateSucceeded, "/subscriptions/sub/resourceGroups/rg/providers/Microsoft.Compute/virtualMachines/testvm1"),
+			nic:                            generateTestNic("testvm1-nic", false, network.ProvisioningStateSucceeded),
 			nicGetErr:                      nil,
 			expectedErr:                    nil,
 		},
@@ -1834,7 +1825,7 @@ func TestEnsureBackendPoolDeletedVmssFlex(t *testing.T) {
 			testVMListWithoutInstanceView:  testVMListWithoutInstanceView,
 			testVMListWithOnlyInstanceView: testVMListWithOnlyInstanceView,
 			vmListErr:                      nil,
-			nic:                            generateTestNic("testvm1-nic", false, network.ProvisioningStateSucceeded, "/subscriptions/sub/resourceGroups/rg/providers/Microsoft.Compute/virtualMachines/testvm1"),
+			nic:                            generateTestNic("testvm1-nic", false, network.ProvisioningStateSucceeded),
 			nicGetErr:                      nil,
 			expectedErr:                    nil,
 		},
@@ -1850,7 +1841,7 @@ func TestEnsureBackendPoolDeletedVmssFlex(t *testing.T) {
 			testVMListWithoutInstanceView:  testVMListWithoutInstanceView,
 			testVMListWithOnlyInstanceView: testVMListWithOnlyInstanceView,
 			vmListErr:                      nil,
-			nic:                            generateTestNic("testvm1-nic", false, network.ProvisioningStateSucceeded, "/subscriptions/sub/resourceGroups/rg/providers/Microsoft.Compute/virtualMachines/testvm1"),
+			nic:                            generateTestNic("testvm1-nic", false, network.ProvisioningStateSucceeded),
 			nicGetErr:                      nil,
 			expectedErr:                    nil,
 		},
@@ -1866,7 +1857,7 @@ func TestEnsureBackendPoolDeletedVmssFlex(t *testing.T) {
 			testVMListWithoutInstanceView:  testVMListWithoutInstanceView,
 			testVMListWithOnlyInstanceView: testVMListWithOnlyInstanceView,
 			vmListErr:                      nil,
-			nic:                            generateTestNic("testvm1-nic", false, network.ProvisioningStateSucceeded, "/subscriptions/sub/resourceGroups/rg/providers/Microsoft.Compute/virtualMachines/testvm1"),
+			nic:                            generateTestNic("testvm1-nic", false, network.ProvisioningStateSucceeded),
 			nicGetErr:                      nil,
 			nicPutErr:                      &retry.Error{RawError: fmt.Errorf("failed to update nic")},
 			expectedErr:                    fmt.Errorf("Retriable: false, RetryAfter: 0s, HTTPStatusCode: 0, RawError: failed to update nic"),
diff --git a/pkg/util/deepcopy/deepcopy_test.go b/pkg/util/deepcopy/deepcopy_test.go
deleted file mode 100644
index d6515f047..000000000
--- a/pkg/util/deepcopy/deepcopy_test.go
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
-Copyright 2022 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package deepcopy
-
-import (
-	"sync"
-	"testing"
-
-	"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2022-03-01/compute"
-	"github.com/Azure/go-autorest/autorest/to"
-	"github.com/stretchr/testify/assert"
-)
-
-type fakeStruct struct {
-	Name string
-}
-
-type fakeIntf interface {
-	Get() string
-}
-
-func (f fakeStruct) Get() string {
-	return f.Name
-}
-
-// TestCopyBasic tests object with pointer, struct, map, slice, interface.
-func TestCopyBasic(t *testing.T) {
-	zones := []string{"zone0", "zone1"}
-	var vmOriginal *compute.VirtualMachine = &compute.VirtualMachine{
-		VirtualMachineProperties: &compute.VirtualMachineProperties{
-			ProvisioningState: to.StringPtr("Failed"),
-		},
-		Name:  to.StringPtr("vmOriginal"),
-		Zones: &zones,
-		Tags: map[string]*string{
-			"tag0": to.StringPtr("tagVal0"),
-		},
-	}
-	vmCopied := Copy(vmOriginal).(*compute.VirtualMachine)
-
-	psOriginal := vmOriginal.VirtualMachineProperties.ProvisioningState
-	psCopied := vmCopied.VirtualMachineProperties.ProvisioningState
-	assert.Equal(t, psOriginal, psCopied)
-	assert.Equal(t, vmOriginal.Name, vmCopied.Name)
-	assert.Equal(t, vmOriginal.Zones, vmCopied.Zones)
-	assert.Equal(t, vmOriginal.Tags, vmCopied.Tags)
-
-	var fakeOriginal fakeIntf = fakeStruct{Name: "fakeOriginal"}
-	fakeCopied := Copy(fakeOriginal).(fakeIntf)
-	assert.Equal(t, fakeOriginal.Get(), fakeCopied.Get())
-}
-
-// TestCopyVMInSyncMap tests object like compute.VirtualMachine in a sync.Map.
-func TestCopyVMInSyncMap(t *testing.T) {
-	var vmOriginal *compute.VirtualMachine = &compute.VirtualMachine{
-		VirtualMachineProperties: &compute.VirtualMachineProperties{
-			ProvisioningState: to.StringPtr("Failed"),
-		},
-		Name: to.StringPtr("vmOriginal"),
-	}
-	vmCacheOriginal := &sync.Map{}
-	vmCacheOriginal.Store("vmOriginal", vmOriginal)
-	vmCacheCopied := Copy(vmCacheOriginal).(*sync.Map)
-
-	psOriginal := vmOriginal.VirtualMachineProperties.ProvisioningState
-	vCopied, ok := vmCacheCopied.Load("vmOriginal")
-	assert.True(t, ok)
-	vmCopied := vCopied.(*compute.VirtualMachine)
-	psCopied := vmCopied.VirtualMachineProperties.ProvisioningState
-	assert.Equal(t, psOriginal, psCopied)
-	assert.Equal(t, vmOriginal.Name, vmCopied.Name)
-}
-
-type vmssEntry struct {
-	*compute.VirtualMachineScaleSet
-	Name *string
-}
-
-// TestCopyVMSSEntryInSyncMap tests object like vmssEntry in sync.Map.
-func TestCopyVMSSEntryInSyncMap(t *testing.T) {
-	vmssEntryOriginal := &vmssEntry{
-		Name: to.StringPtr("vmssEntryName"),
-		VirtualMachineScaleSet: &compute.VirtualMachineScaleSet{
-			Name: to.StringPtr("vmssOriginal"),
-		},
-	}
-	vmssCacheOriginal := &sync.Map{}
-	vmssCacheOriginal.Store("vmssEntry", vmssEntryOriginal)
-	vmssCacheCopied := Copy(vmssCacheOriginal)
-
-	vCopied, ok := vmssCacheCopied.(*sync.Map).Load("vmssEntry")
-	assert.True(t, ok)
-	vmssEntryCopied := vCopied.(*vmssEntry)
-	entryNameOriginal := vmssEntryOriginal.Name
-	entryNameCopied := vmssEntryCopied.Name
-	assert.Equal(t, entryNameOriginal, entryNameCopied)
-	vmNameOriginal := vmssEntryOriginal.VirtualMachineScaleSet.Name
-	vmNameCopied := vmssEntryCopied.VirtualMachineScaleSet.Name
-	assert.Equal(t, vmNameOriginal, vmNameCopied)
-}
diff --git a/tests/e2e/network/service_annotations.go b/tests/e2e/network/service_annotations.go
index 788c146c4..80f335a7e 100644
--- a/tests/e2e/network/service_annotations.go
+++ b/tests/e2e/network/service_annotations.go
@@ -177,6 +177,37 @@ var _ = Describe("Service with annotation", Label(utils.TestSuiteLabelServiceAnn
 			time.Sleep(20 * time.Second)
 		}
 		Expect(code).To(Equal(nginxStatusCode), "Fail to get response from the domain name")
+		By("Update service")
+		annotation = map[string]string{
+			consts.ServiceAnnotationDNSLabelName: serviceDomainNamePrefix + "new",
+		}
+		service := utils.CreateLoadBalancerServiceManifest(serviceName, annotation, labels, ns.Name, ports)
+		_, err := cs.CoreV1().Services(ns.Name).Update(context.TODO(), service, metav1.UpdateOptions{})
+		Expect(err).NotTo(HaveOccurred())
+		serviceDomainName = utils.GetServiceDomainName(serviceDomainNamePrefix)
+		url = fmt.Sprintf("http://%s:%v", serviceDomainName, ports[0].Port)
+		for i := 1; i <= 30; i++ {
+			/* #nosec G107: Potential HTTP request made with variable url */
+			resp, err := http.Get(url)
+			if err == nil {
+				defer func() {
+					if resp != nil {
+						resp.Body.Close()
+					}
+				}()
+				code = resp.StatusCode
+				if code == nginxStatusCode {
+					break
+				} else {
+					utils.Logf("Received %d status code from %s", code, url)
+				}
+			} else {
+				utils.Logf("Received the following error when validating %s: %v", url, err)
+			}
+			utils.Logf("Retrying in 20 seconds")
+			time.Sleep(20 * time.Second)
+		}
+		Expect(code).To(Equal(nginxStatusCode), "Fail to get response from the domain name")
 	})
 
 	It("should support service annotation 'service.beta.kubernetes.io/azure-load-balancer-internal'", func() {
diff --git a/tests/e2e/utils/pod_utils.go b/tests/e2e/utils/pod_utils.go
index f46bc3d4e..e2b01ff33 100644
--- a/tests/e2e/utils/pod_utils.go
+++ b/tests/e2e/utils/pod_utils.go
@@ -251,7 +251,7 @@ func CreatePodGetIPManifest() *v1.Pod {
 					Image:           "k8s.gcr.io/e2e-test-images/agnhost:2.36",
 					ImagePullPolicy: v1.PullIfNotPresent,
 					Command: []string{
-						"/bin/sh", "-c", "curl -s -m 5 --retry-delay 5 --retry 10 ifconfig.me",
+						"/bin/sh", "-c", "curl -v -s -m 5 --retry-delay 5 --retry 10 ifconfig.me",
 					},
 				},
 			},