PreDelete/PostDelete 钩子在执行之前就被删除
作者: baburciu创建于 2026年8月7日更新于 2026年9月29日
标签bugbug/severity:criticialbug/priority:hightriage/pendingcomponent:corefeature:hooks
runningHooks完全来自liveObjs— 一个集群缓存快照: https://GitHub.com/argoproj/argo-cd/blob/v3.5.0/controller/hook.go#L125-L130- 步骤 A: 缓存中没有钩子 → 钩子在
expectedHook中 →CreateResource成功 → 返回(false, nil)以等待。 ✔ - 步骤 B,几秒钟后: 缓存仍然没有钩子 → 创建尝试 →
409 AlreadyExists→ 警告并continue,丢弃钩子刚刚被证明存在的事实: https://GitHub.com/argoproj/argo-cd/blob/v3.5.0/controller/hook.go#L161-L165 createdCnt == 0,因此“创建钩子,等待”的早退被忽略: https://GitHub.com/argoproj/argo-cd/blob/v3.5.0/controller/hook.go#L171-L174- 健康检查迭代了 空
runningHooks映射 — 进度为零,失败为零: https://GitHub.com/argoproj/argo-cd/blob/v3.5.0/controller/hook.go#L187-L235 - 通过跳转 →
return true, nil— 阶段被宣布完成: https://GitHub.com/argoproj/argo-cd/blob/v3.5.0/controller/hook.go#L235 - 调用者删除预删除最终处理程序并继续进行级联删除,从而删除步骤 2 中创建的钩子(它通过
SetAppInstance来跟踪应用实例): https://GitHub.com/argoproj/argo-cd/blob/v3.5.0/controller/appcontroller.go#L1288-L1298 - 对 PostDelete 的相同模式: https://GitHub.com/argoproj/argo-cd/blob/v3.5.0/controller/appcontroller.go#L1370
内容来源: argoproj/argo-cd