Skip to content

Neighbourhood cut that runs in the browser, keyed by Kubernetes identity #1081

Closed

Description

@lex00

A cluster UI shows one object at a time. Beside it, behold needs "this object, its neighbours in the cluster, and what it reaches outside" from a graph the page already holds, with no server to ask. This issue writes that cut as a pure browser module, keyed by the identity a host passes (group, kind, namespace, name). Part of #1049, phase 4.

Today

  • behold has no cut around one resource. The nearest is downstreamOf (web/chant-pr-marks.js:502), a transitive walk over the component needs map, which covers stacks and not resources.
  • Search is server-side: src/search.ts shells out to chant search. The static export replays only the q answers captured at export time (q is in LENS_PARAMS, src/export.ts:29), so an export cannot answer for an arbitrary object.
  • chant's blast:<id> lens has no depth limit and runs in Node.
  • Cut: around one resource or root, by depth and direction #1067 is the cut around one resource over the graph document.

Change

  • A module in web/, for example web/neighbourhood.js, that imports nothing from node:* or src/. It takes { nodes, edges, groups } as /api/graph returns them.
  • findK8sNode(graph, { group, kind, namespace, name }) finds the start node. An object with no namespace joins default, as src/k8s-edges.ts does (line 110). Cluster-scoped kinds match without one.
  • cutAround(graph, startIds, { depth, up, down, outside }) walks both edge directions to depth hops. It keeps the groups of kept nodes. outside (default 2) lets the walk go that many hops past the last Kubernetes node.
  • Cut: around one resource or root, by depth and direction #1067 and this issue share one walk. Whichever applies second wraps the first.

Done when

  • Fixture: Deployment web uses ServiceAccount runner, which has an edge to a google_service_account, which has an edge to a project. cutAround from web at depth 1 with outside: 2 returns all four nodes and their three edges.
  • The same call with outside: 0 returns the Deployment and the ServiceAccount only.
  • An identity that is not in the graph returns no nodes and a reason naming the identity.
  • esbuild web/neighbourhood.js --bundle --platform=browser succeeds with no Node built-ins, and the PR states the bundle size.
  • The cut's time on the 49-root infra/ read of kubernetes/k8s.io (2,979 nodes) is printed.

Depends on

Nothing.

Not in this issue

Placeholder cards for objects the graph does not hold (its own issue). Drawing the cut (each host's issue).

Activity

  1. added
    epic:surfaces
    wave:4
    on Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    epic:surfaceswave:4

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions