Log spelling formatting and a redundant conversion

Signed-off-by: 刁浩 10284789 <diao.hao@zte.com.cn>
This commit is contained in:
刁浩 10284789 2021-05-27 07:07:22 +00:00
parent 29e5e4df4b
commit 580b557592

View File

@ -273,13 +273,13 @@ func NewProxier(ipt utiliptables.Interface,
// are connected to a Linux bridge (but not SDN bridges). Until most // are connected to a Linux bridge (but not SDN bridges). Until most
// plugins handle this, log when config is missing // plugins handle this, log when config is missing
if val, err := sysctl.GetSysctl(sysctlBridgeCallIPTables); err == nil && val != 1 { if val, err := sysctl.GetSysctl(sysctlBridgeCallIPTables); err == nil && val != 1 {
klog.InfoS("missing br-netfilter module or unset sysctl br-nf-call-iptables; proxy may not work as intended") klog.InfoS("Missing br-netfilter module or unset sysctl br-nf-call-iptables; proxy may not work as intended")
} }
// Generate the masquerade mark to use for SNAT rules. // Generate the masquerade mark to use for SNAT rules.
masqueradeValue := 1 << uint(masqueradeBit) masqueradeValue := 1 << uint(masqueradeBit)
masqueradeMark := fmt.Sprintf("%#08x", masqueradeValue) masqueradeMark := fmt.Sprintf("%#08x", masqueradeValue)
klog.V(2).InfoS("using iptables mark for masquerade", "ipFamily", ipt.Protocol(), "mark", masqueradeMark) klog.V(2).InfoS("Using iptables mark for masquerade", "ipFamily", ipt.Protocol(), "mark", masqueradeMark)
endpointSlicesEnabled := utilfeature.DefaultFeatureGate.Enabled(features.EndpointSliceProxying) endpointSlicesEnabled := utilfeature.DefaultFeatureGate.Enabled(features.EndpointSliceProxying)
@ -294,7 +294,7 @@ func NewProxier(ipt utiliptables.Interface,
nodePortAddresses = ipFamilyMap[ipFamily] nodePortAddresses = ipFamilyMap[ipFamily]
// Log the IPs not matching the ipFamily // Log the IPs not matching the ipFamily
if ips, ok := ipFamilyMap[utilproxy.OtherIPFamily(ipFamily)]; ok && len(ips) > 0 { if ips, ok := ipFamilyMap[utilproxy.OtherIPFamily(ipFamily)]; ok && len(ips) > 0 {
klog.InfoS("found node IPs of the wrong family", "ipFamily", ipFamily, "ips", strings.Join(ips, ",")) klog.InfoS("Found node IPs of the wrong family", "ipFamily", ipFamily, "ips", strings.Join(ips, ","))
} }
proxier := &Proxier{ proxier := &Proxier{
@ -327,7 +327,7 @@ func NewProxier(ipt utiliptables.Interface,
} }
burstSyncs := 2 burstSyncs := 2
klog.V(2).InfoS("iptables sync params", "ipFamily", ipt.Protocol(), "minSyncPeriod", minSyncPeriod, "syncPeriod", syncPeriod, "burstSyncs", burstSyncs) klog.V(2).InfoS("Iptables sync params", "ipFamily", ipt.Protocol(), "minSyncPeriod", minSyncPeriod, "syncPeriod", syncPeriod, "burstSyncs", burstSyncs)
// We pass syncPeriod to ipt.Monitor, which will call us only if it needs to. // We pass syncPeriod to ipt.Monitor, which will call us only if it needs to.
// We need to pass *some* maxInterval to NewBoundedFrequencyRunner anyway though. // We need to pass *some* maxInterval to NewBoundedFrequencyRunner anyway though.
// time.Hour is arbitrary. // time.Hour is arbitrary.
@ -337,9 +337,9 @@ func NewProxier(ipt utiliptables.Interface,
proxier.syncProxyRules, syncPeriod, wait.NeverStop) proxier.syncProxyRules, syncPeriod, wait.NeverStop)
if ipt.HasRandomFully() { if ipt.HasRandomFully() {
klog.V(2).InfoS("iptables supports --random-fully", "ipFamily", ipt.Protocol()) klog.V(2).InfoS("Iptables supports --random-fully", "ipFamily", ipt.Protocol())
} else { } else {
klog.V(2).InfoS("iptables does not support --random-fully", "ipFamily", ipt.Protocol()) klog.V(2).InfoS("Iptables does not support --random-fully", "ipFamily", ipt.Protocol())
} }
return proxier, nil return proxier, nil
@ -829,7 +829,7 @@ func (proxier *Proxier) syncProxyRules() {
start := time.Now() start := time.Now()
defer func() { defer func() {
metrics.SyncProxyRulesLatency.Observe(metrics.SinceInSeconds(start)) metrics.SyncProxyRulesLatency.Observe(metrics.SinceInSeconds(start))
klog.V(2).InfoS("syncProxyRules complete", "elapsed", time.Since(start)) klog.V(2).InfoS("SyncProxyRules complete", "elapsed", time.Since(start))
}() }()
// We assume that if this was called, we really want to sync them, // We assume that if this was called, we really want to sync them,
@ -1620,7 +1620,7 @@ func (proxier *Proxier) syncProxyRules() {
numberNatIptablesRules := utilproxy.CountBytesLines(proxier.natRules.Bytes()) numberNatIptablesRules := utilproxy.CountBytesLines(proxier.natRules.Bytes())
metrics.IptablesRulesTotal.WithLabelValues(string(utiliptables.TableNAT)).Set(float64(numberNatIptablesRules)) metrics.IptablesRulesTotal.WithLabelValues(string(utiliptables.TableNAT)).Set(float64(numberNatIptablesRules))
klog.V(5).InfoS("Restoring iptables", "rules", string(proxier.iptablesData.Bytes())) klog.V(5).InfoS("Restoring iptables", "rules", proxier.iptablesData.Bytes())
err = proxier.iptables.RestoreAll(proxier.iptablesData.Bytes(), utiliptables.NoFlushTables, utiliptables.RestoreCounters) err = proxier.iptables.RestoreAll(proxier.iptablesData.Bytes(), utiliptables.NoFlushTables, utiliptables.RestoreCounters)
if err != nil { if err != nil {
klog.ErrorS(err, "Failed to execute iptables-restore") klog.ErrorS(err, "Failed to execute iptables-restore")