Files
home-network-k3s-impl/apps/vms/unifi/20-datavolume.yaml
T
jakman85andClaude Opus 4.8 317b3f02f1 feat(vms): onboard UniFi OS Server as a KubeVirt VM on a non-gating track
First KubeVirt VM app + first real CDI http import. UniFi OS Server (UOS) is
Ubiquiti's current self-host product (the .deb is deprecated); it bundles UniFi
OS + Network app + its own datastore, so no MongoDB companion.

- apps/vms/unifi: CDI DataVolume (Ubuntu 24.04 cloud image -> longhorn-vm
  RWX/Block, live-migratable) + VirtualMachine (evictionStrategy: LiveMigrate)
  with cloud-init that installs podman/slirp4netns/jq and runs the UOS installer
  NON-INTERACTIVELY. The installer URL is resolved at boot from Ubiquiti's public
  firmware API (fw-update.ui.com/api/firmware-latest) — always-latest, no pinned
  URL to maintain (currently UOS v5.1.37).
- L4 exposure: two LoadBalancer Services (TCP+UDP) sharing a pinned, L2-announced
  Cilium VIP 192.168.1.54 (device inform/adoption + STUN can't ride the L7
  Gateway); external-dns publishes unifi.home.keithjackson.dev. UI on :11443.
- default-deny + additive CNPs (controller ingress, egress, and CDI-importer
  egress for the image pull).
- clusters/base/apps-vms.yaml: NON-GATING Flux Kustomization (wait:false,
  dependsOn platform-config) — VMs are a separate lifecycle from the app waves,
  so a slow VM import/install can't stall the app tier.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-08-26 15:05:05 -05:00

45 lines
2.2 KiB
YAML

---
# STAGING / DRAFT — see namespace.yaml header.
#
# CDI DataVolume — the UniFi VM boot disk. This is the FIRST real CDI *http* import on
# this cluster (the vm-demo/conformance path imports a containerdisk from a *registry*;
# this pulls the official Ubuntu 24.04 LTS server cloud image (qcow2) over https and CDI
# converts it onto the PVC).
#
# STANDALONE DataVolume (NOT a dataVolumeTemplate) so the disk OUTLIVES `kubectl delete vm`
# and survives destroy/rebuild (R-STATE-01) — same durability contract as vm-demo.
#
# STORAGE = longhorn-vm (the RWX/migratable StorageClass the storage workstream is adding):
# - accessModes: ReadWriteMany + volumeMode: Block => REQUIRED for KubeVirt LIVE MIGRATION
# (evictionStrategy: LiveMigrate in the VM). A ReadWriteOnce disk cannot live-migrate.
# - 60Gi: the Ubuntu cloud image virtual size is ~3.5Gi; cloud-init growpart/growroot
# expands the root fs to fill the disk on first boot. 60Gi leaves ample room for the
# UniFi datastore + OS + podman images + updates.
#
# GOTCHA / FLAG: a Block RWX DataVolume import needs CDI scratch space and the importer pod
# needs egress to cloud-images.ubuntu.com (see the CDI-import allow in 40-networkpolicy.yaml —
# the importer runs in THIS default-deny namespace, unlike the conformance test whose ephemeral
# ns has no baseline). No checksum is verified on an http source; pin a dated build for full
# reproducibility if drift matters (see README "Open questions").
apiVersion: cdi.kubevirt.io/v1beta1
kind: DataVolume
metadata:
name: unifi-rootdisk
namespace: unifi
labels:
app.kubernetes.io/name: unifi
spec:
source:
http:
# Ubuntu 24.04 LTS (noble) server cloud image, amd64, qcow2. "releases/.../release/"
# tracks the latest 24.04 point release. Pin to a dated build dir for reproducibility.
url: "https://cloud-images.ubuntu.com/releases/noble/release/ubuntu-24.04-server-cloudimg-amd64.img"
storage:
accessModes:
- ReadWriteMany # RWX => migratable (paired with evictionStrategy: LiveMigrate)
volumeMode: Block # block mode is the migratable/perf default for VM disks
storageClassName: longhorn-vm
resources:
requests:
storage: 60Gi