k9s
k9s copied to clipboard
Feature: goto owner (ctrl-o)
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
- No effort was put into what to do in the case of multiple owners. This is exceedingly rare in the wild.
- 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.
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! 🤓
Superseded by the merge of #2700.