k9s icon indicating copy to clipboard operation
k9s copied to clipboard

Feature: goto owner (ctrl-o)

Open bnu0 opened this issue 11 months ago • 2 comments

TL;DR:

Allow traversing to the first resolvable ownerReference on any resource.

Pressing ctrl-o will switch to the view of the owner's resource type, and focus the cursor on the owner itself. The stack is preserved so esc will bring you back down to the child.

Confirmed to work for both cluster-scoped and namespaced resources (ownerReferences are not allowed to cross namespaces, namespaced resources must have namespaced owners in the same namespace, etc. etc.)

Nuances

  1. No effort was put into what to do in the case of multiple owners. This is exceedingly rare in the wild.
  2. The GVK -> GVR reverse mapping search is not optimal and holds the readlock. In most cluster(s) I'd expect this to be negligible (maybe a few hundred resource-versions at most?). Since the search happens on user input, it is not noticeable.

bnu0 avatar Mar 22 '24 03:03 bnu0

There is an open issue #1747 for this feature. I gave it a shot in #2133 close to a year ago. Unfortunately, the PR is getting stale as @derailed seems to be too busy for a final review.

Anyways, interesting to see that you managed to implement in 50 lines what took me 240! 🤓

gitolicious avatar May 07 '24 19:05 gitolicious

Superseded by the merge of #2700.

gitolicious avatar May 24 '24 19:05 gitolicious