From 6bf2bb62c6a105a5428639962facf8ba56703f37 Mon Sep 17 00:00:00 2001 From: Hunter Gregory Date: Wed, 5 Jan 2022 15:48:31 -0800 Subject: [PATCH 1/3] remove debug klog calls --- npm/pkg/controlplane/translation/translatePolicy.go | 2 -- npm/pkg/dataplane/ioutil/restore_linux.go | 4 +--- npm/pkg/dataplane/ipsets/ipsetmanager.go | 2 +- npm/pkg/dataplane/ipsets/ipsetmanager_linux.go | 2 -- npm/pkg/dataplane/policies/policymanager.go | 4 ---- 5 files changed, 2 insertions(+), 12 deletions(-) diff --git a/npm/pkg/controlplane/translation/translatePolicy.go b/npm/pkg/controlplane/translation/translatePolicy.go index fbb2516d95..0982acacb2 100644 --- a/npm/pkg/controlplane/translation/translatePolicy.go +++ b/npm/pkg/controlplane/translation/translatePolicy.go @@ -566,7 +566,5 @@ func TranslatePolicy(npObj *networkingv1.NetworkPolicy) (*policies.NPMNetworkPol } } } - klog.Infof("JUST-TRANSLATED-THIS-POLICY:\n%s", npmNetPol.String()) - klog.Infof("THIS-NPOBJ:\n%+v", npObj) return npmNetPol, nil } diff --git a/npm/pkg/dataplane/ioutil/restore_linux.go b/npm/pkg/dataplane/ioutil/restore_linux.go index c92b396aeb..1e5f894892 100644 --- a/npm/pkg/dataplane/ioutil/restore_linux.go +++ b/npm/pkg/dataplane/ioutil/restore_linux.go @@ -126,7 +126,6 @@ func (creator *FileCreator) ToString() string { func (creator *FileCreator) RunCommandWithFile(cmd string, args ...string) error { fileString := creator.ToString() - klog.Infof("beginning to run command for restorer:\nBEGIN-CREATOR-FILE-FOR-COMMAND-%s\n%s\nEND-CREATOR-FILE-FOR-COMMAND-%s", cmd, fileString, cmd) // TODO remove wasFileAltered, err := creator.runCommandOnceWithFile(fileString, cmd, args...) if err == nil { return nil @@ -134,8 +133,7 @@ func (creator *FileCreator) RunCommandWithFile(cmd string, args ...string) error commandString := cmd + " " + strings.Join(args, " ") for !creator.hasNoMoreRetries() { if wasFileAltered { - fileString = creator.ToString() - klog.Infof("rerunning command [%s] with new file:\n%s", commandString, fileString) + klog.Infof("rerunning command [%s] with new file", commandString) } else { klog.Infof("rerunning command [%s] with the same file", commandString) } diff --git a/npm/pkg/dataplane/ipsets/ipsetmanager.go b/npm/pkg/dataplane/ipsets/ipsetmanager.go index f2d5b10bf9..d815838cfe 100644 --- a/npm/pkg/dataplane/ipsets/ipsetmanager.go +++ b/npm/pkg/dataplane/ipsets/ipsetmanager.go @@ -273,7 +273,7 @@ func (iMgr *IPSetManager) ApplyIPSets() error { return nil } - klog.Infof("[IPSetManager] toAddUpdateCahe %+v \n ", iMgr.toAddOrUpdateCache) + klog.Infof("[IPSetManager] toAddUpdateCache %+v \n ", iMgr.toAddOrUpdateCache) klog.Infof("[IPSetManager] toDeleteCache %+v \n ", iMgr.toDeleteCache) iMgr.sanitizeDirtyCache() diff --git a/npm/pkg/dataplane/ipsets/ipsetmanager_linux.go b/npm/pkg/dataplane/ipsets/ipsetmanager_linux.go index 88ad1821cb..3c13c69ef6 100644 --- a/npm/pkg/dataplane/ipsets/ipsetmanager_linux.go +++ b/npm/pkg/dataplane/ipsets/ipsetmanager_linux.go @@ -343,8 +343,6 @@ func (iMgr *IPSetManager) updateDirtyKernelSets(saveFile []byte, creator *ioutil toAddOrUpdateHashedNames[hashedName] = prefixedName } - klog.Infof("beginning to parse ipset save file:\nBEGIN-IPSET-SAVE-FILE-FOR-APPLY-IPSETS\n%s\nEND-IPSET-SAVE-FILE-FOR-APPLY-IPSETS", string(saveFile)) // TODO remove eventually - // in each iteration, read a create line and any ensuing add lines readIndex := 0 var line []byte diff --git a/npm/pkg/dataplane/policies/policymanager.go b/npm/pkg/dataplane/policies/policymanager.go index 05c6e4c487..26fe824199 100644 --- a/npm/pkg/dataplane/policies/policymanager.go +++ b/npm/pkg/dataplane/policies/policymanager.go @@ -97,7 +97,6 @@ func (pMgr *PolicyManager) AddPolicy(policy *NPMNetworkPolicy, endpointList map[ if err := validatePolicy(policy); err != nil { return npmerrors.Errorf(npmerrors.AddPolicy, false, fmt.Sprintf("couldn't add malformed policy: %s", err.Error())) } - klog.Infof("PRINTING-CONTENTS-FOR-ADDING-POLICY:\n%s", policy.String()) // Call actual dataplane function to apply changes err := pMgr.addPolicy(policy, endpointList) @@ -115,11 +114,8 @@ func (pMgr *PolicyManager) isFirstPolicy() bool { func (pMgr *PolicyManager) RemovePolicy(policyKey string, endpointList map[string]string) error { policy, ok := pMgr.GetPolicy(policyKey) - klog.Infof("PRINTING-CONTENTS-FOR-REMOVING-POLICY:\n%s", policy.String()) if !ok { - klog.Infof("DEBUGME-POLICY-DOESN'T-EXIST-WHEN-DELETING") - klog.Infof("POLICY-CACHE: %+v", pMgr.policyMap.cache) return nil } From 9ec88ac367fafb8b5d2dc7d71a41faecaca05e4e Mon Sep 17 00:00:00 2001 From: Hunter Gregory Date: Thu, 6 Jan 2022 17:10:47 -0800 Subject: [PATCH 2/3] remove ctstate new for v1 default --- npm/iptm/iptm.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/npm/iptm/iptm.go b/npm/iptm/iptm.go index 3b8a81f87f..e51752de9d 100644 --- a/npm/iptm/iptm.go +++ b/npm/iptm/iptm.go @@ -227,6 +227,15 @@ func (iptMgr *IptablesManager) checkAndAddForwardChain() error { util.IptablesNewState, }, } + if iptMgr.placeAzureChainFirst { + entry = &IptEntry{ + Chain: util.IptablesForwardChain, + Specs: []string{ + util.IptablesJumpFlag, + util.IptablesAzureChain, + }, + } + } var index int var kubeServicesLine int From 990fe81f6cb65740b0b1e2c9caa3e60dba351826 Mon Sep 17 00:00:00 2001 From: Hunter Gregory Date: Thu, 6 Jan 2022 17:12:34 -0800 Subject: [PATCH 3/3] Revert "remove ctstate new for v1 default" This reverts commit 9ec88ac367fafb8b5d2dc7d71a41faecaca05e4e. --- npm/iptm/iptm.go | 9 --------- 1 file changed, 9 deletions(-) diff --git a/npm/iptm/iptm.go b/npm/iptm/iptm.go index e51752de9d..3b8a81f87f 100644 --- a/npm/iptm/iptm.go +++ b/npm/iptm/iptm.go @@ -227,15 +227,6 @@ func (iptMgr *IptablesManager) checkAndAddForwardChain() error { util.IptablesNewState, }, } - if iptMgr.placeAzureChainFirst { - entry = &IptEntry{ - Chain: util.IptablesForwardChain, - Specs: []string{ - util.IptablesJumpFlag, - util.IptablesAzureChain, - }, - } - } var index int var kubeServicesLine int