Repository navigation
Conversation
Author
|
@tzneal Sorry for tagging you, but I thought nobody would see a new PR in this repo if I didn't do it. I was really hoping this could get merged so it could help other people as well. |
|
This is a really valuable feature. Grouping by node labels is something that’s genuinely missing when you’re dealing with larger clusters, especially with multiple node pools. Being able to see the aggregated view instead of having to open a terminal per node pool makes the viewer much more useful in real-world environments. Great work also on the performance improvements and the fixes along the way. This is a very solid PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Motivation
The viewer shows the cluster total at the top and each node at the bottom, with nothing in
between. With 40 nodes across 4 nodepools you get 1 number and 40 numbers, and none of the 4
you want. The workaround is one terminal per nodepool.
What this adds
--group-by <label>[=v1,v2]aggregates every node sharing a value for a label, and--groups-onlyhides the per-node list to leave just that summary.gtoggles the list atruntime.
The label is any node label, so nodepool, zone, capacity type or your own team label are the
same flag with a different key. Values are optional and only narrow the node selection when
given, so a bare label keeps nodes without it visible in a
<none>group. The percentage isweighted by node size rather than the mean of each node's percentage, since an idle
m5.24xlargenext to a busyt3.mediumshould not read as half used.Fixes along the way
--node-selector. The filter looked upc.nodesby node namebut the map is keyed by provider ID, so it never matched and the header counted every pod in
the cluster.
boundis now the pods on the nodes being displayed, which also makes it agreewith the group totals. Unscheduled pods stay counted, as they belong to no node.
Kiand quantities keep their scale, so asummed cluster read
386227344Ki.computeItemsPerPagecould return zero and the paginator divides by it, so a shortterminal could panic.
Performance
A redraw was dominated by two things: sort keys rebuilt on every comparison, and
natsort.Compare, whose backtracking regexp accounted for 87% of a frame's allocations.Keys are now built once per node, the comparison walks the strings in place, and the progress
bars are cached instead of interpolating a colour per cell every frame.
With 200 nodes and 4200 pods, against this branch's base on the same machine:
Cluster.Stats()Testing
7 new tests, 25 in total,
pkg/modelcoverage at 47.0%.gofmt -s,go vet,go buildandgo mod tidyare clean. Reverting the pod count fix makes its test fail, which the existingsuite did not catch.
Not run against a real cluster, so the selector built from
--group-byis verified at theselector string level.
Out of scope
go test -racereports data races with or without this change, 9 on the base commit against16 here, same root causes: the public
Node.Priceis written without a lock while therenderer reads it, and
IsOnDemand/IsAuto/Labelsread the label map unlocked. Happy toopen a separate PR. Same for
ColorTabWriterappending a byte at a time andconfig.LoadDefaultConfigrunning twice at startup.