Repository navigation
CKS: apply the provider and CSI driver of the new version on upgrade - #14923
bhouse-nexthop wants to merge 1 commit into
Conversation
upgradeKubernetesCluster copies the provider manifest of the new binaries ISO to the nodes, and calls deployProvider() before each node, but deploy-provider exits as soon as a cloud-controller-manager pod exists. The CSI driver manifests of the ISO are not copied at all. So an upgraded cluster keeps the provider and CSI driver it was created with, whatever the ISO of the new version holds. The CNI and dashboard manifests are already applied by the upgrade script. - upgrade-kubernetes.sh copies the CSI driver manifests of the ISO to /opt/csi, as the control node setup does at create, with the same fix for the document separator of the v3.0.0 manifest. - Once every node is upgraded, and before the version of the cluster is recorded, kubectl apply the provider (but on a shared network) and the CSI driver (when the cluster has it) on the control node, and wait for their rollout. The snapshot CRDs are shared, so only created when missing. Each is tried cloud.kubernetes.cluster.upgrade.retries + 1 times, within the upgrade timeout. If it still fails, the upgrade fails, so that upgrading to the same version again applies them again. Applying an unchanged manifest changes nothing, so a cluster whose ISO has the same add-ons sees no restart. Signed-off-by: Brad House <bhouse@nexthop.ai>
|
Lab test on KVM (Ubuntu 24.04), with this change applied to a 4.22.1 based build. A cluster with 1 control node, 2 workers and the CSI driver, on an isolated network, upgraded from a 1.33.1 binaries ISO to a 1.34.7 ISO. The provider manifest of the 1.34.7 ISO runs the Without this change (baseline): the upgrade succeeds and copies the new With this change:
The upgrade took 495 s, against 437 s without this change. The difference is mostly the rollout of the new |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 4.22 #14923 +/- ##
=========================================
Coverage 18.34% 18.34%
- Complexity 16670 16684 +14
=========================================
Files 5939 5939
Lines 537814 537858 +44
Branches 65937 65944 +7
=========================================
+ Hits 98637 98686 +49
+ Misses 427953 427944 -9
- Partials 11224 11228 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Description
Upgrading a CKS cluster left it on the CloudStack Kubernetes provider and CSI driver it was created with, whatever the binaries ISO of the new version holds.
upgrade-kubernetes.shcopies the provider manifest of the ISO to the nodes and the worker callsdeployProvider(), butdeploy-providerexits as soon as acloud-controller-managerpod exists. The CSI driver manifests of the ISO were not copied at all. The CNI and dashboard manifests are already applied by the upgrade script, so only these two were left behind.This PR:
/opt/csiinupgrade-kubernetes.sh, as the control node setup does at create, with the same fix for the document separator of the v3.0.0 manifest.kubectl applyon the control node for:deployProvider()), then waits for thecloud-controller-managerrollout;cloud.kubernetes.cluster.upgrade.retries+ 1 times within the upgrade timeout. If it still fails, the upgrade fails and the version is not recorded, so upgrading to the same version again applies them again.The commands run from the management server rather than from the node scripts, as clusters created by older releases keep old copies of those scripts.
They are applied after all the nodes, so every node already has the images of the new ISO when the new pods are scheduled. Applying an unchanged manifest changes nothing, so a cluster whose new ISO has the same add-ons sees no restart. Fields that CKS does not set in these manifests are kept, as
kubectl applyis client side.No schema change, no new API parameter or setting.
Fixes #14922
Types of changes
Feature/Enhancement Scale or Bug Severity
Bug Severity
How Has This Been Tested?
Unit tests in
KubernetesClusterUpgradeWorkerTest: both add-ons applied; the provider skipped on a shared network and the CSI driver when the cluster does not have it; retries then the error; an exception without a message reported as a failure; no retry once the upgrade timeout has passed; success after a failed try.A lab report on a KVM zone follows in a comment.
How did you try to break this feature and the system with this change?