Repository navigation
feat(k8s): retry transient k8s API failures in auth preflight; bump runner to 2.338.0 - #64
Conversation
Welcome To opensourceways CommunityHey @KadenZhang3321 , 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 , |
Linking Issue Notice@KadenZhang3321 , the pull request must be linked to at least one issue. |
CLA Signature Guide@KadenZhang3321 , 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 |
|
|||||||||||||||||
CLA Signature Guide@KadenZhang3321 , 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 |
|
/check-cla |
edcb2c9 to
0dab1c9
Compare
CLA Signature PassKadenZhang3321, thanks for your pull request. All authors of the commits have signed the CLA. 👍 |
1 similar comment
CLA Signature PassKadenZhang3321, thanks for your pull request. All authors of the commits have signed the CLA. 👍 |
|
|||||||||||||||||
|
|||||||||||||||||
…unner to 2.338.0 Runner pods reach the in-cluster API (10.247.0.1) through node-local ClusterIP rules; every control-plane endpoint rotation opens a sub-second window with three random shapes: ECONNREFUSED (no backend), request hang (stale backend), and transient 403 on unwarmed apiserver replicas. The hook entrypoint isAuthPermissionsOK() runs 13 parallel, untimed, un-retried SelfSubjectAccessReviews before each step; any single failure aborts the whole step (process.exit(1)). - Add retryK8sApiCall: bounded retries with exponential backoff (3s/6s/12s, 4 attempts) + per-request timeout (15s); retries only transient errors (connection-layer codes, hang signatures, HTTP 401/403/408/429/5xx); deterministic errors throw immediately - Wrap the SAR preflight checks with retryK8sApiCall, and fix the shared mutable V1SelfSubjectAccessReview instance (now a fresh SAR per request) - Register actions-runner 2.338.0 in .github/runner-versions.yaml - Add tests/retry-utils-test.ts (classifier + retry behavior)
0dab1c9 to
25f6887
Compare
CLA Signature PassKadenZhang3321, thanks for your pull request. All authors of the commits have signed the CLA. 👍 |
|
/check-cla |
CLA Signature PassKadenZhang3321, thanks for your pull request. All authors of the commits have signed the CLA. 👍 |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
|||||||||||||||||
1 similar comment
|
|||||||||||||||||
背景
resolved https://github.com/opensourceways/backlog/issues/2467
vllm-ascend / sglang 等社区 CI 频发
Executing the custom container implementation failed(job 测试本身全绿,收尾/上传阶段连坐),排查结论见 ascend-gha-runners/docs#274。定位到的机理:runner pod 经节点本地 ClusterIP 规则访问 in-cluster API(10.247.0.1),托管面 apiserver 后端每次轮换,该转发链路都会开出秒级窗口,三种形态随机:
connect ECONNREFUSED 10.247.0.1:443403 selfsubjectaccessreviews ... is forbidden(重试即恢复)而 hook 入口
isAuthPermissionsOK()在每个 step 执行前都要跑 13 个并行、无 timeout、无重试的 SelfSubjectAccessReview,任一请求失败即process.exit(1)。一个 job 上百次 API 触点,窗口命中变成必然。实测同一 token/同一请求在窗口内 200/挂死/403 随机,直连 apiserver 后端 IP 则始终正常——排除权限配置问题,纯瞬时窗口。变更
retryK8sApiCall(utils 新增,可复用):有限次重试 + 指数退避(3s/6s/12s×4 次)+ 单次请求 timeout(默认 15s,覆盖挂死形态)。仅重试瞬态错误:连接层错误码(ECONNREFUSED/ECONNRESET/ETIMEDOUT/UND_* 等)、消息签名、以及 HTTP 401/403/408/429/5xx(未预热实例的瞬时 forbidden 正是要跨过去的窗口);400/404/409 等确定性错误立即抛出,行为与原逻辑一致。isAuthPermissionsOK接入重试;顺带修复原实现所有 13 个请求共享同一个可变 SAR 对象的问题——不修复的话,重试闭包重新序列化时会拿到外层循环最后一次赋值的 body(提交错误的 verb 组合)。效果
秒级窗口从「step 判死」降级为「warning + 多等数秒」。默认预算 4 次尝试 / 最长约 21s 退避,覆盖并远超实测到的窗口时长(1–6s)。
验证
npx jest tests/retry-utils-test.ts:9/9 通过(分类器 4 组 + 重试行为 5 组,含"超时弃挂起重试后成功"用例)npm run build --prefix packages/k8s:tsc + ncc 通过,产物含新逻辑重跑窗口截图证据(故障窗口内 ClusterIP 路径):
c200/c403/6s挂死 随机→ 窗口外同请求240/240全绿。后续建议(不在本 PR)
resolve ascend-gha-runners/docs#274