bhouse-nexthop opened a new pull request, #14779:
URL: https://github.com/apache/cloudstack/pull/14779

   ### Description
   
   When a CKS node template already has Kubernetes at the cluster's version 
(for example a kubernetes-sigs/image-builder template passed in 
`nodetemplates`), the node userdata now uses that install instead of copying 
the ISO's binaries over it.
   
   - The cluster's Kubernetes version is passed to the userdata as `{{ 
k8s.version }}`.
   - A node counts as prebuilt when all of these hold:
     - kubeadm on PATH, and the kubelet and kubectl next to it, are at that 
version;
     - the kubelet unit runs that kubelet with kubeadm's drop-in;
     - `/opt/cni/bin` and crictl are present.
   - On a prebuilt node:
     - kubeadm, kubelet and kubectl are symlinked into `/opt/bin`, because the 
management server runs `/opt/bin/kubectl` and upgrades copy into `/opt/bin`;
     - the CNI, crictl and Kubernetes binary copy and the kubelet unit are 
skipped;
     - ISO image tarballs are skipped only for kubeadm's own images that 
containerd already has. CNI, dashboard, CCM, CSI and autoscaler images are 
still imported, so air-gapped zones keep working.
   - `/opt/bin` comes first on PATH in deploy-kube-system and 
upgrade-kubernetes.sh. On a template at a different version (for example a 
scale after an upgrade), kubeadm then uses the ISO's binaries.
   - A node without a matching install takes the current path unchanged.
   
   Fixes #14778
   
   ### Types of changes
   
   - [ ] Breaking change (fix or feature that would cause existing 
functionality to change)
   - [ ] New feature (non-breaking change which adds functionality)
   - [x] Bug fix (non-breaking change which fixes an issue)
   - [x] Enhancement (improves an existing feature and functionality)
   - [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
   
   ### How Has This Been Tested?
   
   Unit test: `KubernetesClusterActionWorkerTest` checks that the worker node 
config gets `{{ k8s.version }}` filled in.
   
   KVM lab, Ubuntu 24.04 image-builder template (v1.32.3) set as the CONTROL 
and WORKER node template, with a v1.32.3 CKS ISO:
   
   | Check | Result |
   |---|---|
   | Create 1 control + 1 worker | Running in about 5 min |
   | setup-kube-system log on each node | `Kubernetes v1.32.3 is already 
installed in /usr/bin, not installing binaries from /mnt/k8sdisk/` |
   | `/opt/bin` | kubeadm, kubelet and kubectl are symlinks to `/usr/bin` |
   | kubeadm images | all 7 already in containerd from the template, so not 
imported |
   | Nodes / pods | all Ready / 13 Running |
   | Scale to 2 workers | new worker takes the same prebuilt path and goes 
Ready |
   
   Note for anyone testing with an image-builder template: CKS nodes are passed 
their boot arguments through the QEMU guest agent (pre-existing behaviour, not 
changed here). Without `qemu-guest-agent` in the template, each node start 
waits about 50 minutes in patch.sh before it continues. The lab template had 
the agent added.
   


-- 
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]

Reply via email to