Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions api/v2/helmrelease_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,10 @@ type Upgrade struct {
// +optional
DisableSchemaValidation bool `json:"disableSchemaValidation,omitempty"`

// Force forces resource updates through a replacement strategy.
// Force forces resource updates through a replacement strategy
// that avoids 3-way merge conflicts on client-side apply.
// This field is ignored for server-side apply (which always
// forces conflicts with other field managers).
// +optional
Force bool `json:"force,omitempty"`

Expand Down Expand Up @@ -1113,7 +1116,10 @@ type Rollback struct {
// +optional
Recreate bool `json:"recreate,omitempty"`

// Force forces resource updates through a replacement strategy.
// Force forces resource updates through a replacement strategy
// that avoids 3-way merge conflicts on client-side apply.
// This field is ignored for server-side apply (which always
// forces conflicts with other field managers).
// +optional
Force bool `json:"force,omitempty"`

Expand Down
14 changes: 10 additions & 4 deletions config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -756,8 +756,11 @@ spec:
rollback has been performed.
type: boolean
force:
description: Force forces resource updates through a replacement
strategy.
description: |-
Force forces resource updates through a replacement strategy
that avoids 3-way merge conflicts on client-side apply.
This field is ignored for server-side apply (which always
forces conflicts with other field managers).
type: boolean
recreate:
description: |-
Expand Down Expand Up @@ -961,8 +964,11 @@ spec:
upgrade has been performed.
type: boolean
force:
description: Force forces resource updates through a replacement
strategy.
description: |-
Force forces resource updates through a replacement strategy
that avoids 3-way merge conflicts on client-side apply.
This field is ignored for server-side apply (which always
forces conflicts with other field managers).
type: boolean
preserveValues:
description: |-
Expand Down
10 changes: 8 additions & 2 deletions docs/api/v2/helm.md
Original file line number Diff line number Diff line change
Expand Up @@ -2608,7 +2608,10 @@ bool
</td>
<td>
<em>(Optional)</em>
<p>Force forces resource updates through a replacement strategy.</p>
<p>Force forces resource updates through a replacement strategy
that avoids 3-way merge conflicts on client-side apply.
This field is ignored for server-side apply (which always
forces conflicts with other field managers).</p>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -3260,7 +3263,10 @@ bool
</td>
<td>
<em>(Optional)</em>
<p>Force forces resource updates through a replacement strategy.</p>
<p>Force forces resource updates through a replacement strategy
that avoids 3-way merge conflicts on client-side apply.
This field is ignored for server-side apply (which always
forces conflicts with other field managers).</p>
</td>
</tr>
<tr>
Expand Down
10 changes: 8 additions & 2 deletions docs/spec/v2/helmreleases.md
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,10 @@ The field offers the following subfields:
upgrading the release. Defaults to `false`.
- `.disableWaitForJobs` (Optional): Disables waiting for any Jobs to complete
after upgrading the release. Defaults to `false`.
- `.force` (Optional): Forces resource updates through a replacement strategy.
- `.force` (Optional): Forces resource updates through a replacement strategy
that avoids 3-way merge conflicts on client-side apply.
This field is ignored for server-side apply (which always forces conflicts
with other field managers).
Defaults to `false`.
- `.preserveValues` (Optional): Instructs Helm to re-use the values from the
last release while merging in overrides from [values](#values). Setting
Expand Down Expand Up @@ -755,7 +758,10 @@ The field offers the following subfields:
rolling back the release. Defaults to `false`.
- `.disableWaitForJobs` (Optional): Disables waiting for any Jobs to complete
after rolling back the release. Defaults to `false`.
- `.force` (Optional): Forces resource updates through a replacement strategy.
- `.force` (Optional): Forces resource updates through a replacement strategy
that avoids 3-way merge conflicts on client-side apply.
This field is ignored for server-side apply (which always forces conflicts
with other field managers).
Defaults to `false`.
- `.recreate` (Optional): Performs Pod restarts if applicable. Defaults to
`false`. **Warning**: As of Flux v2.8, this option is deprecated and no
Expand Down
2 changes: 1 addition & 1 deletion internal/action/rollback.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ func Rollback(config *helmaction.Configuration, obj *v2.HelmRelease,
rollback.ServerSideApply = fmt.Sprint(serverSideApply)
}
rollback.ForceConflicts = serverSideApply // We always force conflicts on server-side apply.
rollback.ForceReplace = obj.GetRollback().Force && !serverSideApply

return rollback.Run(releaseName)
}
Expand All @@ -109,7 +110,6 @@ func newRollback(config *helmaction.Configuration, obj *v2.HelmRelease,
rollback.WaitStrategy = getWaitStrategy(obj.GetWaitStrategy(), obj.GetRollback())
rollback.WaitForJobs = !obj.GetRollback().DisableWaitForJobs
rollback.DisableHooks = obj.GetRollback().DisableHooks
rollback.ForceReplace = obj.GetRollback().Force
rollback.CleanupOnFail = obj.GetRollback().CleanupOnFail
rollback.MaxHistory = obj.GetMaxHistory()

Expand Down
4 changes: 3 additions & 1 deletion internal/action/rollback_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ func Test_newRollback(t *testing.T) {
got := newRollback(&helmaction.Configuration{}, obj, 0, nil)
g.Expect(got).ToNot(BeNil())
g.Expect(got.Timeout).To(Equal(obj.Spec.Rollback.Timeout.Duration))
g.Expect(got.ForceReplace).To(Equal(obj.Spec.Rollback.Force))
// ForceReplace is not set in the constructor; it is set after SSA resolution
// in Rollback() to avoid the Helm SDK mutual exclusivity error.
g.Expect(got.ForceReplace).To(BeFalse())
g.Expect(got.MaxHistory).To(Equal(obj.GetMaxHistory()))
})

Expand Down
2 changes: 1 addition & 1 deletion internal/action/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ func Upgrade(ctx context.Context, config *helmaction.Configuration, obj *v2.Helm
upgrade.ServerSideApply = fmt.Sprint(serverSideApply)
}
upgrade.ForceConflicts = serverSideApply // We always force conflicts on server-side apply.
upgrade.ForceReplace = obj.GetUpgrade().Force && !serverSideApply

policy, err := crdPolicyOrDefault(obj.GetUpgrade().CRDs)
if err != nil {
Expand Down Expand Up @@ -116,7 +117,6 @@ func newUpgrade(config *helmaction.Configuration, obj *v2.HelmRelease, opts []Up
upgrade.DisableHooks = obj.GetUpgrade().DisableHooks
upgrade.DisableOpenAPIValidation = obj.GetUpgrade().DisableOpenAPIValidation
upgrade.SkipSchemaValidation = obj.GetUpgrade().DisableSchemaValidation
upgrade.ForceReplace = obj.GetUpgrade().Force
upgrade.CleanupOnFail = obj.GetUpgrade().CleanupOnFail
upgrade.Devel = true

Expand Down
4 changes: 3 additions & 1 deletion internal/action/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ func Test_newUpgrade(t *testing.T) {
g.Expect(got).ToNot(BeNil())
g.Expect(got.Namespace).To(Equal(obj.Namespace))
g.Expect(got.Timeout).To(Equal(obj.Spec.Upgrade.Timeout.Duration))
g.Expect(got.ForceReplace).To(Equal(obj.Spec.Upgrade.Force))
// ForceReplace is not set in the constructor; it is set after SSA resolution
// in Upgrade() to avoid the Helm SDK mutual exclusivity error.
g.Expect(got.ForceReplace).To(BeFalse())
})

t.Run("timeout fallback", func(t *testing.T) {
Expand Down
Loading