helm: use --rollback-on-failure for atomic on Helm v4 (#1144)

* helm: use --rollback-on-failure for atomic on Helm v4

Helm v4 renamed the `--atomic` flag to `--rollback-on-failure`. The old
flag is deprecated on `helm upgrade` and removed entirely from `helm
install`, so `atomic: true` failed against Helm v4 (issue #1143).

Emit the version-appropriate flag from deploy() using the existing
is_helm_v4() helper, covering both the upgrade and the replace/install
code paths. The public `atomic` option is unchanged.

Fixes: https://github.com/ansible-collections/kubernetes.core/issues/1143

Co-Authored-By: Claude Opus 4.8

* fix wrong link in the changelog fragment

Signed-off-by: Yuriy Novostavskiy <yuriy@novostavskiy.kyiv.ua>

---------

Signed-off-by: Yuriy Novostavskiy <yuriy@novostavskiy.kyiv.ua>
This commit is contained in:
Yuriy Novostavskiy
2026-07-01 20:30:52 +02:00
committed by GitHub
parent 3634105366
commit bc17b33d44
3 changed files with 90 additions and 1 deletions

View File

@@ -202,6 +202,9 @@ options:
atomic:
description:
- If set, the installation process deletes the installation on failure.
- With Helm v4 this is translated to the C(--rollback-on-failure) flag, since
C(--atomic) was renamed; with Helm v3 the C(--atomic) flag is used. The
O(atomic) option works the same way regardless of the installed Helm version.
type: bool
default: False
server_side:
@@ -656,7 +659,13 @@ def deploy(
deploy_command += " --timeout " + wait_timeout
if atomic:
deploy_command += " --atomic"
# Helm v4 renamed '--atomic' to '--rollback-on-failure'. The old flag is
# deprecated on 'helm upgrade' and removed from 'helm install', so always
# emit the version-appropriate flag.
if module.is_helm_v4():
deploy_command += " --rollback-on-failure"
else:
deploy_command += " --atomic"
if timeout:
deploy_command += " --timeout " + timeout