kro: embed resource graphs on detail pages (0.2.0-alpha) - #1182
Open
danbruno101 wants to merge 3 commits into
Open
kro: embed resource graphs on detail pages (0.2.0-alpha)#1182danbruno101 wants to merge 3 commits into
danbruno101 wants to merge 3 commits into
Conversation
The RGD detail page gains a template DAG (a synthetic RGD root, one node per spec.resources entry, edges from kro's published dependency analysis) and the instance detail page gains a live resource graph of the objects kro created, both fed by the sub-resource watch set the page already owns so the graph and the Sub-resources table can never disagree. Rendering picks the best available renderer at runtime. kubernetes-sigs/headlamp#6992 exposes Headlamp's own Map renderer to plugins as window.pluginLib.ResourceMap.GraphView; when the host has it, the sections render that, so nodes get Headlamp's KubeIcons and open its standard details panel on click. The export is newer than Headlamp 0.44.0 and importing it at build time would break the plugin on released hosts, so it is looked up on window.pluginLib at render time and falls back to a small @xyflow/react renderer (that library comes from headlamp-plugin's own dependency tree, so no runtime dependency is added). Because the host merges all registered map sources into an embedded view, scoping comes from defaultNodeSelection: the native GraphView renders only the selected node's connected component. The template graph is therefore rooted at a synthetic node so it is always a single component, and instance ownership edges reuse the global map source's kro-owns-<uid> ids so duplicates dedupe away. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016zqV1YPx3JSFGVXqoCp76s Signed-off-by: Daniel Bruno <daniel.c.bruno@gmail.com>
Bump the plugin to 0.2.0-alpha, add the Artifact Hub packaging for it, document the embedded graphs and the upstream behaviors they inherit from the Map renderer (query params, global namespace filter, Map chrome; tracked in kubernetes-sigs/headlamp#7242), and refresh the screenshots to show the embedded template graph, the embedded instance graph, and the node details opened from a graph node. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016zqV1YPx3JSFGVXqoCp76s Signed-off-by: Daniel Bruno <daniel.c.bruno@gmail.com>
danbruno101
requested review from
ashu8912,
illume,
joaquimrocha,
skoeva,
sniok,
vyncent-t and
yolossn
as code owners
August 14, 2026 19:26
Run the formatter over the new graph builder tests (CI runs format --check), and link the upstream Headlamp issue references as full URLs: the owner/repo#number shorthand does not resolve in rendered markdown files, so it pointed at whichever repository the README was being viewed from. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016zqV1YPx3JSFGVXqoCp76s Signed-off-by: Daniel Bruno <daniel.c.bruno@gmail.com>
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 this adds
Embedded resource graphs on the kro plugin's detail pages, and a
0.2.0-alpharelease for them.spec.resourcesentry, and edges from the dependency graph kro publishes instatus.resources[].dependencies(never re-derived from CEL). ExternalexternalRefresources andincludeWhenconditionals are marked.Renderer selection at runtime
kubernetes-sigs/headlamp#6992 exposes Headlamp's Map renderer to plugins as
window.pluginLib.ResourceMap.GraphView. That export is newer than Headlamp 0.44.0, and a build-timeimportoflib/ResourceMapwould fail to typecheck against the released@kinvolk/headlamp-pluginand break the plugin at load time on released hosts. So the component is looked up onwindow.pluginLibat render time:GraphView, so nodes getKubeIcons and open the standard node details panel on click;@xyflow/reactrenderer (FallbackGraphView). That library comes fromheadlamp-plugin's own dependency tree, so this adds no runtime dependency.Detection fails closed: anything other than a renderable component falls back.
Scoping an embedded map
defaultSourcesis appended to (not substituted for) the globally registered map sources, so scoping comes fromdefaultNodeSelection— the nativeGraphViewrenders only the selected node's connected component. Two consequences shaped the code:template-root, deliberately not the RGD's uid, which the global source already uses with edges to every instance) so the DAG is always a single connected component;kro-owns-<uid>ids, so first-wins dedupe collapses duplicates instead of drawing them twice.Known behaviors inherited from the Map renderer
Documented in the plugin README and filed upstream as kubernetes-sigs/headlamp#7242 (requesting an opt-in embedded mode): the embedded view writes
?node=/?group=to the page URL, resets the global namespace filter on mount, and shows the full Map chrome.Testing
npm run lint,npm run tsc,npm run test(53 tests, 8 files),npm run buildall pass.GraphSourceadapter.GraphViewon Headlamp built frommain. Checked node-click details, live convergence after deleting the Deployment's pods, and that the global Map view and View-in-Map deep links still work.Screenshots
🤖 Generated with Claude Code
https://claude.ai/code/session_016zqV1YPx3JSFGVXqoCp76s