From 024dca75f620e77515a4feb32b42a836a6d8252d Mon Sep 17 00:00:00 2001 From: neaggarw Date: Mon, 22 Feb 2021 13:32:51 -0800 Subject: [PATCH 1/4] Remove Log noise from ipam pool monitor --- cns/ipampoolmonitor/ipampoolmonitor.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cns/ipampoolmonitor/ipampoolmonitor.go b/cns/ipampoolmonitor/ipampoolmonitor.go index df54783a76..5f255857e5 100644 --- a/cns/ipampoolmonitor/ipampoolmonitor.go +++ b/cns/ipampoolmonitor/ipampoolmonitor.go @@ -70,29 +70,29 @@ func (pm *CNSIPAMPoolMonitor) Reconcile() error { availableIPConfigCount := len(pm.cns.GetAvailableIPConfigs()) // TODO: add pending allocation count to real cns freeIPConfigCount := pm.cachedNNC.Spec.RequestedIPCount - int64(allocatedPodIPCount) - logger.Printf("[ipam-pool-monitor] Checking pool for resize, Pool Size: %v, Goal Size: %v, BatchSize: %v, MinFree: %v, MaxFree:%v, Allocated: %v, Available: %v, Pending Release: %v, Free: %v, Pending Program: %v", - cnsPodIPConfigCount, pm.cachedNNC.Spec.RequestedIPCount, pm.scalarUnits.BatchSize, pm.MinimumFreeIps, pm.MaximumFreeIps, allocatedPodIPCount, availableIPConfigCount, pendingReleaseIPCount, freeIPConfigCount, pendingProgramCount) + msg := fmt.Printf("Pool Size: %v, Goal Size: %v, BatchSize: %v, MinFree: %v, MaxFree:%v, Allocated: %v, Available: %v, Pending Release: %v, Free: %v, Pending Program: %v", + cnsPodIPConfigCount, pm.cachedNNC.Spec.RequestedIPCount, pm.scalarUnits.BatchSize, pm.MinimumFreeIps, pm.MaximumFreeIps, allocatedPodIPCount, availableIPConfigCount, pendingReleaseIPCount, freeIPConfigCount, pendingProgramCount)) switch { // pod count is increasing case freeIPConfigCount < pm.MinimumFreeIps: - logger.Printf("[ipam-pool-monitor] Increasing pool size...") - return pm.increasePoolSize() + logger.Printf("[ipam-pool-monitor] Increasing pool size...%s ", msg) + return pm.increasePoolSize() // pod count is decreasing case freeIPConfigCount > pm.MaximumFreeIps: - logger.Printf("[ipam-pool-monitor] Decreasing pool size...") + logger.Printf("[ipam-pool-monitor] Decreasing pool size...%s ", msg) return pm.decreasePoolSize() // CRD has reconciled CNS state, and target spec is now the same size as the state // free to remove the IP's from the CRD case pm.pendingRelease && int(pm.cachedNNC.Spec.RequestedIPCount) == cnsPodIPConfigCount: - logger.Printf("[ipam-pool-monitor] Removing Pending Release IP's from CRD...") + logger.Printf("[ipam-pool-monitor] Removing Pending Release IP's from CRD...%s ", msg) return pm.cleanPendingRelease() // no pods scheduled case allocatedPodIPCount == 0: - logger.Printf("[ipam-pool-monitor] No pods scheduled") + logger.Printf("[ipam-pool-monitor] No pods scheduled, %s", msg) return nil } From 1827d2081efcc750e6783e1ba431acf2853db69f Mon Sep 17 00:00:00 2001 From: neaggarw Date: Mon, 22 Feb 2021 13:51:53 -0800 Subject: [PATCH 2/4] incorporate feedback --- cns/ipampoolmonitor/ipampoolmonitor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cns/ipampoolmonitor/ipampoolmonitor.go b/cns/ipampoolmonitor/ipampoolmonitor.go index 5f255857e5..2677bb45d0 100644 --- a/cns/ipampoolmonitor/ipampoolmonitor.go +++ b/cns/ipampoolmonitor/ipampoolmonitor.go @@ -77,7 +77,7 @@ func (pm *CNSIPAMPoolMonitor) Reconcile() error { // pod count is increasing case freeIPConfigCount < pm.MinimumFreeIps: logger.Printf("[ipam-pool-monitor] Increasing pool size...%s ", msg) - return pm.increasePoolSize() + return pm.increasePoolSize() // pod count is decreasing case freeIPConfigCount > pm.MaximumFreeIps: From 17ee70a5be539e533c2c1cc0cadcb2a8f93d16de Mon Sep 17 00:00:00 2001 From: neaggarw Date: Mon, 22 Feb 2021 14:19:59 -0800 Subject: [PATCH 3/4] Fix logging string --- cns/ipampoolmonitor/ipampoolmonitor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cns/ipampoolmonitor/ipampoolmonitor.go b/cns/ipampoolmonitor/ipampoolmonitor.go index 2677bb45d0..fe618c162e 100644 --- a/cns/ipampoolmonitor/ipampoolmonitor.go +++ b/cns/ipampoolmonitor/ipampoolmonitor.go @@ -70,7 +70,7 @@ func (pm *CNSIPAMPoolMonitor) Reconcile() error { availableIPConfigCount := len(pm.cns.GetAvailableIPConfigs()) // TODO: add pending allocation count to real cns freeIPConfigCount := pm.cachedNNC.Spec.RequestedIPCount - int64(allocatedPodIPCount) - msg := fmt.Printf("Pool Size: %v, Goal Size: %v, BatchSize: %v, MinFree: %v, MaxFree:%v, Allocated: %v, Available: %v, Pending Release: %v, Free: %v, Pending Program: %v", + msg := fmt.Sprintf("Pool Size: %v, Goal Size: %v, BatchSize: %v, MinFree: %v, MaxFree:%v, Allocated: %v, Available: %v, Pending Release: %v, Free: %v, Pending Program: %v", cnsPodIPConfigCount, pm.cachedNNC.Spec.RequestedIPCount, pm.scalarUnits.BatchSize, pm.MinimumFreeIps, pm.MaximumFreeIps, allocatedPodIPCount, availableIPConfigCount, pendingReleaseIPCount, freeIPConfigCount, pendingProgramCount)) switch { From 0e99c021847a0f03692941d40a485b9c04686a31 Mon Sep 17 00:00:00 2001 From: neaggarw Date: Mon, 22 Feb 2021 14:47:42 -0800 Subject: [PATCH 4/4] build fix --- cns/ipampoolmonitor/ipampoolmonitor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cns/ipampoolmonitor/ipampoolmonitor.go b/cns/ipampoolmonitor/ipampoolmonitor.go index fe618c162e..7a57fa68be 100644 --- a/cns/ipampoolmonitor/ipampoolmonitor.go +++ b/cns/ipampoolmonitor/ipampoolmonitor.go @@ -71,7 +71,7 @@ func (pm *CNSIPAMPoolMonitor) Reconcile() error { freeIPConfigCount := pm.cachedNNC.Spec.RequestedIPCount - int64(allocatedPodIPCount) msg := fmt.Sprintf("Pool Size: %v, Goal Size: %v, BatchSize: %v, MinFree: %v, MaxFree:%v, Allocated: %v, Available: %v, Pending Release: %v, Free: %v, Pending Program: %v", - cnsPodIPConfigCount, pm.cachedNNC.Spec.RequestedIPCount, pm.scalarUnits.BatchSize, pm.MinimumFreeIps, pm.MaximumFreeIps, allocatedPodIPCount, availableIPConfigCount, pendingReleaseIPCount, freeIPConfigCount, pendingProgramCount)) + cnsPodIPConfigCount, pm.cachedNNC.Spec.RequestedIPCount, pm.scalarUnits.BatchSize, pm.MinimumFreeIps, pm.MaximumFreeIps, allocatedPodIPCount, availableIPConfigCount, pendingReleaseIPCount, freeIPConfigCount, pendingProgramCount) switch { // pod count is increasing