Skip to content

Commit dc56658

Browse files
committed
feat(kubernetes): tie kubevirt-csi's VMI hotplug fallback to the gate
The right value of --enable-vmi-hotplug-fallback is decided by the KubeVirt CR in packages/system/kubevirt, not by the tenant: it must stay true while that CR enables HotplugVolumes and turn false in the same change that drops the gate. A note beside the gate in the CR points at the controller Deployment, and a helm-unittest pins the flag off the rendered args. The chart relies on the driver default instead of rendering =true. The driver image is stamped only at release preparation, so between releases the chart on main runs the previous release's binary, which does not know the flag, and Go's flag package exits on an unknown one: rendering the default would crash-loop the controller for no effect. Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <[email protected]>
1 parent a54e821 commit dc56658

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
suite: KubeVirt CSI controller VMI hotplug fallback
2+
3+
templates:
4+
- templates/csi/deploy.yaml
5+
6+
values:
7+
- values/common.yaml
8+
9+
release:
10+
name: test-k8s
11+
namespace: tenant-test
12+
13+
tests:
14+
# The driver defaults the flag to true, which is what the KubeVirt CR needs
15+
# while it enables HotplugVolumes. Rendering it anyway would crash a driver
16+
# image built before the flag existed: Go's flag package exits on an
17+
# unknown flag. This test does not read that CR; the two change together.
18+
- it: leaves the VMI hotplug fallback at the driver default while the KubeVirt CR enables HotplugVolumes
19+
documentSelector:
20+
path: kind
21+
value: Deployment
22+
asserts:
23+
- equal:
24+
path: spec.template.spec.containers[0].name
25+
value: csi-driver
26+
- notContains:
27+
path: spec.template.spec.containers[0].args
28+
content: "--enable-vmi-hotplug-fallback"
29+
- notContains:
30+
path: spec.template.spec.containers[0].args
31+
content: "--enable-vmi-hotplug-fallback=true"
32+
- notContains:
33+
path: spec.template.spec.containers[0].args
34+
content: "--enable-vmi-hotplug-fallback=false"

‎packages/system/kubevirt/templates/kubevirt-cr.yaml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ spec:
101101
# HotplugVolumes: deprecated in 1.9, replaced by DeclarativeHotplugVolumes.
102102
# Kept because virt-api accepts kubevirt-csi's VMI-level removevolume on a
103103
# VM-owned VMI only while it is on — which also keeps the replacement inert.
104+
# Dropping it means setting --enable-vmi-hotplug-fallback=false in
105+
# packages/apps/kubernetes/templates/csi/deploy.yaml in the same change.
104106
- HotplugVolumes
105107
- ExpandDisks
106108
- LiveMigration

0 commit comments

Comments
 (0)