fix: skip recreatePods on Helm 4, which removed --recreate-pods (#2832)

* fix: skip recreatePods on Helm 4, which removed --recreate-pods

- Helm 4 removed `--recreate-pods` (helm/helm#31023) and fails with "unknown flag", so a release
  with `recreatePods: true` broke `sync` and `apply`. On Helm 4 the flag is now left out with a
  warning; Helm 3 still receives it.
- The upgrade flag tests gain Helm 4 cases, and the existing ones are pinned to Helm 3 so they no
  longer depend on the installed helm binary.
- A test checks that the warning names the release on Helm 4 and is not logged on Helm 3.
- The configuration docs note that recreatePods is ignored on Helm 4.

Signed-off-by: Cayan <1619617+Cayan@users.noreply.github.com>

* refactor: flatten recreatePods flag logic in flagsForUpgrade

Drop the nested if-in-if and the st.logger nil-guard: no other log call in
state.go nil-checks the logger (e.g. the --color Helm 4 skip). Compute
recreatePodsEnabled and branch via a tagless switch, matching the switch
style already used elsewhere in state.go: warn on Helm 4, append
--recreate-pods otherwise. The flagsForUpgrade table runner now uses the
shared discard logger so the Helm 4 recreate-pods cases log safely.

Signed-off-by: yxxhero <aiopsclub@163.com>

---------

Signed-off-by: Cayan <1619617+Cayan@users.noreply.github.com>
Signed-off-by: yxxhero <aiopsclub@163.com>
Co-authored-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
Daniel Pinto
2026-10-16 09:23:47 +08:00
committed by GitHub
co-authored by yxxhero
parent 5c225fd200
commit 8fc23a4d80
3 changed files with 100 additions and 7 deletions
+3 -2
View File
@@ -116,7 +116,8 @@ helmDefaults:
waitForJobs: true
# time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks, and waits on pod/pvc/svc/deployment readiness) (default 300)
timeout: 600
# performs pods restart for the resource if applicable (default false)
# performs pods restart for the resource if applicable (default false).
# Ignored with a warning on Helm 4, which removed --recreate-pods.
recreatePods: true
# forces resource update through delete/recreate if needed (default false)
force: false
@@ -254,7 +255,7 @@ releases:
# waitRetries: 3
waitForJobs: true
timeout: 60
recreatePods: true
recreatePods: true # ignored with a warning on Helm 4
force: false
reuseValues: false
# set `false` to uninstall this release on sync. (default true)