Stable sort for RuntimeHandlers#12
Merged
Merged
Conversation
The runtimeHandlers list in the response to `crictl info` has unstable ordering since commit 97eb1cd that uses a map instead of a list. This causes the kubelet to update node status subresources every few seconds leading to excessive API server load. This change enforces stable ordering based on the runtime handler name.
ddce8dd to
5f00061
Compare
nyodas
approved these changes
Jun 27, 2025
| } | ||
|
|
||
| // Get runtime handlers in a stable order | ||
| resp.RuntimeHandlers = slices.Collect(maps.Values(c.runtimeHandlers)) |
There was a problem hiding this comment.
I wonder if we could have a maps.Values that sorts directly.
It's a nit more than anything else
Member
Author
There was a problem hiding this comment.
Doesn’t exist AFAIK. Go intentionally makes maps have unstable ordering, so this seems to be the idiomatic way of doing things.
|
Also don't know if there is one. Especially in case of a refactor like what just happened. |
pl-jankowskimichal
approved these changes
Jun 27, 2025
Fricounet
approved these changes
Jun 27, 2025
Member
Author
I’ll make a test as part of the upstream 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.
The runtimeHandlers list in the response to
crictl infohas unstable orderingsince commit 97eb1cd that uses a map instead of a list.
This causes the kubelet to update node status subresources every few seconds
leading to excessive API server load.
This change enforces stable ordering based on the runtime handler name.