feat: add --force-conflicts flag support for Helm 4 (#2480)

* feat: add --force-conflicts flag support for Helm 4

Add support for Helm 4's --force-conflicts flag which forces server-side
apply changes against conflicts. This flag is mutually exclusive with
--force/--force-replace and only available in Helm 4.

Fixes #2429

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

* fix: address review comments on force-conflicts feature

- Fix comment grammar: 'forces' instead of 'force'
- Improve error messages to indicate both sources (releases[] and helmDefaults)
- Add test case for helmDefaults.forceConflicts with Helm 3 (should error)
- Update TestGenerateID expected hashes after adding ForceConflicts field to structs

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

---------

Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
yxxhero
2026-03-14 08:44:44 +08:00
committed by GitHub
parent d7a5da127b
commit d613c5484c
3 changed files with 111 additions and 7 deletions
+6 -6
View File
@@ -38,39 +38,39 @@ func TestGenerateID(t *testing.T) {
run(testcase{
subject: "baseline",
release: ReleaseSpec{Name: "foo", Chart: "incubator/raw"},
want: "foo-values-6d799cf798",
want: "foo-values-5bc9c89c6b",
})
run(testcase{
subject: "different bytes content",
release: ReleaseSpec{Name: "foo", Chart: "incubator/raw"},
data: []byte(`{"k":"v"}`),
want: "foo-values-7f885447bf",
want: "foo-values-7bf9c8bcdf",
})
run(testcase{
subject: "different map content",
release: ReleaseSpec{Name: "foo", Chart: "incubator/raw"},
data: map[string]any{"k": "v"},
want: "foo-values-86f5d8fb55",
want: "foo-values-65694d8947",
})
run(testcase{
subject: "different chart",
release: ReleaseSpec{Name: "foo", Chart: "stable/envoy"},
want: "foo-values-5cd5c65db5",
want: "foo-values-856c5f7dd5",
})
run(testcase{
subject: "different name",
release: ReleaseSpec{Name: "bar", Chart: "incubator/raw"},
want: "bar-values-c59b4f979",
want: "bar-values-fff55fbf5",
})
run(testcase{
subject: "specific ns",
release: ReleaseSpec{Name: "foo", Chart: "incubator/raw", Namespace: "myns"},
want: "myns-foo-values-56d6cd88cc",
want: "myns-foo-values-6bfbb74765",
})
for id, n := range ids {