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

Add sorting via pod count for nodes #173

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

elyesbenamor
Copy link

Closes #159

Add Pod Count Sorting Feature

This PR adds the ability to sort nodes by their pod count, addressing the feature request in issue #159.

Changes

  • Added pod.count to the list of supported sort attributes
  • Implemented sorting logic in getSortedNodeMetrics to handle pod count sorting
  • Added test coverage for pod count sorting functionality

Usage

Users can now sort nodes by their pod count using:

kube-capacity --sort pod.count

NODE          CPU REQUESTS   CPU LIMITS      MEMORY REQUESTS   MEMORY LIMITS   
*             17367m (88%)   29525m (150%)   34312Mi (50%)    45381Mi (66%)  
node-1        3268m (83%)    7861m (200%)    5801Mi (42%)     7539Mi (54%)   
node-2        3227m (82%)    2951m (75%)     3458Mi (25%)     2807Mi (20%)   
node-3        3607m (92%)    7901m (201%)    9544Mi (69%)     15073Mi (109%) 
node-4        3558m (90%)    4111m (104%)    4720Mi (34%)     5019Mi (36%)   
node-5        3707m (94%)    6701m (170%)    10792Mi (78%)    14945Mi (108%) 

kube-capacity --pod-count --sort pod.count

NODE          CPU REQUESTS   CPU LIMITS      MEMORY REQUESTS   MEMORY LIMITS    POD COUNT
*             17367m (88%)   29525m (150%)   34312Mi (50%)    45381Mi (66%)    83/300
node-1        3268m (83%)    7861m (200%)    5801Mi (42%)     7539Mi (54%)     19/60
node-2        3227m (82%)    2951m (75%)     3458Mi (25%)     2807Mi (20%)     17/60
node-3        3607m (92%)    7901m (201%)    9544Mi (69%)     15073Mi (109%)   16/60
node-4        3558m (90%)    4111m (104%)    4720Mi (34%)     5019Mi (36%)     16/60
node-5        3707m (94%)    6701m (170%)    10792Mi (78%)    14945Mi (108%)   15/60

@elyesbenamor elyesbenamor changed the title add sorting via pod count Add sorting via pod count for nodes Jan 7, 2025
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

Successfully merging this pull request may close these issues.

Add Pod Count as a Sortable Attribute in --sort Option
1 participant