From c0e0fae775f368f093facbc26661275a9acb2e00 Mon Sep 17 00:00:00 2001 From: jyz0309 <45495947@qq.com> Date: Tue, 21 Sep 2021 11:03:26 +0800 Subject: [PATCH] fix error Signed-off-by: jyz0309 <45495947@qq.com> use InfoS handle json Signed-off-by: jyz0309 <45495947@qq.com> remove import Signed-off-by: jyz0309 <45495947@qq.com> fix comment Signed-off-by: jyz0309 <45495947@qq.com> --- pkg/proxy/winkernel/proxier.go | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/pkg/proxy/winkernel/proxier.go b/pkg/proxy/winkernel/proxier.go index 8af99448aaa..13eb845c33d 100644 --- a/pkg/proxy/winkernel/proxier.go +++ b/pkg/proxy/winkernel/proxier.go @@ -20,7 +20,6 @@ limitations under the License. package winkernel import ( - "encoding/json" "fmt" "net" "os" @@ -431,7 +430,7 @@ func newSourceVIP(hns HostNetworkService, network string, ip string, mac string, } func (ep *endpointsInfo) Cleanup() { - klog.V(3).InfoS("Endpoint cleanup", "spewConfig", spewSdump(ep)) + klog.V(3).InfoS("Endpoint cleanup", "endpointsInfo", ep) if !ep.GetIsLocal() && ep.refCount != nil { *ep.refCount-- @@ -776,7 +775,7 @@ func CleanupLeftovers() (encounteredError bool) { } func (svcInfo *serviceInfo) cleanupAllPolicies(endpoints []proxy.Endpoint) { - klog.V(3).InfoS("Service cleanup", "spewConfig", spewSdump(svcInfo)) + klog.V(3).InfoS("Service cleanup", "serviceInfo", svcInfo) // Skip the svcInfo.policyApplied check to remove all the policies svcInfo.deleteAllHnsLoadBalancerPolicy() // Cleanup Endpoints references @@ -818,9 +817,7 @@ func deleteAllHnsLoadBalancerPolicy() { return } for _, plist := range plists { - if jsonString, err := json.Marshal(plist); err == nil { - klog.V(3).InfoS("Remove policy", "policyList", jsonString) - } + klog.V(3).InfoS("Remove policy", "policyList", plist) _, err = plist.Delete() if err != nil { klog.ErrorS(err, "Failed to delete policy list") @@ -1188,9 +1185,8 @@ func (proxier *Proxier) syncProxyRules() { } // Save the hnsId for reference - if jsonString, err := json.Marshal(plist); err == nil { - klog.V(1).InfoS("Hns endpoint resource", "endpointInfo", jsonString) - } + klog.V(1).InfoS("Hns endpoint resource", "endpointInfo", newHnsEndpoint) + hnsEndpoints = append(hnsEndpoints, *newHnsEndpoint) if newHnsEndpoint.GetIsLocal() { hnsLocalEndpoints = append(hnsLocalEndpoints, *newHnsEndpoint) @@ -1202,7 +1198,7 @@ func (proxier *Proxier) syncProxyRules() { ep.hnsID = newHnsEndpoint.hnsID - klog.V(3).InfoS("Endpoint resource found", "spewConfig", spewSdump(ep)) + klog.V(3).InfoS("Endpoint resource found", "endpointsInfo", ep) } klog.V(3).InfoS("Associated endpoints for service", "spewConfig", spewSdump(hnsEndpoints), "svcName", svcName.String())