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

Hyperkube: don't parse args for all servers #22737

Conversation

ingvagabund
Copy link
Contributor

Kubectl consists of many subcommands.
Each subcommand has its own way of setting flags.
Parsing of args of kubectl is not done under cmd/kubectl directory.
It is done inside of pkg/kubectl.
When kubectl is added to hyperkube as a server, its args are parsed when kubectl's flag are not yet defined.
So when running kubectl with any flag, the flag is not recognized.

This PR adds support for disabling the parsing inside of hyperkube when a server is created.

Commands with enabled arg parsing:

  • kube-apiserver
  • kube-controller-manager
  • kube-proxy
  • kube-scheduler
  • kubelet

Commands with disabled arg parsing:

  • kubectl

@k8s-github-robot k8s-github-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. needs-ok-to-merge labels Mar 9, 2016
@bgrant0607
Copy link
Member

cc @kubernetes/kubectl

@bgrant0607 bgrant0607 assigned jbeda and unassigned dchen1107 May 11, 2016
@bgrant0607
Copy link
Member

@jbeda Do you have time to review this?

@jbeda
Copy link
Contributor

jbeda commented May 11, 2016

I can get it done on Thursday. Out all day tomorrow at a thing.
On Tue, May 10, 2016 at 5:02 PM Brian Grant notifications@github.com
wrote:

@jbeda https://github.com/jbeda Do you have time to review this?


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#22737 (comment)

@bgrant0607 bgrant0607 added ok-to-merge release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed needs-ok-to-merge labels May 12, 2016
@bgrant0607
Copy link
Member

ref #24088

@bgrant0607
Copy link
Member

if err != nil || hk.helpFlagVal {
if err != nil {
hk.Printf("Error: %v\n\n", err)
if !s.NoParse {
Copy link
Contributor

Choose a reason for hiding this comment

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

Double negative here is a little confusing. Might be better to invert this bool to be "ParseFlags".

@jbeda
Copy link
Contributor

jbeda commented May 12, 2016

LG except for double negative with the bool. Do you mind inverting that?

Kubectl consists of many subcommands.
Each subcommand has its own way of setting flags.
Parsing of args of kubectl is not done under cmd/kubectl directory.
It is done inside of pkg/kubectl.
When kubectl is added to hyperkube as a server, its args are parsed when kubectl's flag are not yet defined.
So when running kubectl with any flag, the flag is not recognized.

This PR adds support for disabling the parsing inside of hyperkube when a server is created.

Commands with enabled arg parsing:
- kube-apiserver
- kube-controller-manager
- kube-proxy
- kube-scheduler
- kubelet

Commands with disabled arg parsing:
- kubectl
@ingvagabund ingvagabund force-pushed the hyperkube-dont-parse-args-of-all-commands branch from 7c8ecc1 to 8711547 Compare May 12, 2016 17:50
@ingvagabund
Copy link
Contributor Author

Updated

@jbeda jbeda added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 12, 2016
@colhom
Copy link

colhom commented May 12, 2016

I took a different approach to this problem in #25512 , and instead passing LocalFlags from the kubectl cobra command as the flagset for the kubectl server. This is consistent with the mechanism by which other servers declare their flags the the hyperkube server. This may be preferable to introducing additional conditional flag parsing behavior?

@colhom
Copy link

colhom commented May 12, 2016

\cc @bgrant0607 @jbeda

@jbeda
Copy link
Contributor

jbeda commented May 12, 2016

@colhom Still reviewing code (it's been a while) but I think that the parsing for cobra sub-commands is subtle enough it is okay to leave that to the "server" object to do. Making this optional makes sense.

Still reviewing your PR to grok all that is going on though.

@k8s-bot
Copy link

k8s-bot commented May 12, 2016

GCE e2e build/test passed for commit 8711547.

@jbeda jbeda removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 13, 2016
@jbeda
Copy link
Contributor

jbeda commented May 13, 2016

Removing LGTM while we figure out relationship to #25512

@jbeda
Copy link
Contributor

jbeda commented May 13, 2016

Closing this in favor of #25512

@jbeda jbeda closed this May 13, 2016
@ingvagabund ingvagabund deleted the hyperkube-dont-parse-args-of-all-commands branch May 19, 2016 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants