feat(storage): CSI snapshots + smart-clone + migratable RWX for KubeVirt live-migration

Adds the VM/CDI storage tier approved by the PM (RWX for live-migration):

- platform/external-snapshotter (NEW, controllers pass): the cluster-singleton
  snapshot.storage.k8s.io control plane (CRDs + snapshot-controller in
  kube-system), pinned v8.2.0 (Kubernetes deps aligned to 1.31 since v8.1.0;
  this cluster is k3s v1.31.5). These CRDs were absent — only snapshots.longhorn.io
  and kubevirt.io snapshot CRDs existed.
- platform/longhorn/volumesnapshotclass.yaml (NEW, platform-config): the
  driver.longhorn.io VolumeSnapshotClass (type: snap, in-cluster).
- platform/kubevirt/cdi-storageprofiles.yaml (NEW, platform-config): StorageProfile
  longhorn -> cloneStrategy: snapshot; StorageProfile longhorn-vm -> snapshot clone
  + claimPropertySets RWX/Block. Non-degraded default virt class clears
  CDIDefaultStorageClassDegraded.
- platform/longhorn/storageclasses.yaml: NEW longhorn-vm StorageClass —
  migratable: "true" (Longhorn's KubeVirt-live-migration knob; RWX/Block-only on
  1.7.3), is-default-virt-class (NOT the k8s default; longhorn stays RWO default).
- platform/kubevirt/kubevirt-cr.yaml: comment only — LiveMigration is GA on v1.9
  (no feature gate); no cluster-wide evictionStrategy (would wedge RWO-disk drains);
  live-migration stays per-VM opt-in on a longhorn-vm disk.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
jakman85andClaude Opus 4.8 committed 2026-08-26 12:06:15 -05:00
1 parent b57b3e9d71
commit 3586769460
8 files changed
+215 -2

No files matched your search

@@ -0,0 +1,46 @@
---
# CDI StorageProfiles — the storage "recipes" CDI uses when it provisions/clones VM disk PVCs
# (ADR-0005). CONSUME the cdi.kubevirt.io CRD registered by the CDI operator (platform pass), so —
# like cdi-cr.yaml — these CRs are applied by the `platform-config` Flux Kustomization
# (dependsOn: platform). They live here beside the KubeVirt/CDI component and are referenced in
# place from platform-config/kustomization.yaml.
#
# CDI AUTO-CREATES a StorageProfile per StorageClass and fills its STATUS (inferred capabilities).
# The operator owns `.status`; the USER owns `.spec`. Setting `.spec` here does NOT fight CDI — it
# overrides only the fields we set (server-side apply), and CDI keeps reconciling status around them.
#
# ── longhorn: turn on SNAPSHOT smart-clone ─────────────────────────────────────────────────────
# Default (empty spec) the longhorn profile reports `cloneStrategy: copy` — CDI clones a golden image
# by spinning a host-assisted byte-for-byte copy pod (slow, doubles I/O). With external-snapshotter
# installed and a driver.longhorn.io VolumeSnapshotClass present (../longhorn/volumesnapshotclass.yaml),
# `cloneStrategy: snapshot` makes CDI clone by taking a CSI VolumeSnapshot and provisioning the new
# PVC from it — near-instant, space-efficient. claimPropertySets left unset: CDI keeps inferring the
# class's native RWO/Filesystem, correct for ordinary (non-migratable) longhorn PVCs.
apiVersion: cdi.kubevirt.io/v1beta1
kind: StorageProfile
metadata:
name: longhorn
annotations:
homelab.keithjackson.dev/adr: ADR-0005
spec:
cloneStrategy: snapshot
---
# ── longhorn-vm: SNAPSHOT smart-clone + RWX/Block for live-migratable VM disks ──────────────────
# This is the default *virtualization* StorageClass (is-default-virt-class in ../longhorn/
# storageclasses.yaml). Its profile must advertise the access/volume mode combo Longhorn 1.7.3
# supports for migratable RWX — ReadWriteMany + Block — so every VM DataVolume CDI provisions on this
# class is stamped RWX/Block and is therefore live-migratable. Together with cloneStrategy: snapshot
# (smart clone) this profile is NON-DEGRADED (supports smart-clone AND RWX), which is what clears the
# CDIDefaultStorageClassDegraded alert (the default virt class must support BOTH).
apiVersion: cdi.kubevirt.io/v1beta1
kind: StorageProfile
metadata:
name: longhorn-vm
annotations:
homelab.keithjackson.dev/adr: ADR-0005
spec:
cloneStrategy: snapshot
claimPropertySets:
- accessModes:
- ReadWriteMany
volumeMode: Block
+12 -2
View File
@@ -30,8 +30,18 @@ metadata:
annotations:
homelab.keithjackson.dev/adr: ADR-0005
spec:
# Drain VMs off a cordoned node when possible; software-emulated dev VMs just Evict+restart.
# (Live migration across the 3 converged nodes is a nice-to-have per docs/06, not required.)
# LIVE MIGRATION (docs/06): GA in KubeVirt since v0.43 — on v1.9 (this install) it is enabled by
# default and needs NO feature gate. developerConfiguration.featureGates is intentionally left
# EMPTY: the `LiveMigration` gate no longer exists as an alpha/beta toggle, and adding it would be
# a no-op (worse, an unknown gate name can be rejected). No spec.configuration.migrations tuning is
# added either — the defaults (parallelMigrationsPerCluster=5, parallelOutboundMigrationsPerNode=2,
# 64Mi/s bandwidth cap) are correct for a 3-node dev cluster; revisit only under WS-VM load tests.
#
# A VM live-migrates on node drain ONLY if it opts in per-VM with `evictionStrategy: LiveMigrate`
# AND its disks are on a RWX-migratable StorageClass — `longhorn-vm` (platform/longhorn/
# storageclasses.yaml: migratable=true, RWX/Block). We do NOT set a cluster-wide
# spec.configuration.evictionStrategy: a blanket LiveMigrate would WEDGE drains for VMs whose disks
# are on the RWO `longhorn` class (unmigratable). VMs without opt-in still Evict+restart on drain.
configuration:
developerConfiguration:
# Use real (nested) KVM. `false` makes virt-controller REQUEST the kvm device so /dev/kvm is