Repository navigation
multinode: random pick within tier for PriorityLevel selection - #129
Merged
Merged
Conversation
Contributor
📊 API Diff Results
|
dhaidashenko
approved these changes
Nov 17, 2026
ilija42
approved these changes
Nov 18, 2026
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.
Problem
Every pod builds its own PriorityLevel selector, and each selector's round-robin counter starts at 0. So every pod
picks the same RPC first, and after a failover they all move to the same next RPC together. When that RPC fails, all
pods are affected at once.
Change
PriorityLevel now picks a random alive node within the highest-priority tier instead of using round-robin.
LeaseDuration > 0.nrOfPriorityTiersare removed.The pick uses
math/rand/v2, the same as the RandomRPC selector. The randomness only spreads load, socryptographic randomness isn't needed (
#nosec G404).RandomRPC already exists, but it picks a new RPC on every request. This change keeps PriorityLevel sticky per pod and
only randomizes which RPC each pod starts on, so pods spread across RPCs without each pod's reads hopping between them.
Tests
ever is. A new case covers a top tier with only some nodes alive.
TestPriorityLevelNodeSelector_FirstPickSpreadsAcrossSelectorsbuilds fresh selectors, as pods would, and checksthat their first picks spread across the tier. It fails on the old round-robin code.