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

Output missing cert or key name in DownloadCerts #76636

Merged
merged 1 commit into from Apr 16, 2019

Conversation

@mdaniel
Copy link
Contributor

commented Apr 16, 2019

Otherwise the user does not know what key kubeadm is expecting, which makes troubleshooting harder. See the writeup in 1507 for the reasoning behind this change.

What type of PR is this?

/kind bug

What this PR does / why we need it:

It improves the error message when kubeadm is searching for a key in the kubeadm-certs Secret but does not find it.

Which issue(s) this PR fixes:

Fixes kubernetes/kubeadm#1507

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Kubeadm will now include the missing certificate key if it is unable to find an expected key during `kubeadm join` when used with the `--experimental-control-plane` flow
@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

commented Apr 16, 2019

Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA.

It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.


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. I understand the commands that are listed here.

@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

commented Apr 16, 2019

Hi @mdaniel. 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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@yagonobre
Copy link
Member

left a comment

Thanks @mdaniel
Can you sign the CLA?
/ok-to-test
/priority important-soon

@@ -231,7 +231,7 @@ func DownloadCerts(client clientset.Interface, cfg *kubeadmapi.InitConfiguration
for certOrKeyName, certOrKeyPath := range certsToTransfer(cfg) {
certOrKeyData, found := secretData[certOrKeyNameToSecretName(certOrKeyName)]
if !found {
return errors.New("couldn't find required certificate or key in Secret")
return errors.Errorf("couldn't find required certificate or key in Secret[name=%s][path=%s]", certOrKeyName, certOrKeyPath)

This comment has been minimized.

Copy link
@yagonobre

yagonobre Apr 16, 2019

Member

Can you put a space between Secret and [name=%s]?

@yagonobre

This comment has been minimized.

Copy link
Member

commented Apr 16, 2019

/retest

@fabriziopandini
Copy link
Member

left a comment

@mdaniel thanks! Welcome!
I'm always happy to see first time contributor choosing kubeadm for their work. We looking forward for more of your contributions; please consider also to join the kubeadm office hours meetings.
/approve
I left final lgtm to @yagonobre / other reviewers

@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

commented Apr 16, 2019

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fabriziopandini, mdaniel

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@yagonobre

This comment has been minimized.

Copy link
Member

commented Apr 16, 2019

@mdaniel please squash your commits and we can get it merged, also what do you think about print the cert on certOrKeyPath/certOrKeyName format? So we can have something like /etc/kubernetes/pki/ca.crt on logs.

@mdaniel mdaniel force-pushed the mdaniel:kubeadm-issue-1507 branch from 787e48c to 024352c Apr 16, 2019

@mdaniel

This comment has been minimized.

Copy link
Contributor Author

commented Apr 16, 2019

@fabriziopandini thank you for shepherding this change through so quickly; that's in stark contrast to a lot of my other open source experiences. I am sincerely grateful for your help.

what do you think about print the cert on certOrKeyPath/certOrKeyName format? So we can have something like /etc/kubernetes/pki/ca.crt on logs.

I am a big fan of attaching labels to the text, rather than an implied formatting, but if you feel that another format would be more in alignment with what users would expect, or there is precedent for doing that elsewhere in kubeadm, I would defer to the precedent

@neolit123

This comment has been minimized.

Copy link
Member

commented Apr 16, 2019

@yagonobre

error execution phase control-plane-prepare/download-certs: error downloading certs: couldn't find required certificate or key in Secret[name=external-etcd.crt][path=/etc/kubernetes/pki/apiserver-etcd-client.crt]

the path already includes the file name.
but let's change the formatting a little to be more consistent with our existing errors.

@mdaniel could you please change this to:

return errors.Errorf("the Secret does not include the required certificate or key - name: %s, path: %s", certOrKeyName, certOrKeyPath)

/hold

Output missing cert or key name in DownloadCerts
Otherwise the user does not know what key `kubeadm` is expecting, which makes troubleshooting harder

@mdaniel mdaniel force-pushed the mdaniel:kubeadm-issue-1507 branch from 024352c to b081486 Apr 16, 2019

@fabriziopandini

This comment has been minimized.

Copy link
Member

commented Apr 16, 2019

/test pull-kubernetes-integration

@neolit123

This comment has been minimized.

Copy link
Member

commented Apr 16, 2019

thanks for the update.
/lgtm
/hold cancel

@k8s-ci-robot k8s-ci-robot added lgtm and removed do-not-merge/hold labels Apr 16, 2019

@k8s-ci-robot k8s-ci-robot merged commit 9746a40 into kubernetes:master Apr 16, 2019

20 checks passed

cla/linuxfoundation mdaniel authorized
Details
pull-kubernetes-bazel-build Job succeeded.
Details
pull-kubernetes-bazel-test Job succeeded.
Details
pull-kubernetes-conformance-image-test Skipped.
pull-kubernetes-cross Skipped.
pull-kubernetes-dependencies Job succeeded.
Details
pull-kubernetes-e2e-gce Job succeeded.
Details
pull-kubernetes-e2e-gce-100-performance Job succeeded.
Details
pull-kubernetes-e2e-gce-csi-serial Skipped.
pull-kubernetes-e2e-gce-device-plugin-gpu Job succeeded.
Details
pull-kubernetes-e2e-gce-storage-slow Skipped.
pull-kubernetes-godeps Skipped.
pull-kubernetes-integration Job succeeded.
Details
pull-kubernetes-kubemark-e2e-gce-big Job succeeded.
Details
pull-kubernetes-local-e2e Skipped.
pull-kubernetes-node-e2e Job succeeded.
Details
pull-kubernetes-typecheck Job succeeded.
Details
pull-kubernetes-verify Job succeeded.
Details
pull-publishing-bot-validate Skipped.
tide In merge pool.
Details

@mdaniel mdaniel deleted the mdaniel:kubeadm-issue-1507 branch Apr 16, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.