component-base: configurable JSON output

This implements the replacement of klog output to different files per level
with optionally splitting JSON output into two streams: one for info messages
on stdout, one for error messages on stderr. The info messages can get buffered
to increase performance. Because stdout and stderr might be merged by the
consumer, the info stream gets flushed before writing an error, to ensure that
the order of messages is preserved.

This also ensures that the following code pattern doesn't leak info messages:
   klog.ErrorS(err, ...)
   os.Exit(1)

Commands explicitly have to flush before exiting via logs.FlushLogs. Most
already do. But buffered info messages can still get lost during an unexpected
program termination, therefore buffering is off by default.

The new options get added to the v1alpha1 LoggingConfiguration with new command
line flags. Because it is an alpha field, changing it inside the v1beta kubelet
config should be okay as long as the fields are clearly marked as alpha.

Kubernetes-commit: b22263d8351e873961aeff5d065faf3443de9acb
This commit is contained in:
Patrick Ohly 2021-09-10 18:02:23 +02:00 committed by Kubernetes Publisher
parent 4b1e922032
commit 2902dcb6e5
1 changed files with 1 additions and 1 deletions

View File

@ -310,7 +310,7 @@ func (in *KubeletConfiguration) DeepCopyInto(out *KubeletConfiguration) {
*out = make([]string, len(*in))
copy(*out, *in)
}
out.Logging = in.Logging
in.Logging.DeepCopyInto(&out.Logging)
if in.EnableSystemLogHandler != nil {
in, out := &in.EnableSystemLogHandler, &out.EnableSystemLogHandler
*out = new(bool)