logging: fix names of keys

The stricter checking with the upcoming logcheck v0.4.1 pointed out these names
which don't comply with our recommendations in
https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/migration-to-structured-logging.md#name-arguments.
This commit is contained in:
Patrick Ohly
2023-01-16 15:04:01 +01:00
parent f21c603417
commit bc6c7fa912
27 changed files with 52 additions and 52 deletions

View File

@@ -49,7 +49,7 @@ func (rct realConntracker) SetMax(max int) error {
if err := rct.setIntSysCtl("nf_conntrack_max", max); err != nil {
return err
}
klog.InfoS("Setting nf_conntrack_max", "nf_conntrack_max", max)
klog.InfoS("Setting nf_conntrack_max", "nfConntrackMax", max)
// Linux does not support writing to /sys/module/nf_conntrack/parameters/hashsize
// when the writer process is not in the initial network namespace
@@ -80,7 +80,7 @@ func (rct realConntracker) SetMax(max int) error {
return errReadOnlySysFS
}
// TODO: generify this and sysctl to a new sysfs.WriteInt()
klog.InfoS("Setting conntrack hashsize", "conntrack hashsize", max/4)
klog.InfoS("Setting conntrack hashsize", "conntrackHashsize", max/4)
return writeIntStringFile("/sys/module/nf_conntrack/parameters/hashsize", max/4)
}

View File

@@ -365,7 +365,7 @@ func (o *Options) writeConfigFile() (err error) {
return err
}
klog.InfoS("Wrote configuration", "WriteConfigTo", o.WriteConfigTo)
klog.InfoS("Wrote configuration", "file", o.WriteConfigTo)
return nil
}

View File

@@ -141,10 +141,10 @@ func newProxyServer(
if err != nil {
return nil, err
}
klog.InfoS("NodeInfo", "PodCIDR", nodeInfo.Spec.PodCIDR, "PodCIDRs", nodeInfo.Spec.PodCIDRs)
klog.InfoS("NodeInfo", "podCIDR", nodeInfo.Spec.PodCIDR, "podCIDRs", nodeInfo.Spec.PodCIDRs)
}
klog.V(2).InfoS("DetectLocalMode", "LocalMode", string(detectLocalMode))
klog.V(2).InfoS("DetectLocalMode", "localMode", string(detectLocalMode))
primaryFamily := v1.IPv4Protocol
primaryProtocol := utiliptables.ProtocolIPv4
@@ -422,7 +422,7 @@ func getDetectLocalMode(config *proxyconfigapi.KubeProxyConfiguration) (proxycon
if strings.TrimSpace(mode.String()) != "" {
return mode, fmt.Errorf("unknown detect-local-mode: %v", mode)
}
klog.V(4).InfoS("Defaulting detect-local-mode", "LocalModeClusterCIDR", string(proxyconfigapi.LocalModeClusterCIDR))
klog.V(4).InfoS("Defaulting detect-local-mode", "localModeClusterCIDR", string(proxyconfigapi.LocalModeClusterCIDR))
return proxyconfigapi.LocalModeClusterCIDR, nil
}
}
@@ -452,7 +452,7 @@ func getLocalDetector(mode proxyconfigapi.LocalMode, config *proxyconfigapi.Kube
}
return proxyutiliptables.NewDetectLocalByInterfaceNamePrefix(config.DetectLocal.InterfaceNamePrefix)
}
klog.InfoS("Defaulting to no-op detect-local", "detect-local-mode", string(mode))
klog.InfoS("Defaulting to no-op detect-local", "detectLocalMode", string(mode))
return proxyutiliptables.NewNoOpLocalDetector(), nil
}
@@ -516,9 +516,9 @@ func getDualStackLocalDetectorTuple(mode proxyconfigapi.LocalMode, config *proxy
}
return localDetectors, err
default:
klog.InfoS("Unknown detect-local-mode", "detect-local-mode", mode)
klog.InfoS("Unknown detect-local-mode", "detectLocalMode", mode)
}
klog.InfoS("Defaulting to no-op detect-local", "detect-local-mode", string(mode))
klog.InfoS("Defaulting to no-op detect-local", "detectLocalMode", string(mode))
return localDetectors, nil
}