-
Notifications
You must be signed in to change notification settings - Fork 866
Description
What happened:
在 kruise-1.8.2 中,PodProbeMarker(PPM)通过将探针配置写入 NodePodProbe.spec.podProbes[] 来驱动节点侧探针执行。
当 PPM 被删除时,会通过 finalizer kruise.io/node-pod-probe-cleanup 执行清理逻辑,从对应节点的 NodePodProbe.spec 中移除该 PPM 写入的 probes。
当集群中存在 不同 namespace 下同名的 PodProbeMarker(例如 devplus/gateway 和 test-devplus/gateway),并且它们都为 Pod 写入的 probe 名称使用相同的命名规则:
probe name 形如:#(例如 gateway#idle)
此时如果删除其中一个 namespace 的 PPM(例如删除 test-devplus/gateway,或者删除 test-devplus namespace 导致 PPM 进入删除态),finalizer 清理会执行:
遍历 NodePodProbe.spec.podProbes[].probes[]
对于 probe.Name 包含或前缀匹配 gateway# 的条目执行删除
由于清理逻辑 仅依据 ppmName(字符串前缀/包含)判断归属,没有区分 namespace,导致:
test-devplus/gateway 删除时,会误删 devplus/gateway 之前写入到 NodePodProbe 的 gateway#* probes
进而导致 NodePodProbe.spec 被清空或缺失探针配置
devplus/gateway 的 PPM 仍然存在,但不会触发 reconcile 去回填 NPP(PPM 对 Pod 事件触发较弱),造成探针长期缺失,从而影响原地更新等场景。
What you expected to happen:
删除 test-devplus/gateway 时:
只应删除由 test-devplus/gateway 写入的 probes
不应影响 devplus/gateway 写入的 probes(即便两者 ppmName 相同)
How to reproduce it (as minimally and precisely as possible):
在 namespace devplus 创建一个 PodProbeMarker:
名称:gateway
probe 名称:idle(最终 probeName 为 gateway#idle)
selector 匹配到 devplus 下的某些 pods(例如 gateway-0、gateway-1)
在 namespace test-devplus 创建另一个同名 PodProbeMarker:
名称也为 gateway
同样包含 probe idle
selector 匹配到 test-devplus 下的 pods
等待 PPM controller 将两个 namespace 的 probes 写入各节点对应的 NodePodProbe.spec(同一个 node 上可能同时存在 devplus 与 test-devplus 的 podProbe 条目)
删除 test-devplus/gateway 或直接删除 namespace test-devplus
观察 kruise-controller-manager 日志,可以看到 finalizer 清理:
handlerPodProbeMarkerFinalizer
removePodProbeFromNodePodProbe
oldSpec 包含 devplus 或其他 namespace 的 gateway#idle
newSpec 变为 {} 或丢失了不属于 test-devplus 的 probes
观察 NodePodProbe:
spec 被清空或不完整
devplus/gateway 的 PPM 仍存在,但不会立即自动写回
Anything else we need to know?:
Environment:
- Kruise version: 1.8.2
- Kubernetes version (use
kubectl version): - Install details (e.g. helm install args):
- Others: