Skip to content

kubernetes: replace hashring with compatible local pod selection - #4078

Draft
crazy-max wants to merge 1 commit into
docker:masterfrom
crazy-max:remove-hashring
Draft

crazy-max wants to merge 1 commit into
docker:masterfrom
crazy-max:remove-hashring

Conversation

@crazy-max

Copy link
Copy Markdown
Member

Replace the serialx/hashring dependency with a local implementation for sticky pod selection. Buildx only uses the library to construct an unweighted ring and perform one lookup, so a single scan avoids allocating and sorting the ring while preserving existing context-to-pod assignments and cache locality.

The implementation retains the original hash ordering, exact-match and wraparound behavior, and random-chooser fallback when the initial pod list is empty. Compatibility was checked against the previous library across 64,000 selections, with permanent regression tests covering representative assignments, pod removal, and fallback behavior.

Select sticky pods with a single scan instead of constructing and sorting a hash ring. Preserve the existing hash ordering, successor semantics, and random-chooser fallback when the initial pod list is empty.

Remove the hashring dependency and add compatibility fixtures covering existing assignments, exact matches, wraparound, and pod removal. Add regression coverage for the fallback succeeding, finding no pods, or returning a list error.

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant