Repository navigation
CKS: don't fail when a node still has an ISO attached - #14637
bhouse-nexthop wants to merge 3 commits into
Conversation
attachIsoKubernetesVMs attaches the binaries ISO to every node before an upgrade, a scale-up or a start, and relied on the attach replacing whatever ISO the node had. Since an Instance can have several CD-ROMs, attachIso refuses an ISO that is already attached, and any ISO beyond the number of CD-ROMs, one by default. A node left holding the binaries ISO by an operation that did not finish, for example because the management server stopped, then made every later operation fail before it started. Leave the binaries ISO in place if the node has it already, and detach any other ISO from the node first, as the attach used to replace it. Signed-off-by: Brad House <bhouse@nexthop.ai>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #14637 +/- ##
============================================
+ Coverage 20.78% 20.93% +0.15%
+ Complexity 21927 21155 -772
============================================
Files 6496 6057 -439
Lines 591657 549571 -42086
Branches 72592 73482 +890
============================================
- Hits 122955 115034 -7921
+ Misses 455356 421081 -34275
- Partials 13346 13456 +110
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:
|
Test report: CKS upgrade with the binaries ISO already attached to a nodeSummary: with the upgrade's binaries ISO already attached to the control node, as an operation that didn't finish would leave it, Environment
Method
Results
Result: pass. A node already holding the binaries ISO no longer blocks the upgrade. The ISO is kept on that node for the upgrade, and detached from every node at the end, as for a node that had none. Not covered
|
attachIsoKubernetesVMs fetched each node from UserVmDao just to read its primary ISO, even though the UserVm objects it iterates already expose getIsoId() and are loaded from UserVmDao (or freshly provisioned). Read the ISO directly from the object, removing a redundant query and the now unnecessary null guard.
attachIsoKubernetesVMs only detached the primary ISO. With more than one CD-ROM a node could keep a non-binaries ISO in an extra slot, or keep both the binaries ISO in an extra slot and another ISO in the primary slot. The later detachIsoKubernetesVMs calls detachIso with a null ISO, which fails when more than one ISO is attached, leaving the binaries ISO mounted. Look at every ISO attached to the node, detach all except the binaries ISO, and attach the binaries ISO only when it is not already present on any CD-ROM.
winterhazel
left a comment
There was a problem hiding this comment.
@bhouse-nexthop the code and the testing looks good. I have pushed 2 commits to address a bug and a small refactoring, could you review them? You're free to revert them if you think they're not required.
|
@blueorangutan package |
|
Trying again... @blueorangutan package |
|
@winterhazel a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress. |
|
Thanks @winterhazel, both look good to me, I'm keeping them.
The |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 20207 |
|
Tested again at the current head, which adds the two commits pushed during review (detaching any non-binaries ISO before attaching the binaries ISO, and reusing the node ISO). Same kind of lab as my earlier report: a KVM lab running a main (24.0) build that includes this change, Ceph RBD primary storage, a CKS cluster on Kubernetes 1.34.7 with 1 control and 2 worker nodes. During a scale-up the binaries ISO is only attached to the new VMs, so the case "a node holds some other ISO" was set up through
Result: 13 of 13 checks passed (gates included).
The add itself then failed later, at node validation: that template is a Cluster API image, not a CKS node image, so this says nothing about this PR. The cluster stayed Running and the VM was destroyed afterwards. Not tested at this head: an upgrade with the binaries ISO already attached (my earlier report covers that path, with the first commit). |
Description
Since #13101 (multiple CD-ROMs per VM),
attachIsoon main refuses an ISO that is already attached, and any ISO beyond the number of CD-ROMs, one by default.KubernetesClusterActionWorker.attachIsoKubernetesVMsrelied on the attach replacing whatever ISO a node had. So a node left holding the binaries ISO by an operation that didn't finish, for example because the management server stopped, made every later upgrade, scale-up or start fail before it started, with "The specified ISO is already attached to this Instance."Fixes #14630
For each node,
attachIsoKubernetesVMsnow reads the VM again and:4.22 is not affected, so this is for main only.
Types of changes
Feature/Enhancement Scale or Bug Severity
Bug Severity
How Has This Been Tested?
New unit tests in
KubernetesClusterActionWorkerIsoTest:Without the fix, the last three fail.
mvn -pl plugins/integrations/kubernetes-service -am test -Dtest='KubernetesClusterActionWorker*Test'passes.On a test environment running main, an upgrade failed as described in #14630 while both nodes still held the binaries ISO, and ran once the ISO was detached from both by hand. This PR itself has not been run against a live cluster.
How did you try to break this feature and the system with this change?
detachIsoKubernetesVMsis unchanged.