Fixes a issue with multus and webhook not working when the manifest file is restored during a helm update #4361
+13
−0
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.
Thanks for contributing!
Notice:
"release/none"
"release/bug"
"release/feature"
What issue(s) does this PR fix:
Fixes #4357
Fixes #4344
Special notes for your reviewer:
When the admin executes the
helm upgrade
for spiderpool, the configMap spiderpool-multus, webhookconfig and secrets these manifest files are restored. which can raises issues: #4357 and #4344.To solve these issues, we add helm hook annotations(
"helm.sh/hook": pre-install
) to these manifests, when helm upgrade spiderpool, these files wouldn't be updated.执行 Helm 更新时,一些资源如 configMap, webhookconfig, secret 会被 helm 还原为初始配置,但这些资源都会在 spiderpool 运行时动态更新,所以当 helm 更新后,配置被还原这导致 pod webhook 和 multus 无法工作。
所以在这些资源清单文件上添加 helm hook 的 annotation: helm.sh/hook": pre-install, 这期望这些资源只会在安装时下发,而不会在 helm update 时重新下发。
但这里会有一个其他的问题:如果老版本没有如上的 annotation,更新上来后存量的 configMap, webhookconfig, secret 会被删除(这是helm的机制,如果老版本有如上的 annotations,问题不存在)。所以为了避免该情况下,这些资源被 helm 删除,加上另外一个 annotation:
helm.sh/resource-type: keep
, 但这会导致这些资源残留。所以在 delete-hook 中清理这些资源。