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
kubeadm/kubeconfig:validate flag --config to make sure it is not empty #105649
kubeadm/kubeconfig:validate flag --config to make sure it is not empty #105649
Conversation
Hi @navist2020. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
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.
given flag is required the change seems fine.
added a couple of minor suggestions.
what about client-name
- does it error out on empty? it should, if not.
cmd/kubeadm/app/cmd/kubeconfig.go
Outdated
@@ -17,6 +17,7 @@ limitations under the License. | |||
package cmd | |||
|
|||
import ( | |||
"errors" |
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.
instead, please import github.com/pkg/errors
bellow the cobra
import.
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.
Run ./hack/update-gofmt.sh
Maybe github.com/pkg/errors
should import before "github.com/spf13/cobra
.
cmd/kubeadm/app/cmd/kubeconfig.go
Outdated
if cfgPath == "" { | ||
return errors.New("Kubeadm configuration path cannot be empty.") | ||
} |
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.
if cfgPath == "" { | |
return errors.New("Kubeadm configuration path cannot be empty.") | |
} | |
if len(cfgPath) == 0 { | |
return errors.New("the kubeadm configuration path cannot be empty") | |
} |
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.
Done.
And if client-name
is empty, it can return an error
failure while creating client certificate: unable to sign certificate: must specify a CommonName
To see the stack trace of this error execute with --v=5 or higher
/ok-to-test |
/retest |
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.
thanks
/lgtm
/approve
/release-note-edit
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: navist2020, neolit123 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 |
What type of PR is this?
/kind bug
What this PR does / why we need it:
Command
kubeadm kubeconfig user
.Falgs client-name and config are set to required.
kubernetes/cmd/kubeadm/app/cmd/kubeconfig.go
Lines 113 to 114 in e054181
But when I use this command like this:
It still works properly. If we want the user to pass this flag correctly, we should not allow it to be empty.
Or we can set it as not required.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: