From 2902dcb6e510f2f9623a8da61e24f13506978adf Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Fri, 10 Sep 2021 18:02:23 +0200 Subject: [PATCH] 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 --- config/v1beta1/zz_generated.deepcopy.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/v1beta1/zz_generated.deepcopy.go b/config/v1beta1/zz_generated.deepcopy.go index 9bd95cb..de561fd 100644 --- a/config/v1beta1/zz_generated.deepcopy.go +++ b/config/v1beta1/zz_generated.deepcopy.go @@ -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)