feat(server): surface VM→host placement in the cross-layer graph#129
Merged
Conversation
A k3s-managed VirtualMachine pins itself to a physical host via a plain spec.node string. GetChildrenGraph previously only turned $ref markers and Planner children into edges, so a workload-rooted graph reached the cluster's VMs but stopped there — the host they run on was invisible. expandNode now synthesizes a VM→ProxmoxNode 'ref' edge from spec.node. The host is deliberately NOT a $ref: making spec.node one would couple VM Apply to the observed-only ProxmoxNode being fetchable (refs.Resolve errors on any unresolvable ref), so the edge is graph-only. The host is a TERMINAL node — added but not enqueued — so ChildrenOf(ProxmoxNode) doesn't drag every unrelated guest on the box into a focused workload graph. A ProxmoxNode-rooted query still lists all its guests as before. Completes the workload→Cluster→K3sNode→VM→host spine of the cross-layer graph.
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.
What
A k3s-managed
VirtualMachinepins itself to a physical host via a plainspec.nodestring.GetChildrenGraphonly turned$refmarkers and Planner children into edges, so a workload-rooted graph reached the cluster's VMs but stopped there — the host they run on was invisible. This completes the workload → Cluster → K3sNode → VM → host spine of the unified cross-layer graph (the follow-on noted when Phase 6 / #128 shipped).How
expandNodenow synthesizes aVM → ProxmoxNoderefedge fromspec.node.Two deliberate design choices, both documented at the call site:
$ref. Makingspec.nodea real$refwould couple VM Apply to the observed-onlyProxmoxNodebeing fetchable —refs.Resolveerrors on any unresolvable ref, so a transient node-Get failure would fail VM provisioning. The edge is synthesized purely for the graph; the apply path is untouched.ChildrenOf(ProxmoxNode)would pull every unrelated guest on the box into a focused workload graph. AProxmoxNode-rooted query still lists all its guests, exactly as before.Tests
TestGetChildrenGraphSurfacesVMHostPlacement— VM withspec.nodeyields the placement edge; host is present, unmanaged (observed/dimmed), and terminal (2 nodes, no sibling fan-out).TestGetChildrenGraphVMWithoutNodeHasNoPlacementEdge— a VM with provider-default placement (nospec.node) draws no edge.Backend-only; the UI
DagViewrendersrefedges generically already.