Skip to content
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

Update klog to 0.3.0 #76474

Merged
merged 1 commit into from Apr 18, 2019
Merged

Conversation

vincepri
Copy link
Member

@vincepri vincepri commented Apr 11, 2019

Signed-off-by: Vince Prignano vincepri@vmware.com

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line:

/kind api-change
/kind bug
/kind cleanup
/kind design
/kind documentation
/kind failing-test
/kind feature
/kind flake

What this PR does / why we need it:
This PR updates klog dependency to the latest release: 0.3.0.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Updated klog to 0.3.0

@k8s-ci-robot k8s-ci-robot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Apr 11, 2019
@k8s-ci-robot k8s-ci-robot requested review from caesarxuchao, davidopp and a team April 11, 2019 23:01
@k8s-ci-robot k8s-ci-robot added area/apiserver area/cloudprovider area/code-generation area/dependency Issues or PRs related to dependency changes sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/cli Categorizes an issue or PR as relevant to SIG CLI. sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Apr 11, 2019
@dims
Copy link
Member

dims commented Apr 11, 2019

/approve
/assign @liggitt @cblecker

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. area/kubelet sig/node Categorizes an issue or PR as relevant to SIG Node. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Apr 11, 2019
@@ -105,6 +105,7 @@ func addGlogFlags(fs *pflag.FlagSet) {
register(global, local, "log_backtrace_at")
register(global, local, "log_dir")
register(global, local, "log_file")
register(global, local, "log_file_max_size")
Copy link
Member

@liggitt liggitt Apr 12, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it our intent to keep adding global flags like this? I expected us to manage flags in a better way going forward, especially if we control the log library

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly I'm not sure. I updated the code where the codebase is referenced, I can take this one out I think, but the other change in components-base is required otherwise some tests fail.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be clear, the issue is with the change made in klog, but this change here is a good example of the further pollution of the global flag space it is causing. Before we pull it into kubernetes, we should resolve the future direction of klog flag handling.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @dims

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@liggitt please see kubernetes/klog#56 and kubernetes/klog#55 we can continue the conversation there

@vincepri
Copy link
Member Author

/retest

@vincepri vincepri force-pushed the update-klog-030 branch 4 times, most recently from 861b6c4 to 2d63c92 Compare April 18, 2019 15:08
Signed-off-by: Vince Prignano <vincepri@vmware.com>
@vincepri
Copy link
Member Author

/retest

@vincepri
Copy link
Member Author

@dims @liggitt All tests passed 🎉, ptal

@liggitt
Copy link
Member

liggitt commented Apr 18, 2019

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 18, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dims, liggitt, vincepri

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 18, 2019
@liggitt
Copy link
Member

liggitt commented Apr 18, 2019

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 18, 2019
@k8s-ci-robot k8s-ci-robot merged commit 17fe18b into kubernetes:master Apr 18, 2019
@mtaufen
Copy link
Contributor

mtaufen commented May 7, 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.

@mtaufen
Copy link
Contributor

mtaufen commented May 7, 2019

@liggitt @vincepri

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
Copy link
Member

dims commented May 7, 2019

@mtaufen also see #77305 could that be the same problem you are describing above?

// addKlogFlags adds flags from k8s.io/klog
func addKlogFlags(fs *pflag.FlagSet) {
local := flag.NewFlagSet(os.Args[0], flag.ExitOnError)
klog.InitFlags(local)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has the side effect of resetting the values in klog to defaults every time a new flagset is constructed.

@mtaufen
Copy link
Contributor

mtaufen commented May 7, 2019

@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.

@mtaufen
Copy link
Contributor

mtaufen commented May 7, 2019

Alternatively, we could revert this PR, then fix klog so that InitFlags itself is free of global side-effects.

@mtaufen
Copy link
Contributor

mtaufen commented May 7, 2019

Former fix: #77562

@vincepri
Copy link
Member Author

vincepri commented May 7, 2019

I'll defer to @liggitt and @dims on path forward, happy to put in some time for a fix if needed

@dims
Copy link
Member

dims commented May 8, 2019

@mtaufen thanks!

@vincepri looks like @mtaufen has filed the fix for "reverting the Kubelet code", can you please do the other one? " register each klog flag individually " Thanks!

@mtaufen
Copy link
Contributor

mtaufen commented May 8, 2019

@vincepri FYI reverting the Kubelet code == registering each klog flag individually. The other one was "fix klog so that InitFlags itself is free of global side-effects."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/apiserver area/cloudprovider area/code-generation area/dependency Issues or PRs related to dependency changes area/kubelet cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/cli Categorizes an issue or PR as relevant to SIG CLI. sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. sig/node Categorizes an issue or PR as relevant to SIG Node. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants