-
Notifications
You must be signed in to change notification settings - Fork 40k
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
Hyperkube: don't parse args for all servers #22737
Conversation
cc @kubernetes/kubectl |
@jbeda Do you have time to review this? |
I can get it done on Thursday. Out all day tomorrow at a thing.
|
ref #24088 |
if err != nil || hk.helpFlagVal { | ||
if err != nil { | ||
hk.Printf("Error: %v\n\n", err) | ||
if !s.NoParse { |
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.
Double negative here is a little confusing. Might be better to invert this bool to be "ParseFlags".
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
7c8ecc1
to
8711547
Compare
Updated |
I took a different approach to this problem in #25512 , and instead passing |
\cc @bgrant0607 @jbeda |
@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. |
GCE e2e build/test passed for commit 8711547. |
Removing LGTM while we figure out relationship to #25512 |
Closing this in favor of #25512 |
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:
Commands with disabled arg parsing: