k9s icon indicating copy to clipboard operation
k9s copied to clipboard

Open controller shortcut

Open sralloza opened this issue 2 years ago • 6 comments

In the pods view I usually want to open the controller of a specific pod (ReplicaSet -> Deployment, for example) and then restart the deployment, without navigating to the deployments view, filter them out and selecting the one I need.

It would be awesome if k9s supported this with a shortcut.

sralloza avatar Sep 07 '22 11:09 sralloza

Agreed this could be a nifty feature. Should be relatively simple to determine - look up the resource's owner references and iterate to find an entry with controller: true. Edge cases would be

  • resource lacks owner references -> no-op
  • has owner references but no controller -> no-op

@sralloza you mention pods but I don't see a reason to limit the feature to a particular resource. It would be useful to navigate "upward" from any resource, such as Pod -> ReplicaSet, EndpointSlice -> Service, or PVC -> PV.

I'm not familiar enough with the codebase to say how this would be implemented, but I can dig a little to gauge complexity.

caproven avatar Oct 14 '22 00:10 caproven

Believe this is definitely doable. As predicted finding the controller resource is straightforward. The tricky part then seems to be changing the view to display the resource. In cases like hitting Enter on a Deployment, the selector is used to lookup Pods. That won't work here as we want to display only the controller resource, regardless of selectors.

caproven avatar Oct 20 '22 01:10 caproven

I gave it a shot with #2133, let me know what you think.

gitolicious avatar Jun 15 '23 15:06 gitolicious

I was just looking for this feature! Also completley new to k9s, but would it be possible to jump to any kind of resource?

I often find myself going to the owning custom resource, like cert-manager certificates/challenges/orders etc, or CloudNative-PGs PostgresCluster (owns the pod) etc...

Richard87 avatar Sep 14 '23 12:09 Richard87

but would it be possible to jump to any kind of resource?

See my comment in the PR. I didn't find an easy way on first try. But it should be possible.

gitolicious avatar Sep 14 '23 17:09 gitolicious

Duplicated by #2696 and solved with the merge of #2700.

gitolicious avatar May 24 '24 19:05 gitolicious