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
component-base: move v/vmodule/log-flush-frequency into LoggingConfiguration #106090
Conversation
I ran the comparison script from #105076 (comment). It shows the following changes in command line usage and no unexpected changes in other commands:
|
@@ -122,4 +122,7 @@ func RecommendedLoggingConfiguration(obj *LoggingConfiguration) { | |||
// by reflect.DeepEqual in some tests. | |||
_ = obj.Options.JSON.InfoBufferSize.String() | |||
} | |||
if obj.FlushFrequency == 0*time.Second { |
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 obj.FlushFrequency == 0*time.Second { | |
if obj.FlushFrequency == 0 { |
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 time.Second required here? I think it obscures the check if value was not provided.
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 and also addressed the unit test failures for kubelet config.
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 time.Second required here?
No. I thought I had to provide a time.Duration
value for the comparison, but the 0
constant works just as well.
This PR may require API review. If so, when the changes are ready, complete the pre-review checklist and request an API review. Status of requested reviews is tracked in the API Review project. |
Overall LGTM, one question about introduction of SkipLoggingConfigurationFlags. What will happen if new components starts using LoggingConfiguration.AddFlags, but forgets to pass SkipLoggingConfigurationFlags? Will it:
Would be good to confirm which case will happen to make sure we avoid hard to debug issues in future. |
It depends.
Yes, if using the same flag set. I saw that in kubelet.
For example, kube-controller-manager uses different flag sets. --help then shows the flag twice. I did not check whether that then still works. Let me have a look... No, that doesn't work.
You refer to kubelet here, right? kubelet panics, so we don't need to worry about that. |
We should make sure we panic in this case, so the problem is easy to notice. |
/label api-review |
/test pull-kubernetes-e2e-windows-gce Unrelated to this PR, I just want to see whether it collects kubelet logs on Windows nodes (relevant for some other PR). |
@pohly: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
/triage accepted |
@wgahnagl: The label(s) In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/priority important-soon |
/cc @thockin |
/approve |
/retest |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: pohly, thockin 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 |
…also be configured via the configuration ref kubernetes/kubernetes#106090
…also be configured via the configuration ref kubernetes/kubernetes#106090
…also be configured via the configuration ref kubernetes/kubernetes#106090
* Bump k8s.io/* to v0.23.3 in go.mod * [automated] make revendor * [automated] make generate * Bump c-r to v0.11.0 in go.mod * [automated] make revendor * Bump controller-tools to v0.8.0 in go.mod * [automated] make revendor * Adapt change for Logger changed to Struct From v1.0.0 log.Logger has been changed to struct from Interface. Logger struct has field `LogSink` interface which is same as old `Logger` interface * Adapt changes fo NullLogger * Adapt chnage in Handler API ref kubernetes/kubernetes#105979 * Adapt ResolverConfig field changed from a string to *string ref kubernetes/kunernetes#104624 * Adapt changes for, In kubelet, log verbosity and flush frequency can also be configured via the configuration ref kubernetes/kubernetes#106090 * [automated] make generate * Avoid shallow copies of webhook ref kubernetes-sigs/controller-runtime#1667 * Add back apiserver logging flags * Rebase Co-authored-by: Tim Ebert <timebertt@gmail.com>
* Bump k8s.io/* to v0.23.3 in go.mod * [automated] make revendor * [automated] make generate * Bump c-r to v0.11.0 in go.mod * [automated] make revendor * Bump controller-tools to v0.8.0 in go.mod * [automated] make revendor * Adapt change for Logger changed to Struct From v1.0.0 log.Logger has been changed to struct from Interface. Logger struct has field `LogSink` interface which is same as old `Logger` interface * Adapt changes fo NullLogger * Adapt chnage in Handler API ref kubernetes/kubernetes#105979 * Adapt ResolverConfig field changed from a string to *string ref kubernetes/kunernetes#104624 * Adapt changes for, In kubelet, log verbosity and flush frequency can also be configured via the configuration ref kubernetes/kubernetes#106090 * [automated] make generate * Avoid shallow copies of webhook ref kubernetes-sigs/controller-runtime#1667 * Add back apiserver logging flags * Rebase Co-authored-by: Tim Ebert <timebertt@gmail.com>
* Bump k8s.io/* to v0.23.3 in go.mod * [automated] make revendor * [automated] make generate * Bump c-r to v0.11.0 in go.mod * [automated] make revendor * Bump controller-tools to v0.8.0 in go.mod * [automated] make revendor * Adapt change for Logger changed to Struct From v1.0.0 log.Logger has been changed to struct from Interface. Logger struct has field `LogSink` interface which is same as old `Logger` interface * Adapt changes fo NullLogger * Adapt chnage in Handler API ref kubernetes/kubernetes#105979 * Adapt ResolverConfig field changed from a string to *string ref kubernetes/kunernetes#104624 * Adapt changes for, In kubelet, log verbosity and flush frequency can also be configured via the configuration ref kubernetes/kubernetes#106090 * [automated] make generate * Avoid shallow copies of webhook ref kubernetes-sigs/controller-runtime#1667 * Add back apiserver logging flags * Rebase Co-authored-by: Tim Ebert <timebertt@gmail.com>
What type of PR is this?
/kind feature
What this PR does / why we need it:
These three options are the ones from logs.AddFlags which are not deprecated.
Therefore it makes sense to make them available also via the configuration file
support in the one command which currently supports that (kubelet).
Which issue(s) this PR fixes:
Fixes #99265
Special notes for your reviewer:
Long-term, all commands should use LoggingConfiguration, either with a
configuration file (as in kubelet) or via flags (kube-scheduler,
kube-apiserver, kube-controller-manager).
Short-term, both approaches have to be supported. As the majority of the
commands only use logs.AddFlags, that function by default continues to register
the flags and only leaves that to Options.AddFlags when explicitly requested.
A drive-by bug fix is done for log flushing: the periodic flushing called
klog.Flush and therefore missed explicit flushing of the newer logr
backend. This bug was never present in any release Kubernetes and therefore the
fix is not submitted in a separate PR.
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:
/cc @serathius