fix: If the PodList contains extra Pods, the judgment will fail. #229
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
DeletePodListUntilReady 函数传入了 podList 入参,但是当在删除 PodList 前获取到的 PodList 可能是包含了 terminal 状态的 Pod ,此时去对比重启前后的 Pod 数,那么就无法成功。因为 len(podListWithLabel.Items) 将一定不等于 len(podList.Items)
pod 删除处于 terminal 状态的持续时间是不可控的,虽然可以通过 优雅期强制删除,但是对于 spiderpool-controller 这类特殊的 Pod ,强制删除后,由于资源没有回收完全,新的 spiderpool-controller Pod 可能由于端口冲突等问题而重启,而重启后,spiderpool 的 CI 日志采集脚本会判定 Pod 重启过,而 CI 失败
在 DeletePodListUntilReady 中,增加 expectedPodNum 字段,用于判断你所需要的 Pod 数量,不再去通过传入的 len(PodList.Iterms)去判断 Pod 的副本数是否符合预期,这样行为由于环境的不同,pod 终结快慢等影响,稳定性不可控。
同时尽可能的不采取强制删除 Pod 的方式,避免出现端口冲突而重启的情况,被 CI 日志采集脚本捕获判定失败。