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
Improve error message when user provide invalid certificate key #77768
Conversation
/assign @fabriziopandini |
nice |
@@ -89,7 +89,8 @@ func UploadCerts(client clientset.Interface, cfg *kubeadmapi.InitConfiguration, | |||
fmt.Printf("[upload-certs] Storing the certificates in Secret %q in the %q Namespace\n", kubeadmconstants.KubeadmCertsSecret, metav1.NamespaceSystem) | |||
decodedKey, err := hex.DecodeString(key) | |||
if err != nil { | |||
return err | |||
klog.Error("[upload-certs] Failed decoding certificate key.") | |||
return errors.Wrap(err, "error decoding certificate key") |
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.
isn't this sufficient?
return errors.Wrap(err, "error decoding certificate key")
the error should bubble up and be printed.
i think with this change it will be printed 2times - once with klog once from cobra.
@@ -215,6 +216,7 @@ func DownloadCerts(client clientset.Interface, cfg *kubeadmapi.InitConfiguration | |||
|
|||
decodedKey, err := hex.DecodeString(key) | |||
if err != nil { | |||
klog.Error("[download-certs] Failed decoding certificate key.") | |||
return errors.Wrap(err, "error decoding certificate key") |
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.
similar here?
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.
@yagonobre many thanks for the quick fix, really appreciated!
Please address @neolit123 comments an then this one can be approved for me
@neolit123 @fabriziopandini updated! |
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
/lgm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: neolit123, yagonobre 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 |
/lgtm |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Improve error message, more details on https://kubernetes.slack.com/archives/C2P1JHS2E/p1557408526235800
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
/priority backlog