Open
Conversation
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.
Summary
Wraps the k8s API clients (
CoreV1Api,BatchV1Api,AuthorizationV1Api) in a retry Proxy that handles transient apiserver failures:ECONNREFUSED,ECONNRESET,ETIMEDOUT,ENETUNREACH,EAI_AGAIN,ENOTFOUND) with exponential backoff + jitter, capped at 4 attempts total. HonorsRetry-Afteron 429 (capped at 30s).createPod,createJob,createDockerSecret, andcreateSecretForEnvshandle 409 by reading back the existing resource;deletePodanddeleteSecretswallow 404. Covers the lost-response-after-success case the retry wrapper can itself produce.Why
Under load we see intermittent
ECONNRESET/ 503 against the kube apiserver duringprepareJob, which currently fail the entire workflow. With this change those fail-fast on transient errors become short retry loops. No change to success-path behavior.Test plan
tests/k8s-retry-test.tsforisRetryableError(status codes, network codes via cause chain, precedence, edge inputs) andretryAfterDelay(header formats, 30s cap, fallbacks).npx jest tests/k8s-retry-test.tspasses.constants-test.tsandk8s-utils-test.tsstill pass.npm run buildclean;npx tsc --noEmitclean.Known limitations
The
createPod409 handler returns the existing pod unconditionally. In ARC, the pod name is derived from the ephemeral runner pod name, so a stale pod with a mismatched spec is unlikely — 409 is almost always the lost-response case. If the operational signal shows otherwise, we'll add an ownership-label check as a follow-up.