Skip to content

Commit 59d22f7

Browse files
fix(kubernetes): never auto-select the kubevirt alias as tenant default SC
The legacy "kubevirt" StorageClass alias was inserted into the candidate map before the default was chosen, so the sortAlpha fallback could pick it when propagated class names sort after "kubevirt" (e.g. nvme, ssd) and no configured/replicated class is present. That made the tenant default point at an infraStorageClass that may not exist on the infra cluster, leaving default PVCs Pending. Choose the default from the propagated set before adding the alias. Also quote the templated StorageClass name and infraStorageClassName in kubevirt-csi-node, and document the propagation upgrade caveat, render-time evaluation limitation, and allowRemoteVolumeAccess assumption in the kubernetes README. Signed-off-by: Myasnikov Daniil <[email protected]>
1 parent 61c3776 commit 59d22f7

3 files changed

Lines changed: 12 additions & 7 deletions

File tree

‎packages/apps/kubernetes/README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ See the reference for components utilized in this service:
8787

8888
- **`ephemeralStorage` renamed to `diskSize`** (v1.4): The `nodeGroups[name].ephemeralStorage` field has been renamed to `nodeGroups[name].diskSize` to better reflect its purpose (persistent disk for kubelet and containerd data). Existing clusters are migrated transparently by platform migration 41 during the pre-upgrade hook — no manual action is required. Newly written values should use `diskSize`. Existing VMs will be automatically rolling-updated via CAPI when the new values are applied. State persists across same-VM reboots (virt-launcher restart, guest reboot, node failure); VM replacement by CAPI (e.g. nodeGroup field change, MachineHealthCheck remediation) provisions a fresh PVC.
8989

90+
- **Remote-accessible LINSTOR StorageClasses are auto-propagated to tenants** (v1.5): infra-cluster LINSTOR StorageClasses whose `linstor.csi.linbit.com/allowRemoteVolumeAccess` is not `"false"` are created inside each tenant under the same name (provisioned by `csi.kubevirt.io`). **Upgrade caveat:** delete any *manually created* tenant StorageClass whose name collides with a propagated infra class (e.g. a hand-made `replicated`) before upgrading, or the propagated class cannot be created and the tenant CSI release will not converge. Infra classes that must stay node-local need `allowRemoteVolumeAccess: "false"` set explicitly — an absent annotation is treated as remote-accessible. Propagation is evaluated at HelmRelease render time, so classes added or removed on the infra cluster after a tenant exists propagate only on that tenant's next reconcile.
91+
9092
> The top-level `storageClass` field is annotated as immutable in the chart schema — see [`docs/storage-immutability.md`](../../../docs/storage-immutability.md) for the contract and which consumers enforce it. The per-node-group `nodeGroups[name].storageClass` field is intentionally **not** annotated immutable: it is optional and undefaulted, so a strict `self == oldSelf` rule would block any future attempt to set it on an existing node group.
9193
9294
## Parameters

‎packages/apps/kubernetes/templates/helmreleases/csi.yaml‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,18 @@ spec:
4343
{{- if not $out }}
4444
{{- $_ := set $out "replicated" (dict "infraStorageClass" "replicated" "default" false) }}
4545
{{- end }}
46-
{{- /* Legacy alias so existing tenant PVCs bound to the "kubevirt" StorageClass keep working. */}}
47-
{{- if not (hasKey $out "kubevirt") }}
48-
{{- $_ := set $out "kubevirt" (dict "infraStorageClass" $defaultName "default" false) }}
49-
{{- end }}
50-
{{- /* Mark exactly one default: the configured storageClass if propagated, else replicated, else first by name. */}}
46+
{{- /* Mark exactly one default among the propagated classes. Chosen BEFORE the kubevirt alias is
47+
added below, so the legacy alias (which points at $defaultName, possibly absent on the infra
48+
cluster) can never be auto-selected as the tenant default: the configured storageClass if
49+
propagated, else replicated, else first by name. */}}
5150
{{- $chosen := "" }}
5251
{{- if hasKey $out $defaultName }}{{ $chosen = $defaultName }}
5352
{{- else if hasKey $out "replicated" }}{{ $chosen = "replicated" }}
5453
{{- else }}{{ $chosen = (keys $out | sortAlpha | first) }}{{ end }}
54+
{{- /* Legacy alias so existing tenant PVCs bound to the "kubevirt" StorageClass keep working. */}}
55+
{{- if not (hasKey $out "kubevirt") }}
56+
{{- $_ := set $out "kubevirt" (dict "infraStorageClass" $defaultName "default" false) }}
57+
{{- end }}
5558
{{- $_ := set (index $out $chosen) "default" true }}
5659
{{- $out | toYaml | nindent 6 }}
5760
dependsOn:

‎packages/system/kubevirt-csi-node/templates/deploy.yaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,14 +271,14 @@ data:
271271
apiVersion: storage.k8s.io/v1
272272
kind: StorageClass
273273
metadata:
274-
name: {{ $name }}
274+
name: {{ $name | quote }}
275275
{{- if $m.default }}
276276
annotations:
277277
storageclass.kubernetes.io/is-default-class: "true"
278278
{{- end }}
279279
provisioner: csi.kubevirt.io
280280
allowVolumeExpansion: true
281281
parameters:
282-
infraStorageClassName: {{ $m.infraStorageClass }}
282+
infraStorageClassName: {{ $m.infraStorageClass | quote }}
283283
bus: scsi
284284
{{- end }}

0 commit comments

Comments
 (0)