From ea11226fff39a2ce286780678b35f72e62b1a4c8 Mon Sep 17 00:00:00 2001 From: Nont Date: Thu, 18 Jan 2024 14:28:15 -0600 Subject: [PATCH] Address the code review comments --- pkg/monitor/azure/nsg/nsg.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/monitor/azure/nsg/nsg.go b/pkg/monitor/azure/nsg/nsg.go index 9b4be2a75dd..88a05dec66d 100644 --- a/pkg/monitor/azure/nsg/nsg.go +++ b/pkg/monitor/azure/nsg/nsg.go @@ -123,19 +123,19 @@ func (n *NSGMonitor) Monitor(ctx context.Context) []error { workerProfiles, _ := api.GetEnrichedWorkerProfiles(n.oc.Properties) workerSubnets := make([]subnetNSGConfig, 0, len(workerProfiles)) workerPrefixes := make([]netip.Prefix, 0, len(workerProfiles)) - subnetToMonitor := map[string]struct{}{} + // To minimize the possibility of NRP throttling, we only retrieve a subnet's info only once. + subnetsToMonitor := map[string]struct{}{} for _, wp := range workerProfiles { // Customer can configure a machineset with an invalid subnet. // In such case, the subnetID will be empty. - // We do not need to monitor any profiles with 0 machines either. - // To minimize the possibility of throttling, we only get it once. + // Also 0 machine means no worker nodes are there, so no point to monitor the profile. if len(wp.SubnetID) != 0 && wp.Count != 0 { - subnetToMonitor[wp.SubnetID] = struct{}{} + subnetsToMonitor[wp.SubnetID] = struct{}{} } } - for subnetID := range subnetToMonitor { + for subnetID := range subnetsToMonitor { s, err := n.toSubnetConfig(ctx, subnetID) if err != nil { // FP has no access to the subnet