remove spew

Signed-off-by: jyz0309 <45495947@qq.com>

remove spew

Signed-off-by: jyz0309 <45495947@qq.com>

remove LogJson

Signed-off-by: jyz0309 <45495947@qq.com>

change name

Signed-off-by: jyz0309 <45495947@qq.com>

remove spew

Signed-off-by: jyz0309 <45495947@qq.com>
This commit is contained in:
jyz0309 2021-09-21 22:36:25 +08:00
parent c0e0fae775
commit e9abf3dfc6
3 changed files with 12 additions and 20 deletions

View File

@ -194,7 +194,7 @@ func (hns hnsV1) getLoadBalancer(endpoints []endpointsInfo, flags loadBalancerFl
} else if len(elbPolicy.VIPs) != 0 {
continue
}
LogJson("policyList", plist, "Found existing Hns loadbalancer policy resource", 1)
klog.V(1).InfoS("Found existing Hns loadbalancer policy resource", "policies", plist)
return &loadBalancerInfo{
hnsID: plist.ID,
}, nil
@ -220,7 +220,7 @@ func (hns hnsV1) getLoadBalancer(endpoints []endpointsInfo, flags loadBalancerFl
)
if err == nil {
LogJson("policyList", lb, "Hns loadbalancer policy resource", 1)
klog.V(1).InfoS("Hns loadbalancer policy resource", "policies", lb)
} else {
return nil, err
}
@ -239,7 +239,7 @@ func (hns hnsV1) deleteLoadBalancer(hnsID string) error {
if err != nil {
return err
}
LogJson("policyList", hnsloadBalancer, "Removing Policy", 2)
klog.V(2).InfoS("Removing Policy", "policies", hnsloadBalancer)
_, err = hnsloadBalancer.Delete()
return err

View File

@ -202,7 +202,7 @@ func (hns hnsV2) getLoadBalancer(endpoints []endpointsInfo, flags loadBalancerFl
} else if len(plist.FrontendVIPs) != 0 {
continue
}
LogJson("policyList", plist, "Found existing Hns loadbalancer policy resource", 1)
klog.V(1).InfoS("Found existing Hns loadbalancer policy resource", "policies", plist)
return &loadBalancerInfo{
hnsID: plist.Id,
}, nil
@ -281,8 +281,7 @@ func (hns hnsV2) getLoadBalancer(endpoints []endpointsInfo, flags loadBalancerFl
return nil, err
}
LogJson("hostComputeLoadBalancer", lb, "Hns loadbalancer policy resource", 1)
klog.V(1).InfoS("Hns loadbalancer policy resource", "loadBalancer", lb)
return &loadBalancerInfo{
hnsID: lb.Id,
}, err

View File

@ -31,7 +31,6 @@ import (
"github.com/Microsoft/hcsshim"
"github.com/Microsoft/hcsshim/hcn"
"github.com/davecgh/go-spew/spew"
v1 "k8s.io/api/core/v1"
discovery "k8s.io/api/discovery/v1"
"k8s.io/apimachinery/pkg/types"
@ -221,12 +220,6 @@ func (t DualStackCompatTester) DualStackCompatible(networkName string) bool {
return true
}
func spewSdump(v interface{}) string {
scs := spew.NewDefaultConfig()
scs.DisableMethods = true
return scs.Sdump(v)
}
// internal struct for endpoints information
type endpointsInfo struct {
ip string
@ -817,7 +810,7 @@ func deleteAllHnsLoadBalancerPolicy() {
return
}
for _, plist := range plists {
klog.V(3).InfoS("Remove policy", "policyList", plist)
klog.V(3).InfoS("Remove policy", "policies", plist)
_, err = plist.Delete()
if err != nil {
klog.ErrorS(err, "Failed to delete policy list")
@ -1046,7 +1039,7 @@ func (proxier *Proxier) syncProxyRules() {
}
if svcInfo.policyApplied {
klog.V(4).InfoS("Policy already applied", "spewConfig", spewSdump(svcInfo))
klog.V(4).InfoS("Policy already applied", "serviceInfo", svcInfo)
continue
}
@ -1143,7 +1136,7 @@ func (proxier *Proxier) syncProxyRules() {
newHnsEndpoint, err = hns.createEndpoint(hnsEndpoint, hnsNetworkName)
if err != nil {
klog.ErrorS(err, "Remote endpoint creation failed", "spewConfig", spewSdump(hnsEndpoint))
klog.ErrorS(err, "Remote endpoint creation failed", "endpointsInfo", hnsEndpoint)
continue
}
} else {
@ -1185,7 +1178,7 @@ func (proxier *Proxier) syncProxyRules() {
}
// Save the hnsId for reference
klog.V(1).InfoS("Hns endpoint resource", "endpointInfo", newHnsEndpoint)
klog.V(1).InfoS("Hns endpoint resource", "endpointsInfo", newHnsEndpoint)
hnsEndpoints = append(hnsEndpoints, *newHnsEndpoint)
if newHnsEndpoint.GetIsLocal() {
@ -1201,7 +1194,7 @@ func (proxier *Proxier) syncProxyRules() {
klog.V(3).InfoS("Endpoint resource found", "endpointsInfo", ep)
}
klog.V(3).InfoS("Associated endpoints for service", "spewConfig", spewSdump(hnsEndpoints), "svcName", svcName.String())
klog.V(3).InfoS("Associated endpoints for service", "endpointsInfo", hnsEndpoints, "svcName", svcName.String())
if len(svcInfo.hnsID) > 0 {
// This should not happen
@ -1213,7 +1206,7 @@ func (proxier *Proxier) syncProxyRules() {
continue
}
klog.V(4).Infof("Trying to Apply Policies for service", "spewConfig", spewSdump(svcInfo))
klog.V(4).Infof("Trying to apply Policies for service", "serviceInfo", svcInfo)
var hnsLoadBalancer *loadBalancerInfo
var sourceVip = proxier.sourceVip
if containsPublicIP || containsNodeIP {
@ -1316,7 +1309,7 @@ func (proxier *Proxier) syncProxyRules() {
klog.V(3).InfoS("Hns LoadBalancer resource created for loadBalancer Ingress resources", "lbIngressIP", lbIngressIP)
}
svcInfo.policyApplied = true
klog.V(2).InfoS("Policy Successfully applied for service", "spewConfig", spewSdump(svcInfo))
klog.V(2).InfoS("Policy successfully applied for service", "serviceInfo", svcInfo)
}
if proxier.healthzServer != nil {