diff --git a/npm/pkg/controlplane/controllers/v2/namespaceController.go b/npm/pkg/controlplane/controllers/v2/namespaceController.go index 7c2051386e..054e651c0b 100644 --- a/npm/pkg/controlplane/controllers/v2/namespaceController.go +++ b/npm/pkg/controlplane/controllers/v2/namespaceController.go @@ -124,8 +124,6 @@ func (nsc *NamespaceController) needSync(obj interface{}, event string) (string, return key, needSync } - klog.Infof("[NAMESPACE %s EVENT] for namespace [%s]", event, key) - needSync = true return key, needSync } @@ -133,7 +131,6 @@ func (nsc *NamespaceController) needSync(obj interface{}, event string) (string, func (nsc *NamespaceController) addNamespace(obj interface{}) { key, needSync := nsc.needSync(obj, "ADD") if !needSync { - klog.Infof("[NAMESPACE ADD EVENT] No need to sync this namespace [%s]", key) return } nsc.workqueue.Add(key) @@ -142,7 +139,6 @@ func (nsc *NamespaceController) addNamespace(obj interface{}) { func (nsc *NamespaceController) updateNamespace(old, newns interface{}) { key, needSync := nsc.needSync(newns, "UPDATE") if !needSync { - klog.Infof("[NAMESPACE UPDATE EVENT] No need to sync this namespace [%s]", key) return } @@ -150,7 +146,6 @@ func (nsc *NamespaceController) updateNamespace(old, newns interface{}) { oldNsObj, ok := old.(*corev1.Namespace) if ok { if oldNsObj.ResourceVersion == nsObj.ResourceVersion { - klog.Infof("[NAMESPACE UPDATE EVENT] Resourceversion is same for this namespace [%s]", key) return } } diff --git a/npm/pkg/controlplane/controllers/v2/podController.go b/npm/pkg/controlplane/controllers/v2/podController.go index 4773728ba9..05f7099ae5 100644 --- a/npm/pkg/controlplane/controllers/v2/podController.go +++ b/npm/pkg/controlplane/controllers/v2/podController.go @@ -151,15 +151,11 @@ func (c *PodController) needSync(eventType string, obj interface{}) (string, boo return key, needSync } - klog.Infof("[POD %s EVENT] for %s in %s", eventType, podObj.Name, podObj.Namespace) - if !hasValidPodIP(podObj) { return key, needSync } if isHostNetworkPod(podObj) { - klog.Infof("[POD %s EVENT] HostNetwork POD IGNORED: [%s/%s/%s/%+v%s]", - eventType, podObj.GetObjectMeta().GetUID(), podObj.Namespace, podObj.Name, podObj.Labels, podObj.Status.PodIP) return key, needSync } @@ -194,7 +190,6 @@ func (c *PodController) addPod(obj interface{}) { func (c *PodController) updatePod(old, newp interface{}) { key, needSync := c.needSync("UPDATE", newp) if !needSync { - klog.Infof("[POD UPDATE EVENT] No need to sync this pod") return } @@ -205,7 +200,6 @@ func (c *PodController) updatePod(old, newp interface{}) { if oldPod.ResourceVersion == newPod.ResourceVersion { // Periodic resync will send update events for all known pods. // Two different versions of the same pods will always have different RVs. - klog.Infof("[POD UPDATE EVENT] Two pods have the same RVs") return } } @@ -234,7 +228,6 @@ func (c *PodController) deletePod(obj interface{}) { klog.Infof("[POD DELETE EVENT] for %s in %s", podObj.Name, podObj.Namespace) if isHostNetworkPod(podObj) { - klog.Infof("[POD DELETE EVENT] HostNetwork POD IGNORED: [%s/%s/%s/%+v%s]", podObj.UID, podObj.Namespace, podObj.Name, podObj.Labels, podObj.Status.PodIP) return } diff --git a/npm/pkg/dataplane/policies/chain-management_linux.go b/npm/pkg/dataplane/policies/chain-management_linux.go index 68b30f4724..2e11da2a5d 100644 --- a/npm/pkg/dataplane/policies/chain-management_linux.go +++ b/npm/pkg/dataplane/policies/chain-management_linux.go @@ -200,7 +200,6 @@ func (pMgr *PolicyManager) bootup(_ []string) error { // - creates the jump rule from FORWARD chain to AZURE-NPM chain (if it does not exist) and makes sure it's after the jumps to KUBE-FORWARD & KUBE-SERVICES chains (if they exist). // - cleans up stale policy chains. It can be forced to stop this process if reconcileManager.forceLock() is called. func (pMgr *PolicyManager) reconcile() { - klog.Infof("repositioning azure chain jump rule") if err := pMgr.positionAzureChainJumpRule(); err != nil { klog.Errorf("failed to reconcile jump rule to Azure-NPM due to %s", err.Error()) } @@ -208,6 +207,11 @@ func (pMgr *PolicyManager) reconcile() { pMgr.reconcileManager.Lock() defer pMgr.reconcileManager.Unlock() staleChains := pMgr.staleChains.emptyAndGetAll() + + if len(staleChains) == 0 { + return + } + klog.Infof("cleaning up these stale chains: %+v", staleChains) if err := pMgr.cleanupChains(staleChains); err != nil { klog.Errorf("failed to clean up old policy chains with the following error: %s", err.Error())