Skip to content

feat(ui): xray cluster ownership graph - #23

Merged
ErfanY merged 1 commit into
mainfrom
feat/xray
Jun 25, 2026
Merged

feat(ui): xray cluster ownership graph#23
ErfanY merged 1 commit into
mainfrom
feat/xray

Conversation

@ErfanY

@ErfanY ErfanY commented Jun 25, 2026

Copy link
Copy Markdown
Owner

Summary

:xray [namespace|all] opens a live ownership graph (closes gap #3 of the k9s parity audit). Instead of a per-kind tree, it's a single namespace-rooted forest of the workload topology:

▾ ns/default
├─ ▾ deploy/api  [OK] 2/2 ready
│  └─ ▾ rs/api-7d9  [OK]
│     ├─ ▾ po/api-7d9-0  [OK] Running
│     │  └─   ctr/app
│     └─ ▾ po/api-7d9-1  [OK] Running
├─ ▾ sts/db → po/db-0 → ctr
└─   po/debug   (standalone)

:xray = current namespace; :xray all = whole cluster grouped by namespace. Covers deploy→rs→pod, sts/ds→pod, cronjob→job→pod, bare job/rs→pod, standalone pods, all → containers.

Rendering

A real tree: box-drawing connectors (├──/└──/), / expand markers, severity-colored status, selectable cursor. Navigate j/k (+ g/G); / expand/collapse, Enter toggles, esc closes. Collapse state keyed by stable node id (survives the per-frame rebuild).

Live

Rebuilds from store state every frame; opening it adds the workload kinds to the active watch plan so it populates within a moment and tracks the cluster. Large graphs truncate with … N more (no silent caps).

Cross-cutting relations (Service/PVC/ConfigMap/Node — non-ownership, multi-parent edges that can't be drawn in a tree) are intentionally left to the Enter drill-down and describe views. The next feature is an operator triage board (the daily-driver "what needs attention" view), which is where the fleet-health value lives.

Testing

  • make validate green (104 tests + release build)
  • tests: namespace forest structure + connectors + markers; collapse hides subtree; arrow-key collapse/expand

🤖 Generated with Claude Code

`:xray [namespace|all]` opens a live ownership graph, replacing the old stub
and closing gap #3 from the k9s parity audit (4.7). Rather than a per-kind tree,
it's a single namespace-rooted forest of the workload topology:

  ns/<name>
  ├─ deploy → rs → pod → container
  ├─ sts / ds → pod → container
  ├─ cronjob → job → pod
  ├─ job / bare rs → pod
  └─ standalone pods (no controller)

`:xray` defaults to the current namespace; `:xray all` spans the cluster grouped
by namespace.

Rendering is a real tree, not indented text: box-drawing connectors
(├──/└──/│), ▾/▸ expand markers, severity-colored per-node status, and a
selectable cursor. Navigate j/k (+ g/G); →/← expand/collapse the node under the
cursor, Enter toggles, esc closes. Collapse state is keyed by stable node id so
it survives the per-frame rebuild.

The graph rebuilds from store state every frame so it tracks the cluster live;
opening it adds the workload kinds it draws to the active watch plan so it fills
in within a moment. Large graphs truncate with `… N more` nodes (no silent
caps). Cross-cutting relations (Service/PVC/ConfigMap/Node — non-ownership,
multi-parent edges that don't fit a tree) are intentionally left to the Enter
drill-down and describe views.

Reuses the existing owner-chain helpers (the log fan-in's
deployment/replicaset/pod key lookups).

Tests: namespace-rooted tree structure + connectors + expand marker; collapse
hides a subtree; arrow-key directed collapse/expand.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ErfanY
ErfanY merged commit fce242d into main Jun 25, 2026
1 check passed
@ErfanY
ErfanY deleted the feat/xray branch June 25, 2026 21:05
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.

1 participant