Repository navigation
Conversation
Welcome To opensourceways CommunityHey @wyhhai , thanks for your contribution to the community. Bot Usage ManualI'm the Bot here serving you. You can find the instructions on how to interact with me at Here . That means you can comment below every pull request or issue to trigger Bot Commands. Contact GuideIf you have any questions, please contact the SIG: infratructure , |
CLA Signature Guide@wyhhai , thanks for your pull request. The following commit(s) are not associated with a signed Contributor License Agreement (CLA).
To sign CLA, click here. To check if your email is configured correctly, refer to the FAQs. Once you've signed the CLA or updating your email, please comment |
Linking Issue Notice@wyhhai , the pull request must be linked to at least one issue. |
|
/check-issue |
Background
Every step a
kubernetes-novolumerunner executes is delivered throughk8s.Exec, which the apiserver proxies tokubelet:10250. Those calls were the only ones left with no retry at all after #64 addedretryK8sApiCallfor the auth preflight:execPodStep,execPodStepWithOutputandexecCalculateOutputHashSortedeach created a freshk8s.Execand awaited it exactly once.On 2026-11-09 the HK CI node pool produced 28 job failures with exactly this signature:
These were not container failures: the failing steps were spread across eight different step types, both runner sets were affected, and the same nodes simultaneously timed out to CoreDNS (
10.247.3.10:53) and to the apiserver ClusterIP (10.247.0.1:443). Node inspection ruled out conntrack exhaustion, disk, memory, kubelet restarts and listen-queue overflows. The apiserver simply could not open a TCP connection to kubelet within its 30s dial budget, so the command inside the pod never started.Changes
execPodStep,execPodStepWithOutputandexecCalculateOutputHashSortednow run throughretryExecCall: 3 attempts, 1s / 2s backoff.isExecDialError()matches the transport signature (dial tcp,i/o timeout,error sending request,no route to host,EHOSTUNREACH,ENETUNREACH,UND_ERR_CONNECT*) and explicitly refuses anything that already carries an exit code. Retrying a command that already ran would execute the step twice, which is worse than failing it once.execPodSteprejects,execPodStepWithOutputresolves with the parsed code, and neither is retried.retryK8sApiCallis not reused here. It enforces a per-requesttimeoutMs(15s by default), which would kill legitimately long steps; exec keeps its native transport timeout instead.execPodStepWithOutput/execCalculateOutputHashSortedwere split into thin retry wrappers plus internalrun*functions so the per-attempt buffers are rebuilt on every attempt and cannot accumulate across retries. Their public signatures only gained an optional trailingretryOptionsparameter.execCpToPod/execCpFromPodare untouched: they already have their own 30-attempt loops.Tests
npm install --prefix packages/hooklib && npm run build --prefix packages/hooklib npm install --prefix packages/k8s npx tsc --noEmit -p packages/k8s npx jest --config packages/k8s/jest.config.js tests/exec-retry-test.ts tests/exec-pod-step-with-output-test.ts --runInBand npx eslint packages/k8s/src/k8s/index.ts packages/k8s/src/k8s/utils/index.ts packages/k8s/tests/exec-retry-test.tspackages/k8s/tests/exec-retry-test.tsadds 11 cases: dial-timeout detection (including a message that carries both a network-looking string and an exit code), retry-then-succeed for all three exec entry points, no-retry on non-zero exit, no-retry on unrelated failures such ascontainer not found, and the retry budget being exhausted when kubelet stays unreachable.Scope note
This does not fix the underlying network fault — it converts a hard 35s failure into a retry that rides through a transient window, exactly like #64 and #71 did for the other API paths. A sustained outage longer than the 3-attempt budget still fails the step, as it should.
This PR is based on
mainand will conflict lightly with #71 inpackages/k8s/src/k8s/index.ts(import block and helper area only); either can land first.Related
resolve https://github.com/opensourceways/ascend-ci-deployment/issues/2638 — cluster-side evidence for the 28 HK-001 exec timeouts.