Kubernetes reference chart: an operator command can leave an unowned NetworkPolicy when the policy create times out

未关闭 适合新手
#2,761 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
62/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
kubernetes, python

调研方向

从 deploy/stack_operator.py 中的 Installation.job() 开始,沿着 NetworkPolicy 创建、Job 创建和 active_job 赋值的顺序进行;然后找到失败时释放 Lease 的路径。查找围绕 job 创建的现有 operator 测试,看看 kubectl 调用是如何被 stub 的,因为你会需要一个 policy 失败的用例。修复方式是:在释放 Lease 之前尝试执行 kubectl delete networkpolicy --ignore-not-found,或者保留 Lease 并报告应检查哪个对象;因此,完成意味着不确定的创建路径不会留下无主的 policy,并且失败会被报告。

由索引模型根据 Issue 内容生成。

描述

Installation.job() in deploy/stack_operator.py creates an operation Job's NetworkPolicy before it sets active_job. If kubectl create for the policy fails with an uncertain outcome, such as a server timeout or a lost connection, the operator releases its Lease. The policy may still exist.

That policy has no owner reference yet, because the owner is set to the Job only after the Job is created, and it has no TTL. So it stays until someone deletes it by hand.

Impact: low. The policy selects only the unique registrystack.org/operation-id label of an operation that never ran, so it affects no other workload. It is clutter, and it is left over after an operator command that did not report it.

Possible fixes:

  • On a failed policy create, try once to kubectl delete networkpolicy <name> --ignore-not-found before releasing the Lease, and report if that delete also fails.
  • Or treat an uncertain policy create like an uncertain Job create: keep the Lease and tell the operator which object to check.

Found during the review of #2758. It is older than #2758 and was left out of that PR.

主要语言
Rust
星标
2
派生
0
平均合并
9 小时 48 分钟
30 天内合并 PR
151

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

registrystack/registry-stack 的其他 Issue

查看 registrystack/registry-stack 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。