bhouse-nexthop opened a new pull request, #14769: URL: https://github.com/apache/cloudstack/pull/14769
### Description Fixes #14768 Nodes join a CKS cluster with a never-expiring bootstrap token derived from the cluster UUID, and with `--discovery-token-unsafe-skip-ca-verification`. This gives every join a fresh, short-lived token and pins the cluster CA. | step | how | |---|---| | create | CloudStack generates the cluster CA, a random bootstrap token and a random HA certificate key. The token TTL is the start timeout | | create, CA | copied to the first control node over SSH, not put in userdata. `kubeadm init` waits for it. Every other node joins with `--discovery-token-ca-cert-hash sha256:<hash>` | | create, cleanup | once all nodes are Ready, the token and the `kubeadm-certs` secret are deleted | | scale-up, add-node | `kubeadm token create --ttl <timeout> --print-join-command` on the control node gives a new token and the CA hash, so clusters created before this change keep scaling. The output is parsed strictly (token and hash formats) before it goes into userdata. The token is deleted afterwards, and also when an add-node fails before any node was given it | Not done here: deleting the old `<forever>` UUID token on existing clusters. That is a one-off migration step. ### Types of changes - [x] Bug fix (non-breaking change which fixes an issue) ### Feature/Enhancement Scale or Bug Severity #### Bug Severity - [x] Major ### How Has This Been Tested? Unit tests: `KubernetesCluster*Test` in the plugin pass, including the new token, certificate-key, CA-hash, join-command-parsing and token-delete tests. Lab: a nested KVM lab (3 hosts, Ceph RBD). It runs a main (24.0.0-SNAPSHOT) build with this commit picked on top, so it has not been run on a 4.22 build. Kubernetes v1.33.13, plus v1.32.5 for the old cluster. | case | joins | `kubeadm token list` afterwards | |---|---|---| | create, 1 control + 2 workers | workers: `--discovery-token-ca-cert-hash sha256:…`, which matches the hash of `/etc/kubernetes/pki/ca.crt`; no unsafe flag in any node's userdata | no bootstrap token; `kubeadm-certs` deleted | | create, 3 control + 1 worker (HA) | `kubeadm init --token-ttl 3600s … --certificate-key <random>`; both control-plane joins and the worker join pin the same CA hash | no bootstrap token; `kubeadm-certs` deleted | | scale-up +1 worker (single control and HA) | new node pins the CA hash | the scale token was deleted | | add-node, Ubuntu 24.04 VM | pins the CA hash | the add-node token was deleted | | add-node that fails validation | – | no token left (an earlier revision of this change left a 59m token here) | | cluster created by the old packages, scaled after the upgrade | old node: unsafe flag (as created); new node: `--discovery-token-ca-cert-hash` | only the old `<forever>` token remains, as before | The only entry that remains is kubeadm's own "Proxy for managing TTL for the kubeadm-certs secret". It has no usages, so it cannot be used to join, and it expires after 2h. #### How did you try to break this feature and the system with this change? - Scaled a cluster that was created by the old packages. - Ran add-node with a VM that fails validation, then checked `kubeadm token list`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
