Skip to content

kubernetes: jitter transient dial retries - #4039

Draft
crazy-max wants to merge 2 commits into
docker:masterfrom
crazy-max:kubernetes-dial-backoff-jitter
Draft

kubernetes: jitter transient dial retries#4039
crazy-max wants to merge 2 commits into
docker:masterfrom
crazy-max:kubernetes-dial-backoff-jitter

Conversation

@crazy-max

Copy link
Copy Markdown
Member

carry and closes #3995

Kubernetes dial retries now add jitter to the exponential backoff used for transient connection errors. This keeps concurrent builders from retrying in lockstep when node readiness gets ahead of CSR approval and many builds hit the same temporary TLS failure at once.

The jitter is additive, so retries never happen sooner than the existing exponential schedule would allow, and the delay remains capped by the configured maximum.

1991santhu and others added 2 commits August 28, 2026 15:09
…n lockstep

calculateBackoff was a pure function of the attempt number, so every builder
retrying the same condition waited exactly the same durations. That matters
here because CSR approval lagging node readiness is a cluster-wide event:
concurrent builds scheduled onto newly-ready nodes hit the transient TLS error
at the same moment, then retry in unison against an API server already working
through the approval backlog.

Add jitter drawn from [d, 2d], capped by maxDelay, where d is the exponential
value for the attempt. The exponential value is the floor rather than the
midpoint, so a retry is never issued sooner than the schedule would have on its
own. Centring it would let the first retry fire at baseDelay/2, which undercuts
a configured minimum at exactly the wrong moment. With maxRetries=5 and
baseDelay=500ms the delays used are 500ms through 4s, so the 10s cap is never
reached in practice.

Marked the math/rand call with the same #nosec pattern podchooser uses.

Signed-off-by: Santhosh Kumar Somarapu <somarapu.santhosh91@gmail.com>
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.

2 participants