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

Allow to distinguish legacy CP without ETCD management via annotation #453

Merged

Conversation

Danil-Grigorev
Copy link
Contributor

@Danil-Grigorev Danil-Grigorev commented Oct 4, 2024

What this PR does / why we need it:

This change allows to disable ETCD certificate management and provisioning with CAPI generated certificates for legacy control planes via controlplane.cluster.x-k8s.io/legacy annotation.

This annotation is meant to be set on RKE2 CP, upgraded from 0.2.z to version 0.3+. When the child cluster does not have cluster-etcd secret created, and the <cluster-name>-etcd secret in the management cluster does not contain the external cluster.x-k8s.io/purpose label, then this cluster requires the annotation to be set.

This would ensure that automatically generated ETCD certificates by CAPI will not be used for new ETCD replicas in provisioned nodes, replacing existing set and creating 2 separate etcd groups.

This change is a followup to #449

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Special notes for your reviewer:

Checklist:

  • squashed commits into logical changes
  • includes documentation
  • adds unit tests
  • adds or updates e2e tests

@Danil-Grigorev Danil-Grigorev requested a review from a team as a code owner October 4, 2024 06:57
@Danil-Grigorev
Copy link
Contributor Author

Danil-Grigorev commented Oct 4, 2024

To perform certificate rotation https://cluster-api.sigs.k8s.io/tasks/certs/using-custom-certificates guide can be used.

In RKE2 case that would translate into requirement to collect certificates from the node filesystem, located under /var/lib/rancher/rke2/server/tls/etcd into appropriate secrets on the management cluster - https://docs.rke2.io/security/certificates?_highlight=cer#using-custom-ca-certificates

In case of ETCD, the server-ca.crt and server-ca.key should be stored in the secret under tls.crt and tls.key on the management cluster inside the <cluster-name>-etcd secret. In addition to kubeadm process, RKE2 requires to provide peer-ca set, which should be stored in the <cluster-name>-peer-etcd secret.

Performing these steps manually should convert cluster from legacy to regular, after which the annotation can be removed from the RKE2 CP object.

Implementing rancher/turtles#370 will allow to perform this operation automatically.

@Danil-Grigorev
Copy link
Contributor Author

Danil-Grigorev commented Oct 7, 2024

After some testing, it seems that upgrade from 0.2.7 to latest is safe without this change. A set of certificates is only passed on bootstrap to the nodes in case of ControlPlaneInitialized condition not being true on the cluster, so the pre-GA clusters should be safe, even with a different set of certificates stored in <cluster-name>-<purpose> secrets.

But this change is needed to allow scaling down of nodes, since CA set on management cluster which will be created, will not be equal to provisioned one, so the client will not be able to connect.

@Danil-Grigorev Danil-Grigorev changed the title [WIP] Allow to distinguish legacy CP without ETCD management via annotation Allow to distinguish legacy CP without ETCD management via annotation Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants