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

add command to create new bootstrap kubeconfig for kubelet #1458

Merged
merged 1 commit into from Jun 14, 2023

Conversation

deads2k
Copy link
Contributor

@deads2k deads2k commented Jun 13, 2023

builds on #1452

oc config new-kubelet-bootstrap-kubeconfig > ~/Downloads/bootstrap.kubeconfig

/assign @rphillips

@openshift-ci openshift-ci bot requested review from ardaguclu and mfojtik June 13, 2023 19:33
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 13, 2023
return fmt.Errorf("unable to get the CA bundle from the cluster: %w", err)
}

newConfig := clientcmdapi.Config{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably worth adding a comment here like

// keep in sync with https://github.com/openshift/machine-config-operator/blob/3d84f653e08d760d446442ddc80c3da21d8d7e59/pkg/server/cluster_server.go#L167

return fmt.Errorf("unable to serialize new kubeconfig: %w", err)
}

fmt.Fprintln(r.Out, string(newKubeletBootstrapConfig))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Under what scenario does the admin need to see this directly instead of having us directly rotate the file on the node?

I'm OK creating two separate primitives here to be clear, I just don't quite understand why we are instead of having a more opinionated wired-together flow.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Under what scenario does the admin need to see this directly instead of having us directly rotate the file on the node?

I'm OK creating two separate primitives here to be clear, I just don't quite understand why we are instead of having a more opinionated wired-together flow.

if our rotation command fails, having this available allows us to do the hard part (content of the file), while allowing any distribution method. Perhaps our "put it on the nodes" fails and we need to re-run it. Or perhaps its doomed in some scenario and they need to SSH it. This gives us those options.

)

const (
adminKubeconfigClientCAConfigMap = "admin-kubeconfig-client-ca"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth a comment like

// adminKubeconfigClientCAConfigMap is described in https://github.com/openshift/api/blob/master/tls/docs/kube-apiserver%20Client%20Certificates/README.md#kube-apiserver-admin-kubeconfig-client-ca

perhaps?

const (
adminKubeconfigClientCAConfigMap = "admin-kubeconfig-client-ca"

tenYears = 24 * time.Hour * 365 * 10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point we'll want to centralize our many "tenYears" constants...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point we'll want to centralize our many "tenYears" constants...

Just in case 10 years changes in duration some day? ;)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean more that I can imagine us wanting to have a more consistent policy for certs, e.g. something much closer to Let's Encrypt expiry at e.g. 3 months to ensure that rotation really works. To do that we'd want to centralize these currently disparate constants.

Just a side comment, not saying we need to change anything now.

} else if err != nil {
return fmt.Errorf("unable to read configmap %w", err)
}
caBundle, err := combineCABundles(existingConfigMap.Data["ca-bundle.crt"], string(signerCertBytes))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is ensuring we continue trust the old keys for now? Worth a comment if so.

@cgwalters
Copy link
Member

None of my comments are blocking to be clear.

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 13, 2023
@deads2k deads2k force-pushed the kubeconfig-kubelet-bootstrap branch from 49ed665 to 83d4101 Compare June 13, 2023 22:45
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 13, 2023
@deads2k
Copy link
Contributor Author

deads2k commented Jun 13, 2023

Comments fixed, though I decline to be worried about 10y changing durations on us over time :)

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 14, 2023

@deads2k: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-aws-ovn-serial 83d4101 link true /test e2e-aws-ovn-serial

Full PR test history. Your PR dashboard.

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.

@deads2k deads2k added the jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. label Jun 14, 2023
@stlaz
Copy link
Member

stlaz commented Jun 14, 2023

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jun 14, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 14, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: deads2k, stlaz

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

@deads2k
Copy link
Contributor Author

deads2k commented Jun 14, 2023

bringing in for a complete set to match directions.

@deads2k deads2k merged commit a76b711 into openshift:master Jun 14, 2023
10 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants