Ramilito / kubectl.nvim

Apache License 2.0
165 stars 5 forks source link

Implement generic resource view #135

Closed jemag closed 1 month ago

jemag commented 1 month ago

Is your feature request related to a problem? Please describe. I would like to be able to view any resource on the cluster.

Describe the solution you'd like Have a generalized view where you can query (if possible with autocomplete), any resource that is available through kubectl api-resource.

This would allow seeing more niche standard resources as well as any custom resource (e.g., external-secrets, servicemonitors, policyreports, argocd applications, etc.)

Additional context I realise that the following issue https://github.com/Ramilito/kubectl.nvim/issues/23 already exists and mentions CRDs, but I think this feature is more general and would not only be for custom resource definitions, but any resource/custom resource whatsoever.

Ramilito commented 1 month ago

Hi and thanks for creating an issue 🙏!

Would love to hear more on how this should look like and would it be different from the Fallback view mentioned in #23? The idea with that one is to handle the output from example :Kubectl get external-secrets and give some sort of basic functionality.

jemag commented 1 month ago

I am not quite sure how the fallback view would work/look like, but, personally, I would rather avoid typing the whole kubetctl get XXXX command to trigger this.

I guess what I am thinking is to have a hotkey trigger something similar to the <c-f> Filter, where you could enter the resource name with auto-complete (auto-complete source could be retrieved from kubectl api-resources). Once you enter the resource you desire, you get a view similar to the pods/deployments/secrets one, where it just list all the resources and you could describe, delete, edit any of them.

Basically, a bit similar to the k9s: image and image

Hopefully that made sense, let me know if it doesn't.

Ramilito commented 1 month ago

I loved the suggestion and really happy with the results, I just merged it and would love to hear if it meets your expectations!

You trigger the search using ctrl+a (short for alias), start typing and tab to cycle through the suggestions, if it's a view we support then it should load those otherwise fallback on the generic view.

The generic view is pretty barebones atm, it has name and namespace always and some other columns if some conditions are met. It also has basic actions such as edit, delete and describe.

My thoughts regarding that is to let it grow organically and try to create real views when we need it instead of covering all scenarios.

mosheavni commented 1 month ago

I loved the suggestion and really happy with the results, I just merged it and would love to hear if it meets your expectations!

You trigger the search using ctrl+a (short for alias), start typing and tab to cycle through the suggestions, if it's a view we support then it should load those otherwise fallback on the generic view.

The generic view is pretty barebones atm, it has name and namespace always and some other columns if some conditions are met. It also has basic actions such as edit, delete and describe.

My thoughts regarding that is to let it grow organically and try to create real views when we need it instead of covering all scenarios.

LOVE IT! can you make :Kubectl get ... give the same view?

Ramilito commented 1 month ago

can you make :Kubectl get ... give the same view?

Good idea! Yeah that shouldn't be too difficult!

jemag commented 1 month ago

hi @Ramilito, thank you for the fast implementation. However it it does not seem like any resources are showing using that view: image image

These resources do appear if using the Kubectl get command.

Ramilito commented 1 month ago

I managed to break it later on, reverted that code now, please check again! @jemag

jemag commented 1 month ago

works great, thanks a lot! I like the workflow, it really boosts the capabilities of the plugin, especially for clusters that have a lot of custom resources.