Closed akhilerm closed 2 months ago
There are no sig labels on this issue. Please add an appropriate label by using one of the following commands:
/sig <group-name>
/wg <group-name>
/committee <group-name>
Please see the group list for a listing of the SIGs, working groups, and committees available.
This issue is currently awaiting triage.
If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted
label and provide further guidance.
The triage/accepted
label can be added by org members by writing /triage accepted
in a comment.
@neolit123 Wanted to know if this is relevant enough to be fixed in the kubeadm side, or has more to do with how the flags are parsed.
/transfer kubeadm
Executing ./kubeadm join phase control-plane-join update-status --config=/run/kubeadm/kubeadm-join-config.yaml should also give the unknown command error
i don't know if that is an easy fix. PRs welcome.
This seems to a general issue with many subcommands.
[root@node ~]# kubeadm config images list --v1
unknown flag: --v1
To see the stack trace of this error execute with --v=5 or higher
[root@node ~]# kubeadm config images list2 --v1
unknown flag: --v1
To see the stack trace of this error execute with --v=5 or higher
/retitle wrong error message when using kubeadm with unknown phase sub commands
did some investigation and this seems to be standard cobra behavior. flags are processed before sub-commands and arguments of a parent command.
to illustrate:
$ kubeadm init foo --bar
unknown flag: --bar
To see the stack trace of this error execute with --v=5 or higher
$ kubeadm init foo
unknown command "foo" for "kubeadm init"
To see the stack trace of this error execute with --v=5 or higher
the unknown flag --bar is processed first and if the invalid flag is removed the unknown command is then detected. i.e. this is not something caused by the kubeadm phase logic, which is a bit complicated.
i think it's fine for us to acknowledge this issue, but i don't think we need to make any fixes for it in kubeadm or cobra.
something that we should probably fix is the following:
$ kubeadm init phase foo && echo ok
...
ok
i.e. the unknown command returns exit code 0.
i will send a PR for that.
What happened?
When executing the below
kubeadm join
commandit gives the
unknown flag
error even though its a subcommand error.What did you expect to happen?
Executing
./kubeadm join phase control-plane-join update-status --config=/run/kubeadm/kubeadm-join-config.yaml
should also give theunknown command
errorHow can we reproduce it (as minimally and precisely as possible)?
make WHAT=cmd/kubeadm
_output/bin/kubeadm join phase control-plain-join update-status --config=/run/kubeadm/kubeadm-join-config.yaml
Anything else we need to know?
update-status
was removed in https://github.com/kubernetes/kubernetes/pull/124373Kubernetes version
Cloud provider
OS version
Install tools
Container runtime (CRI) and version (if applicable)
Related plugins (CNI, CSI, ...) and versions (if applicable)