-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KEP-2845: Initial draft #2846
KEP-2845: Initial draft #2846
Conversation
/cc @shubheksha |
/wg structured-logging |
/milestone v1.23 |
/sig architecture |
/cc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add me as the SIG Instrumentation approver.
I added some initial comments, let's also get feedback from SIG Architecture, the other sponsor, before we merge as provisional.
keps/sig-instrumentation/2845-deprecate-klog-specific-flags-in-k8s-components/README.md
Outdated
Show resolved
Hide resolved
keps/sig-instrumentation/2845-deprecate-klog-specific-flags-in-k8s-components/README.md
Outdated
Show resolved
Hide resolved
keps/sig-instrumentation/2845-deprecate-klog-specific-flags-in-k8s-components/README.md
Outdated
Show resolved
Hide resolved
keps/sig-instrumentation/2845-deprecate-klog-specific-flags-in-k8s-components/README.md
Show resolved
Hide resolved
keps/sig-instrumentation/2845-deprecate-klog-specific-flags-in-k8s-components/README.md
Outdated
Show resolved
Hide resolved
|
||
#### Users don't want to use go-runner as replacement. | ||
|
||
TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use systemd or redirect from shell.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
#### Log processing in parent process causes performance problems | ||
|
||
TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should actually test this out but I don't think a plan will be required until KEP goes to "beta". Which is weird because this is a deprecation, so... maybe within 1 release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
- Klog can be configured without registering flags | ||
- Kubernetes logging configuration drops global state | ||
- Go-runner is feature complementary to klog flags planned for deprecation | ||
- Projects in Kubernetes Org are migrated to go-runner |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or systemd-run, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can propose alternatives like systemd-run to documentation, but k8s projects should pick a tool written in golang just for ease of maintenance.
- Go-runner project is well maintained and documented | ||
- Documentation on switching go-runner is publicly available |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This concerns me a little as I don't think adding maintenance of a new component helps reduce scope... tools exist out there, let's not put all our eggs in the go-runner basket 🐣
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
|
||
### Release klog 3.0 with removed features | ||
Removal of those features cannot be done without whole k8s community instead of | ||
just k8s core components |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can do this as a follow-up eventually...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on problems with klog 2.0, I would prefer to accelerate migration to logr as it would make more sense strategically. We still would need some wrapper code to configure external library but not something worth our own library.
#### Alpha | ||
|
||
- Klog can be configured without registering flags | ||
- Kubernetes logging configuration drops global state |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there is no global logging state anymore, how will the current log calls like klog.InfoS
be handled? That currently falls back to the globally configured klog.
I fully agree that we should get rid of that global state. I'd like to see a logger instance be passed into all functions which do logging, but there's no consensus on how to do that (attach to context vs. explicit parameter) and this KEP doesn't address this.
FWIW, I prefer the approach via context. Adding another parameter implies API breaks (client-go...) and other components already started using the context (logr, operator SDK), so if Kubernetes does the same, different code bases will become interoperable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree about using context to replace klog global state, but for now we want to start with removing configuration (flags etc), . This point is about configuration, basically removing global klog flags and passing through config struct to register/validate and initialize logging (same as how other components are configured). At some point this configuration will be applied to global klog state, but at least we clean up configuration.
zap already supports different streams for info and error messages. That should work also with go-logr/zapr which uses different message levels (https://github.com/go-logr/zapr/blob/566ac59c7d87b6450256fc47749549306638d348/zapr.go#L187-L197). What concerns me more is configuring the logging backend:
|
We should have small set of common flags supported by all backend. Those flags should be based on features exposed by the logr interface itself, mainly about verbosity control. I don't think we should have any wrappers and agree that we should delegate the problem to backend implementations.
After giving it a though I agree, at some point we definetly will need to have a pass some configuration to backends. Main challenge here is to avoid version pinning problems that we had in klog. Kubernetes backward policy is too restrictive for most logging libraries (backward compatible for almost a year). I think we would want to introduce logging format versioning to avoid negatively impacting other projects. This problem would require a separate discussion and a KEP, but I think we should stop using configuration flags to maintain backward compatibility and instead start versioning log format. For example if we decide to change format of timestamp in json log format we should introduce "json-v2" format instead of adding flag "--json-timestamp-format=string". Old "json" format would be marked as deprecated and removed after 3 releases. This way we can make changes to format, and maintain backward compatibility. To avoid this KEP being too big, I would propose to tackle log format versioning as a separate problem that will address when we have specific use cases. For now we should be ok to release klog and json formats with only one configuration based on good defaults. |
Makes sense to me. https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/component-base/logs/registry.go then needs to be changed from "register a
What I would do is to say "json" is selecting zap as backend with certain default options for the underlying zapr logger and then have a configuration format that is specific for that backend. That format then can be versioned separately. I wouldn't add command line flags for each backend, just a generic "--log-config-file
Agreed. |
ping @thockin |
## Proposal | ||
|
||
I propose that Kubernetes core components (kube-apiserver, kube-scheduler, | ||
kube-controller-manager, kubelet) should drop flags that extend |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When and on what sort of timeline?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deprecate in 1.23 and remove in 1.26 to follow 3 release deprecation window.
logging over events streams or klog specific features. This change should be | ||
scoped to only those components and not affect broader klog community. | ||
|
||
With removal of output stream manipulation flags we need to provide a set of sane |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For backwards compatibility, should we support a double set of flags during an overlapping period?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There sill not be a double set of flags as we are just removing flags, not replacing them with alternatives.
* --log-backtrace-at - an legacy glog feature. | ||
Motivation: No trace of anyone using this feature. | ||
|
||
Flag deprecation should comply with standard k8s policy and require 3 releases before removal. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah here we are.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:P
Technically K8s already doesn't support klog flags. Klog flags are renamed to | ||
comply with K8s flag naming convention (underscores are replaced with hyphens). | ||
Full klog support was never promised to users and removal of those flags should | ||
be treated as removal of any other flag. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems fair.
defaults and convention that will prevent logging formats implementations to | ||
diverge and reintroduce their own flags. As logs should be treated as event | ||
streams I would propose that we separate two main streams "info" and "error" | ||
based on log method called. As error logs should usually be treated with higher |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this backwards compatible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, that's why I'm proposing a multi release plan to make this change.
|
||
Splitting stdout from stderr would be a breaking change in both klog and | ||
kubernetes components. To avoid that I propose to introduce new logging flag | ||
`--logtostdout` in klog that will allow writing info logs to stdout. This flag |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All logs? What about error logs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This flag is meant to split stdout and stderr. It's name is complementary to "--logtostderr". If both are enabled, info will be send to stdout, error to stderr.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
discussed offline, @serathius helpfully answered my questions.
/lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
(elana is on vacation)
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: logicalhan, serathius The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/assign @ehashman
Elana, can we merge it quickly as provisional as we confirmed support from SIG-Arch and SIG-Instrumentation?