feat: add support for helm 4 --server-side upgrade flag (#2641)

* feat: add support for helm 4 --server-side upgrade flag

Add support for the helm 4 upgrade flag --server-side which accepts
"true", "false", or "auto" (default "auto"). This allows users to
explicitly control server-side apply behavior, which is needed for
releases originally installed with Helm 3 and being managed with Helm 4.

The flag can be configured via:
- CLI: --server-side flag on sync, apply, and diff commands
- helmDefaults.serverSide in helmfile.yaml
- releases[].serverSide per-release override

Precedence: release-level > CLI flag > helmDefaults.
Errors are returned when serverSide is set but running Helm 3, or when
an invalid value is provided.

Closes #2640

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

* test: update TestGenerateID expected hashes for new ServerSide field

Adding ServerSide *string to ReleaseSpec changes spew's %#v output and
shifts the FNV hash used by generateValuesID. Update the hard-coded want
values to the new deterministic hashes.

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

---------

Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
yxxhero
2026-06-16 08:24:47 +08:00
committed by GitHub
parent 047fdcd17d
commit a94fdf4194
15 changed files with 265 additions and 6 deletions
+7
View File
@@ -53,6 +53,8 @@ type DiffOptions struct {
SkipSchemaValidation bool
// TakeOwnership is true if the ownership should be taken
TakeOwnership bool
// ServerSide controls the helm 4 --server-side flag. Must be "true", "false", or "auto".
ServerSide string
}
// NewDiffOptions creates a new Apply
@@ -219,3 +221,8 @@ func (t *DiffImpl) SkipSchemaValidation() bool {
func (t *DiffImpl) TakeOwnership() bool {
return t.DiffOptions.TakeOwnership
}
// ServerSide returns the ServerSide.
func (t *DiffImpl) ServerSide() string {
return t.DiffOptions.ServerSide
}