Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Update klog to 0.3.0 #76474
Signed-off-by: Vince Prignano email@example.com
What type of PR is this?
What this PR does / why we need it:
Which issue(s) this PR fixes:
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
[APPROVALNOTIFIER] This PR is APPROVED
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
Apr 18, 2019
20 checks passed
referenced this pull request
May 3, 2019
FYI it looks like this may have broken Kubelet's log to file behavior: #77416
@yujuhong mentioned it now writes to the log file up to the point where it tries to load the Kubelet config file, then starts logging to stderr afterwards. This makes me wonder if there is some nefarious interaction between how klog registers its flags and the way we currently enforce flag precedence.
I think the issue is that this PR changes the global FlagSet construction logic to call klog.InitFlags every time a new FlagSet is constructed. This has the side effect of resetting the values of all klog flags to defaults. The old logic constructed a FlagSet that referenced the global flags without changing their values.
Constructing the global flag set should not have such a side-effect, because the Kubelet currently needs to re-parse the full command line to enforce precedence while explicitly not calling Set for global flag values a second time, or else accumulator flags could end up with duplicate entries during the re-parse.
@dims I believe the problem I described only happens in the Kubelet; I don't think any other components have copied the flag precedence approach in the Kubelet yet (hence the legacyflag work). That said, if other components wanted to do something similar, a similar call to InitFlags in the globalflag package in component-base will cause the same issue.
I think we should be able to fix by just reverting the Kubelet code to register each klog flag individually, and avoid the side-effect.