mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 21:47:07 +00:00
Merge pull request #96372 from serathius/sanitization-kubelet
Add --experimental-logging-sanitization flag to kubelet
This commit is contained in:
commit
71331d8596
@ -545,6 +545,8 @@ func AddKubeletConfigFlags(mainfs *pflag.FlagSet, c *kubeletconfig.KubeletConfig
|
|||||||
fs.StringVar(&c.SystemReservedCgroup, "system-reserved-cgroup", c.SystemReservedCgroup, "Absolute name of the top level cgroup that is used to manage non-kubernetes components for which compute resources were reserved via '--system-reserved' flag. Ex. '/system-reserved'. [default='']")
|
fs.StringVar(&c.SystemReservedCgroup, "system-reserved-cgroup", c.SystemReservedCgroup, "Absolute name of the top level cgroup that is used to manage non-kubernetes components for which compute resources were reserved via '--system-reserved' flag. Ex. '/system-reserved'. [default='']")
|
||||||
fs.StringVar(&c.KubeReservedCgroup, "kube-reserved-cgroup", c.KubeReservedCgroup, "Absolute name of the top level cgroup that is used to manage kubernetes components for which compute resources were reserved via '--kube-reserved' flag. Ex. '/kube-reserved'. [default='']")
|
fs.StringVar(&c.KubeReservedCgroup, "kube-reserved-cgroup", c.KubeReservedCgroup, "Absolute name of the top level cgroup that is used to manage kubernetes components for which compute resources were reserved via '--kube-reserved' flag. Ex. '/kube-reserved'. [default='']")
|
||||||
fs.StringVar(&c.Logging.Format, "logging-format", c.Logging.Format, `Sets the log format. Permitted formats: "text", "json".\nNon-default formats don't honor these flags: -add_dir_header, --alsologtostderr, --log_backtrace_at, --log_dir, --log_file, --log_file_max_size, --logtostderr, --skip_headers, --skip_log_headers, --stderrthreshold, --log-flush-frequency.\nNon-default choices are currently alpha and subject to change without warning.`)
|
fs.StringVar(&c.Logging.Format, "logging-format", c.Logging.Format, `Sets the log format. Permitted formats: "text", "json".\nNon-default formats don't honor these flags: -add_dir_header, --alsologtostderr, --log_backtrace_at, --log_dir, --log_file, --log_file_max_size, --logtostderr, --skip_headers, --skip_log_headers, --stderrthreshold, --log-flush-frequency.\nNon-default choices are currently alpha and subject to change without warning.`)
|
||||||
|
fs.BoolVar(&c.Logging.Sanitization, "experimental-logging-sanitization", c.Logging.Sanitization, `[Experimental] When enabled prevents logging of fields tagged as sensitive (passwords, keys, tokens).
|
||||||
|
Runtime log sanitization may introduce significant computation overhead and therefore should not be enabled in production.`)
|
||||||
|
|
||||||
// Graduated experimental flags, kept for backward compatibility
|
// Graduated experimental flags, kept for backward compatibility
|
||||||
fs.BoolVar(&c.KernelMemcgNotification, "experimental-kernel-memcg-notification", c.KernelMemcgNotification, "Use kernelMemcgNotification configuration, this flag will be removed in 1.23.")
|
fs.BoolVar(&c.KernelMemcgNotification, "experimental-kernel-memcg-notification", c.KernelMemcgNotification, "Use kernelMemcgNotification configuration, this flag will be removed in 1.23.")
|
||||||
|
@ -410,6 +410,7 @@ func UnsecuredDependencies(s *options.KubeletServer, featureGate featuregate.Fea
|
|||||||
func Run(ctx context.Context, s *options.KubeletServer, kubeDeps *kubelet.Dependencies, featureGate featuregate.FeatureGate) error {
|
func Run(ctx context.Context, s *options.KubeletServer, kubeDeps *kubelet.Dependencies, featureGate featuregate.FeatureGate) error {
|
||||||
logOption := logs.NewOptions()
|
logOption := logs.NewOptions()
|
||||||
logOption.LogFormat = s.Logging.Format
|
logOption.LogFormat = s.Logging.Format
|
||||||
|
logOption.LogSanitization = s.Logging.Sanitization
|
||||||
logOption.Apply()
|
logOption.Apply()
|
||||||
// To help debugging, immediately log version
|
// To help debugging, immediately log version
|
||||||
klog.Infof("Version: %+v", version.Get())
|
klog.Infof("Version: %+v", version.Get())
|
||||||
|
@ -185,6 +185,7 @@ var (
|
|||||||
"HealthzBindAddress",
|
"HealthzBindAddress",
|
||||||
"HealthzPort",
|
"HealthzPort",
|
||||||
"Logging.Format",
|
"Logging.Format",
|
||||||
|
"Logging.Sanitization",
|
||||||
"TLSCipherSuites[*]",
|
"TLSCipherSuites[*]",
|
||||||
"TLSMinVersion",
|
"TLSMinVersion",
|
||||||
"IPTablesDropBit",
|
"IPTablesDropBit",
|
||||||
|
@ -80,9 +80,12 @@ type DebuggingConfiguration struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LoggingConfiguration contains logging options
|
// LoggingConfiguration contains logging options
|
||||||
|
// Refer [Logs Options](https://github.com/kubernetes/component-base/blob/master/logs/options.go) for more information.
|
||||||
type LoggingConfiguration struct {
|
type LoggingConfiguration struct {
|
||||||
// Format Flag specifies the structure of log messages.
|
// Format Flag specifies the structure of log messages.
|
||||||
// default value of format is `text`
|
// default value of format is `text`
|
||||||
// Refer [Logs Options](https://github.com/kubernetes/component-base/blob/master/logs/options.go) for more information.
|
|
||||||
Format string
|
Format string
|
||||||
|
// [Experimental] When enabled prevents logging of fields tagged as sensitive (passwords, keys, tokens).
|
||||||
|
// Runtime log sanitization may introduce significant computation overhead and therefore should not be enabled in production.`)
|
||||||
|
Sanitization bool
|
||||||
}
|
}
|
||||||
|
@ -82,9 +82,12 @@ type ClientConnectionConfiguration struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LoggingConfiguration contains logging options
|
// LoggingConfiguration contains logging options
|
||||||
|
// Refer [Logs Options](https://github.com/kubernetes/component-base/blob/master/logs/options.go) for more information.
|
||||||
type LoggingConfiguration struct {
|
type LoggingConfiguration struct {
|
||||||
// Format Flag specifies the structure of log messages.
|
// Format Flag specifies the structure of log messages.
|
||||||
// default value of format is `text`
|
// default value of format is `text`
|
||||||
// Refer [Logs Options](https://github.com/kubernetes/component-base/blob/master/logs/options.go) for more information.
|
|
||||||
Format string `json:"format,omitempty"`
|
Format string `json:"format,omitempty"`
|
||||||
|
// [Experimental] When enabled prevents logging of fields tagged as sensitive (passwords, keys, tokens).
|
||||||
|
// Runtime log sanitization may introduce significant computation overhead and therefore should not be enabled in production.`)
|
||||||
|
Sanitization bool `json:"sanitization,omitempty"`
|
||||||
}
|
}
|
||||||
|
@ -143,10 +143,12 @@ func autoConvert_config_LeaderElectionConfiguration_To_v1alpha1_LeaderElectionCo
|
|||||||
|
|
||||||
func autoConvert_v1alpha1_LoggingConfiguration_To_config_LoggingConfiguration(in *LoggingConfiguration, out *config.LoggingConfiguration, s conversion.Scope) error {
|
func autoConvert_v1alpha1_LoggingConfiguration_To_config_LoggingConfiguration(in *LoggingConfiguration, out *config.LoggingConfiguration, s conversion.Scope) error {
|
||||||
out.Format = in.Format
|
out.Format = in.Format
|
||||||
|
out.Sanitization = in.Sanitization
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func autoConvert_config_LoggingConfiguration_To_v1alpha1_LoggingConfiguration(in *config.LoggingConfiguration, out *LoggingConfiguration, s conversion.Scope) error {
|
func autoConvert_config_LoggingConfiguration_To_v1alpha1_LoggingConfiguration(in *config.LoggingConfiguration, out *LoggingConfiguration, s conversion.Scope) error {
|
||||||
out.Format = in.Format
|
out.Format = in.Format
|
||||||
|
out.Sanitization = in.Sanitization
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ func (o *Options) AddFlags(fs *pflag.FlagSet) {
|
|||||||
|
|
||||||
// No new log formats should be added after generation is of flag options
|
// No new log formats should be added after generation is of flag options
|
||||||
logRegistry.Freeze()
|
logRegistry.Freeze()
|
||||||
fs.BoolVar(&o.LogSanitization, "experimental-logging-sanitization", false, `[Experimental] When enabled prevents logging of fields that tagged as sensitive (passwords, keys, tokens).
|
fs.BoolVar(&o.LogSanitization, "experimental-logging-sanitization", o.LogSanitization, `[Experimental] When enabled prevents logging of fields tagged as sensitive (passwords, keys, tokens).
|
||||||
Runtime log sanitization may introduce significant computation overhead and therefore should not be enabled in production.`)
|
Runtime log sanitization may introduce significant computation overhead and therefore should not be enabled in production.`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user