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

Fix missing glog flags for some commands which output flags in logical sections #70164

Closed
wants to merge 1 commit into from

Conversation

imjching
Copy link
Contributor

@imjching imjching commented Oct 24, 2018

What type of PR is this?
/kind bug

What this PR does / why we need it:
Some binaries (e.g. kube-apiserver, kube-controller-manager, cloud-controller-manager) tend to output flags in logical sections. This feature was introduced in #64517 and #67362. It seems like it does not consider glog-related flags. This PR includes these glog flags in the named section "misc".

The glog related flags are initialized in the init function (when we include the glog package).

flag.BoolVar(&logging.toStderr, "logtostderr", false, "log to standard error instead of files")
flag.BoolVar(&logging.alsoToStderr, "alsologtostderr", false, "log to standard error as well as files")
flag.Var(&logging.verbosity, "v", "log level for V logs")
flag.Var(&logging.stderrThreshold, "stderrthreshold", "logs at or above this threshold go to stderr")
flag.Var(&logging.vmodule, "vmodule", "comma-separated list of pattern=N settings for file-filtered logging")
flag.Var(&logging.traceLocation, "log_backtrace_at", "when logging hits line file:N, emit a stack trace")

Which issue(s) this PR fixes:
See #70145.

Special notes for your reviewer: I am not quite sure if we're planning to switch everything to logical sections. If yes, we might be able to abstract this so that we don't need to manually add glog commands in the misc section.

Does this PR introduce a user-facing change?:

Fix missing glog flags in kube-apiserver --help and *-controller-manager --help.

/sig cli
cc @sttts @stewart-yu

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. sig/cli Categorizes an issue or PR as relevant to SIG CLI. size/S Denotes a PR that changes 10-29 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-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Oct 24, 2018
@k8s-ci-robot k8s-ci-robot added area/apiserver sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. 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 Oct 24, 2018
Copy link
Contributor

@stewart-yu stewart-yu left a comment

Choose a reason for hiding this comment

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

I see that bug before, thanks for your PR 👍

  1. have you try in your local Env?
  2. more please refer to ``kube-scheduler kube-scheduler: output flags in logical sections #68054

BTW, I recommend split this PR into three part

Authorization: kubeoptions.NewBuiltInAuthorizationOptions(),
CloudProvider: kubeoptions.NewCloudProviderOptions(),
StorageSerialization: kubeoptions.NewStorageSerializationOptions(),
APIEnablement: genericoptions.NewAPIEnablementOptions(),

Copy link
Contributor

Choose a reason for hiding this comment

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

why change in here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just indentation issues: aligning those variables.

@stewart-yu
Copy link
Contributor

may be some bazel failed, but go head
/ok-to-test

@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Oct 24, 2018
@imjching
Copy link
Contributor Author

imjching commented Oct 24, 2018

@stewart-yu Yes, I have tried it in my local environment. It shows up right now.

e.g. ./_output/bin/cloud-controller-manager --help
screen shot 2018-10-24 at 12 17 02 am

That works too. Let's wait for the tests. If all is good, I will split the PR into 3 parts tomorrow.

@imjching
Copy link
Contributor Author

@stewart-yu I made a comment in your other PR.

It seems like with your other patch, we can just do the following

options.AddGlobalFlags(namedFlagSets.FlagSet("global"))

Ref: https://github.com/kubernetes/kubernetes/pull/68054/files#diff-f072139971e3329bef6da077a5a03aceR121

I guess we can merge this PR first (without splitting), wait until your other patch lands, and finally use the AddGlobalFlags function that you have just added? What are your thoughts on this?

@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Oct 24, 2018
@imjching
Copy link
Contributor Author

Okay, looks like there were issues with formatting. I just updated the commit. Will need to retest.

@stewart-yu
Copy link
Contributor

Golog flag seems not belong to Misc part

@imjching
Copy link
Contributor Author

/hold
I have broken this PR down into three individual PRs and placed glog flags in the "global" section. (See: #70204, #70205, and #70216)
cc @stewart-yu

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 25, 2018
@sttts
Copy link
Contributor

sttts commented Oct 25, 2018

/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 Oct 25, 2018
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: imjching, sttts
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: lavalamp

If they are not already assigned, you can assign the PR to them by writing /assign @lavalamp in a comment when ready.

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

@jennybuckley
Copy link

cc @cheftako @logicalhan

@@ -235,5 +236,7 @@ func (s *ServerRunOptions) Flags() (fss apiserverflag.NamedFlagSets) {
fs.StringVar(&s.ServiceAccountSigningKeyFile, "service-account-signing-key-file", s.ServiceAccountSigningKeyFile, ""+
"Path to the file that contains the current private key of the service account token issuer. The issuer will sign issued ID tokens with this private key. (Requires the 'TokenRequest' feature gate.)")

fs.AddGoFlagSet(goflag.CommandLine)
Copy link
Member

Choose a reason for hiding this comment

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

This seems a bit redundant as we are already doing it https://github.com/kubernetes/kubernetes/blob/master/cmd/kube-apiserver/apiserver.go#L47 for the stand-alone KAS binary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In #64517, we introduced logical sections, and with that, we no longer read from pflag.CommandLine for the list of flags. #68054 introduced some changes in apiserver/pkg/util/flag/. I'm waiting for that to be merged. See #70204. Sorry! I should probably close this PR since I have broken it down into three individual PRs.

@imjching imjching closed this Oct 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/apiserver cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. 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. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants