Skip to content

feat: add VirtualMachine kind (M5)#33

Merged
ecv merged 1 commit into
mainfrom
feat/m5-virtualmachine
Jun 3, 2026
Merged

feat: add VirtualMachine kind (M5)#33
ecv merged 1 commit into
mainfrom
feat/m5-virtualmachine

Conversation

@ecv

@ecv ecv commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Implements M5 — VM inventory from the implementation plan (#15), tracked in #30.

Depends on M4 (#32), now merged. projectRef reuses the cross-group ObjectReference type from M4. Rebased on trunk and deconflicted — builds, tests, runs.

What's in it

New VirtualMachine kind (shortName vm)

  • hostRef (Node, immutable via CEL), optional providerRef, optional cross-group projectRef, and allocation (vcpus, memoryBytes, disks[] reusing Node's NodeDisk).
  • Reconciler validates hostRef + optional providerRef, inherits the host's topology labels, marks Ready. Power state / health are explicit non-goals.

Delete-guards

  • Node and Provider webhooks reject DELETE while a VirtualMachine references them (via new IndexVirtualMachineHostRef / IndexVirtualMachineProviderRef). The Node webhook gains the delete verb for this.
  • VirtualMachine webhook validates hostRef + providerRef existence on CREATE/UPDATE.

Dependency note

projectRef reuses the cross-group ObjectReference type from M4 (#32), now merged to trunk. M5's earlier private copy of that type has been dropped; M5 now consumes the merged definition in common_types.go. No remaining conflict.

Testing

  • go test ./internal/controller/... — all envtest specs pass: VM Ready + host-label inheritance, projectRef cross-group round-trip, optional providerRef resolution, missing-host / missing-provider rejection, hostRef immutability, Node/Provider delete-guards while referenced.
  • Added e2e chainsaw suite test/e2e/vm-inventory (not run here — needs a kind cluster).

Notes

  • Delete-guards via validating webhooks (not finalizers), per CLAUDE.md.
  • projectRef cross-group target is recorded but not existence-checked (may live on another cluster), mirroring M4's serviceRef.

Closes #30.

🤖 Generated with Claude Code

Implements milestone M5 (VM inventory) from the implementation plan (#15),
tracked in #30. Branched off trunk; no logic dependency on M2/M3/M4.

- New cluster-scoped VirtualMachine kind (shortName vm): hostRef (Node,
  immutable), optional providerRef, optional cross-group projectRef, and a
  VMAllocation (vcpus, memoryBytes, disks[]) reusing Node's NodeDisk shape.
  Reconciler validates hostRef and optional providerRef, inherits the host's
  topology labels, and marks Ready. Power state / health are explicit
  non-goals.
- Node and Provider validating webhooks reject DELETE while a VirtualMachine
  references them (host / providerRef), via new field indexers. The Node
  webhook gains the delete verb for this guard.
- VirtualMachine webhook validates hostRef and providerRef existence on
  CREATE/UPDATE; hostRef immutability and allocation bounds are CEL on the
  type. projectRef is cross-group and recorded without existence checking.
- Adds the cross-group ObjectReference type to common_types (also introduced
  independently by M4 #32; identical definition, so the two conflict only
  trivially on merge).
- Regenerated deepcopy, CRD/RBAC/webhook manifests, and the API reference;
  wired the reconciler + webhook into main and the envtest suite; added a
  VirtualMachine sample and a webhook kustomize index pair for the new webhook.
- Coverage: envtest specs for VM Ready + host-label inheritance, projectRef
  cross-group round-trip, optional providerRef resolution, missing-host and
  missing-provider rejection, hostRef immutability, and Node/Provider
  delete-guards while referenced; an e2e chainsaw suite (vm-inventory)
  exercising the same paths end to end.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ecv ecv force-pushed the feat/m5-virtualmachine branch from 3eb43e7 to 68bb529 Compare June 2, 2026 19:52
@ecv ecv marked this pull request as ready for review June 2, 2026 20:08
@ecv ecv requested review from aflor024, scotwells and slindseysr June 2, 2026 20:08
@ecv ecv enabled auto-merge (squash) June 2, 2026 20:08
@ecv ecv requested a review from savme June 2, 2026 20:16
@ecv ecv merged commit 65015e5 into main Jun 3, 2026
3 checks passed
@ecv ecv deleted the feat/m5-virtualmachine branch June 3, 2026 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

M5: VM inventory (VirtualMachine)

2 participants