feat: add VirtualMachine kind (M5)#33
Merged
Merged
Conversation
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>
3eb43e7 to
68bb529
Compare
slindseysr
approved these changes
Jun 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements M5 — VM inventory from the implementation plan (#15), tracked in #30.
What's in it
New
VirtualMachinekind (shortNamevm)hostRef(Node, immutable via CEL), optionalproviderRef, optional cross-groupprojectRef, andallocation(vcpus,memoryBytes,disks[]reusing Node'sNodeDisk).hostRef+ optionalproviderRef, inherits the host's topology labels, marksReady. Power state / health are explicit non-goals.Delete-guards
NodeandProviderwebhooks reject DELETE while aVirtualMachinereferences them (via newIndexVirtualMachineHostRef/IndexVirtualMachineProviderRef). TheNodewebhook gains thedeleteverb for this.VirtualMachinewebhook validateshostRef+providerRefexistence on CREATE/UPDATE.Dependency note
projectRefreuses the cross-groupObjectReferencetype from M4 (#32), now merged to trunk. M5's earlier private copy of that type has been dropped; M5 now consumes the merged definition incommon_types.go. No remaining conflict.Testing
go test ./internal/controller/...— all envtest specs pass: VM Ready + host-label inheritance,projectRefcross-group round-trip, optionalproviderRefresolution, missing-host / missing-provider rejection,hostRefimmutability, Node/Provider delete-guards while referenced.test/e2e/vm-inventory(not run here — needs a kind cluster).Notes
projectRefcross-group target is recorded but not existence-checked (may live on another cluster), mirroring M4'sserviceRef.Closes #30.
🤖 Generated with Claude Code