fix(capi-providers-core): keep the upgrade Job until the next attempt

With hook-succeeded the Job is removed after a successful run, and
before-hook-creation already removes a failed one only when the next
attempt starts. Keeping the Job after success as well leaves the last
run's pod logs readable whichever way it ended; the next attempt still
replaces it. The ConfigMap and RBAC objects keep both policies.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
This commit is contained in:
Aleksei Sviridkin committed 2026-11-16 13:28:44 +03:00
1 parent a6d57c6aee
commit 40e219c0b6
2 files changed
+6 -1

No files matched your search

+5
View File
@@ -22,6 +22,11 @@ setup() {
[ "$provider" = "$target-core" ]
}
@test "the upgrade Job is kept until the next attempt, after a success too" {
[ "$(yq --no-doc 'select(.kind == "Job") | .metadata.annotations."helm.sh/hook-delete-policy"' "$RENDERED")" = before-hook-creation ]
[ "$(yq --no-doc 'select(.kind != "Job" and .metadata.annotations."helm.sh/hook" != null) | .metadata.annotations."helm.sh/hook-delete-policy"' "$RENDERED" | sort --unique)" = before-hook-creation,hook-succeeded ]
}
@test "the operator retains intermediate bundles independently of migration hooks" {
local name bridge policy rendered="$BATS_TEST_TMPDIR/operator.yaml"
bridge="$(< "$CORE/files/bridge-version")"
@@ -86,7 +86,7 @@ metadata:
annotations:
helm.sh/hook: pre-install,pre-upgrade
helm.sh/hook-weight: "0"
helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded
helm.sh/hook-delete-policy: before-hook-creation
spec:
backoffLimit: 0
activeDeadlineSeconds: {{ add $timeout 60 }}