Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added a new flag
--exclude-node-labels
to exclude nodes with the provided label selector.Behavior and examples
I'm testing with the following cluster configuration:
All nodes
$ ./kube-capacity NODE CPU REQUESTS CPU LIMITS MEMORY REQUESTS MEMORY LIMITS * 1250m (2%) 400m (0%) 440Mi (1%) 540Mi (1%) kind-control-plane 950m (7%) 100m (0%) 290Mi (3%) 390Mi (4%) kind-worker 100m (0%) 100m (0%) 50Mi (0%) 50Mi (0%) kind-worker2 100m (0%) 100m (0%) 50Mi (0%) 50Mi (0%) kind-worker3 100m (0%) 100m (0%) 50Mi (0%) 50Mi (0%)
Only nodes with
color=red
$ ./kube-capacity --node-labels color=red NODE CPU REQUESTS CPU LIMITS MEMORY REQUESTS MEMORY LIMITS * 1150m (3%) 300m (0%) 390Mi (1%) 490Mi (2%) kind-control-plane 950m (7%) 100m (0%) 290Mi (3%) 390Mi (4%) kind-worker 100m (0%) 100m (0%) 50Mi (0%) 50Mi (0%) kind-worker2 100m (0%) 100m (0%) 50Mi (0%) 50Mi (0%)
Only nodes with
shape=square
$ ./kube-capacity --node-labels shape=square NODE CPU REQUESTS CPU LIMITS MEMORY REQUESTS MEMORY LIMITS * 200m (0%) 200m (0%) 100Mi (0%) 100Mi (0%) kind-worker 100m (0%) 100m (0%) 50Mi (0%) 50Mi (0%) kind-worker3 100m (0%) 100m (0%) 50Mi (0%) 50Mi (0%)
Nodes with
color=red
, excluding those withshape=square
$ ./kube-capacity --node-labels color=red --exclude-node-labels shape=square NODE CPU REQUESTS CPU LIMITS MEMORY REQUESTS MEMORY LIMITS * 1050m (4%) 200m (0%) 340Mi (2%) 440Mi (2%) kind-control-plane 950m (7%) 100m (0%) 290Mi (3%) 390Mi (4%) kind-worker2 100m (0%) 100m (0%) 50Mi (0%) 50Mi (0%)
All nodes except those that have both
color=red
andshape=square
$ ./kube-capacity --exclude-node-labels color=red,shape=square NODE CPU REQUESTS CPU LIMITS MEMORY REQUESTS MEMORY LIMITS * 1150m (3%) 300m (0%) 390Mi (1%) 490Mi (2%) kind-control-plane 950m (7%) 100m (0%) 290Mi (3%) 390Mi (4%) kind-worker2 100m (0%) 100m (0%) 50Mi (0%) 50Mi (0%) kind-worker3 100m (0%) 100m (0%) 50Mi (0%) 50Mi (0%)