kubectl-view-allocations icon indicating copy to clipboard operation
kubectl-view-allocations copied to clipboard

add --sort?

Open ahmetb opened this issue 3 years ago • 4 comments

This plugin is great! I use it daily, but sometimes I find myself doing kubectl view-allocations -g namespace -r cpu to see which namespaces have the most allocations. But finding that right now is manual. I think it can be applied to other resources too.

(I actually tried to add this myself but sadly my Rust skills are non-existent.)

ahmetb avatar Apr 22 '22 17:04 ahmetb

Hi, I'm glad to know that the plugin is useful. Can you give more details about the feature ? For example, do you expect that --sort "column" will sort in ,decreasing, on the column ("usage", "requested", "limit" in Qty (or in %)) and keep hierarchy, but sort between sibling only ?

davidB avatar Apr 24 '22 19:04 davidB

Honestly not sure :) maybe --sort=-2 sorts the 2nd col descending, I don't know. Might complicate things quite a bit.

ahmetb avatar May 01 '22 01:05 ahmetb

I came to open this issue again :D

I think I'm trying to figure out answers to something like: show me namespaces with most cpu allocations. e.g.

 kubectl view-allocations -g namespace -r cpu --sort=-cpu

even this would go a long way. I think also, while scrolling down the list and examining results by eye, human-readable ints like 1.5k aren't helping as they don't appear longer than 10.0 :)

ahmetb avatar Oct 20 '22 23:10 ahmetb

I guess you have a typo in your sample

kubectl view-allocations -g namespace -r cpu --sort=-allocation

I'll see how to provide a first cli for this, but may be more sql like

davidBernardWefox avatar Oct 21 '22 08:10 davidBernardWefox