Skip to content

Fix drift correction regression when correctDrift.force is false#4879

Merged
0xavi0 merged 3 commits into
rancher:release/v0.15from
0xavi0:fix-drift-correction-rollback
Mar 31, 2026
Merged

Fix drift correction regression when correctDrift.force is false#4879
0xavi0 merged 3 commits into
rancher:release/v0.15from
0xavi0:fix-drift-correction-rollback

Conversation

@0xavi0
Copy link
Copy Markdown
Contributor

@0xavi0 0xavi0 commented Mar 20, 2026

The Helm v4 migration set ServerSideApply to "auto" for non-force rollbacks. This caused Helm to auto-detect and reuse the apply method from the original release, which is SSA. Server-Side Apply tracks field ownership per field manager, so rollback only reverts fields owned by Helm's manager — manual changes owned by a different manager are silently ignored.

Setting ServerSideApply to "false" for all rollbacks forces client-side three-way merge, which compares the full resource state and patches all drifted fields regardless of ownership. This restores the Helm v3 behavior.

Refers to: #4878

Additional Information

Checklist

- [ ] I have updated the documentation via a pull request in the fleet-product-docs repository.

The Helm v4 migration set ServerSideApply to "auto" for non-force
rollbacks. This caused Helm to auto-detect and reuse the apply method
from the original release, which is SSA. Server-Side Apply tracks field
ownership per field manager, so rollback only reverts fields owned by
Helm's manager — manual changes owned by a different manager are
silently ignored.

Setting ServerSideApply to "false" for all rollbacks forces client-side
three-way merge, which compares the full resource state and patches all
drifted fields regardless of ownership. This restores the Helm v3
behavior.

Refers to: rancher#4878

Signed-off-by: Xavi Garcia <xavi.garcia@suse.com>
@0xavi0 0xavi0 added this to the v2.14.1 milestone Mar 20, 2026
@0xavi0 0xavi0 self-assigned this Mar 20, 2026
@0xavi0 0xavi0 added this to Fleet Mar 20, 2026
Signed-off-by: Xavi Garcia <xavi.garcia@suse.com>
@0xavi0 0xavi0 force-pushed the fix-drift-correction-rollback branch from e441d38 to dbb9c19 Compare March 23, 2026 15:53
@0xavi0 0xavi0 marked this pull request as ready for review March 23, 2026 16:07
@0xavi0 0xavi0 requested a review from a team as a code owner March 23, 2026 16:07
@0xavi0 0xavi0 requested a review from Copilot March 23, 2026 16:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a drift-correction regression introduced during the Helm v4 migration by ensuring rollbacks always use client-side three-way merge (disabling Server-Side Apply), so drifted fields get reverted even when field ownership differs.

Changes:

  • Always set Rollback.ServerSideApply = "false" during drift-correction rollbacks (regardless of correctDrift.force).
  • Expand/adjust integration tests to cover additional drift scenarios (labels, replicas, deletions, keepFailHistory, multi-resource drift, pause/off-schedule behavior).
  • Make the Service in the deployment-v1 test asset explicitly set spec.type: ClusterIP.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
internal/helmdeployer/rollback.go Forces client-side apply for rollback to restore Helm v3-like drift correction behavior when force is false.
integrationtests/agent/bundle_deployment_drift_test.go Adds/updates drift-correction integration coverage for more drift modes and controller behaviors.
integrationtests/agent/assets/deployment-v1.yaml Ensures the test Service explicitly includes spec.type for drift scenarios.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread integrationtests/agent/bundle_deployment_drift_test.go Outdated
@weyfonk weyfonk moved this to 👀 In review in Fleet Mar 27, 2026
Copy link
Copy Markdown
Contributor

@weyfonk weyfonk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :)

metadata:
name: svc-test
spec:
type: ClusterIP
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this should not change anything, being the default (ref); but having it explicitly set doesn't harm :)
Edit: probably done to make the test case editing the service type work 👍

@0xavi0 0xavi0 merged commit 3b438c6 into rancher:release/v0.15 Mar 31, 2026
22 checks passed
@github-project-automation github-project-automation Bot moved this from 👀 In review to ✅ Done in Fleet Mar 31, 2026
0xavi0 added a commit to 0xavi0/fleet that referenced this pull request Apr 7, 2026
…cher#4879)

* Fix drift correction regression when correctDrift.force is false

The Helm v4 migration set ServerSideApply to "auto" for non-force
rollbacks. This caused Helm to auto-detect and reuse the apply method
from the original release, which is SSA. Server-Side Apply tracks field
ownership per field manager, so rollback only reverts fields owned by
Helm's manager — manual changes owned by a different manager are
silently ignored.

Setting ServerSideApply to "false" for all rollbacks forces client-side
three-way merge, which compares the full resource state and patches all
drifted fields regardless of ownership. This restores the Helm v3
behavior.

Refers to: rancher#4878

---------

Signed-off-by: Xavi Garcia <xavi.garcia@suse.com>
thardeck pushed a commit that referenced this pull request Apr 14, 2026
…) (#4939)

* Fix drift correction regression when correctDrift.force is false

The Helm v4 migration set ServerSideApply to "auto" for non-force
rollbacks. This caused Helm to auto-detect and reuse the apply method
from the original release, which is SSA. Server-Side Apply tracks field
ownership per field manager, so rollback only reverts fields owned by
Helm's manager — manual changes owned by a different manager are
silently ignored.

Setting ServerSideApply to "false" for all rollbacks forces client-side
three-way merge, which compares the full resource state and patches all
drifted fields regardless of ownership. This restores the Helm v3
behavior.

Refers to: #4878

---------

Signed-off-by: Xavi Garcia <xavi.garcia@suse.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants