Files
home-network-k3s-impl/platform/kubevirt/cdi-storageprofiles.yaml
T
jakman85andClaude Opus 4.8 3586769460 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]>
2026-08-26 12:06:15 -05:00

47 lines
2.6 KiB
YAML

---
# 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