Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow plugin commands to switch views based on cluster resource refs #2662

Open
thandleman-r7 opened this issue Apr 18, 2024 · 0 comments
Open

Comments

@thandleman-r7
Copy link




Is your feature request related to a problem? Please describe.
Not really a problem, just a QoL feature that - I think - would make K9s even more awesome.

Describe the solution you'd like
Certain views allow us to navigate to another view based on a reference in one of the columns to another cluster resource. For example, the pod view allows you to navigate to the node view via the "Show Node" shortcut. My company uses Karpenter as our main cluster autoscaler. Karpenter has a custom resource NodeClaim (formerly Machine) that is responsible for tracking the nodes Karpenter provisions. I want the same feature that allow navigation to that node as is implemented for pods.

Looking through the code base I understand that for pods this is possible because of some logic in the Go code here:

k9s/internal/view/pod.go

Lines 167 to 190 in 6185115

func (p *Pod) showNode(evt *tcell.EventKey) *tcell.EventKey {
path := p.GetTable().GetSelectedItem()
if path == "" {
return evt
}
pod, err := fetchPod(p.App().factory, path)
if err != nil {
p.App().Flash().Err(err)
return nil
}
if pod.Spec.NodeName == "" {
p.App().Flash().Err(errors.New("no node assigned"))
return nil
}
no := NewNode(client.NewGVR("v1/nodes"))
no.SetInstance(pod.Spec.NodeName)
//no.SetContextFn(nodeContext(pod.Spec.NodeName))
if err := p.App().inject(no, false); err != nil {
p.App().Flash().Err(err)
}
return nil
}

I wonder if there is some way via a plugin to allow us to hook in to K9s and render the node view based on the referenced node in the NodeClaim resource.

Describe alternatives you've considered
Another potential option would be to somehow allow us to provide custom views and DAOs to K9s.

Additional context
Just want to say thank you so much for this incredible tool. I love K9s and evangelize to everyone that has to operate in Kubernetes-land that they should ditch whatever they're using and make the switch :)

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

No branches or pull requests

1 participant