Skip to content

Conversation

@ljluestc
Copy link

Summary

Adds a Node-centric XRay view. Starting from a Node, K9s lists all Pods scheduled on it (cluster-wide) and, via the Pod renderer, expands related resources including PVCs and their bound PVs. This makes it easy to answer “which PVs are in use on this node?” without jumping between panels.

Motivation

  • Speed up node-level troubleshooting by visualizing Pod → PVC → PV chains from the Node entry point.
  • Avoid slow workflows of manually describing PVs/PVCs to infer node usage.

What’s changed

  • New Node XRay renderer:
    • internal/xray/node.go: renders Node → Pods using a spec.nodeName=<node> field selector; reuses Pod XRay to expand containers, ServiceAccount, PVCs, and bound PVs.
  • Register Node XRay:
    • internal/model/registry.go: enables TreeRenderer: new(xray.Node) for client.NodeGVR.
  • Allow :xray node:
    • internal/view/command.go: adds client.NodeGVR to allowed XRay resources.
  • PVC→PV expansion at Pod level:
    • internal/xray/pod.go: when a Pod mounts a PVC and the PVC is bound, the backing PV appears under that PVC node.
  • Tests:
    • internal/xray/node_test.go:
      • TestNodeRender
      • TestNodeRender_PodPVCExpandsToPV
      • TestNodeRender_ErrorOnBadInputType
      • TestNodeRender_ErrorWhenNoParentInContext
      • TestNodeRender_ErrorWhenNoFactoryInContext
      • TestNodeRender_NoPodsFound
    • internal/xray/pod_test.go:
      • TestPodPVCExpandsToPV (confirms PVC→PV expansion from Pod)

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