fix: respect ApplicationSet update policy in progressive sync (#29142) - #29145
fix: respect ApplicationSet update policy in progressive sync (#29142)#29145himeshp wants to merge 1 commit into
Conversation
Signed-off-by: himeshp <himeshp@users.noreply.github.com>
✅ Preview Environment deployed on Bunnyshell
See: Environment Details | Pipeline Logs Available commands (reply to this comment):
|
PR Summary by QodoFix progressive sync to honor effective ApplicationSet update policy
AI Description
Diagram
High-Level Assessment
Files changed (4)
|
Bundle ReportBundle size has no change ✅ |
Code Review by Qodo
1. Unneeded diffConfig build
|
| // Only report spec changes that the effective policy allows the write path to apply. | ||
| specChanged := false | ||
| if desiredApp, ok := desiredAppsMap[app.Name]; ok { | ||
| if desiredApp, ok := desiredAppsMap[app.Name]; ok && effectivePolicy.AllowUpdate() { | ||
| // Compare the desired spec with the current spec to detect non-Git changes |
There was a problem hiding this comment.
1. Unneeded diffconfig build 🐞 Bug ➹ Performance
UpdateApplicationSetApplicationStatus now skips spec comparison unless effectivePolicy.AllowUpdate(), but it still builds the ignore-diff DiffConfig unconditionally, which becomes unused for create-only/create-delete policies. This adds unnecessary work and can still fail reconciliation if DiffConfig building errors even though updates/spec comparisons are disabled by policy.
Agent Prompt
### Issue description
`UpdateApplicationSetApplicationStatus` now gates spec comparisons behind `effectivePolicy.AllowUpdate()`, but it still builds `diffConfig` unconditionally. For no-update policies, the build is wasted and can still return an error that aborts reconciliation even though spec comparison can never run.
### Issue Context
- `diffConfig` is only used by `utils.SpecsEquivalent(...)` in the spec-change detection block.
- The PR added `&& effectivePolicy.AllowUpdate()` to that block, so for create-only/create-delete the config is unused.
### Fix Focus Areas
- applicationset/progressivesync/progressive_sync.go[400-468]
### Suggested fix
- Only call `utils.BuildIgnoreDiffConfig(...)` when `effectivePolicy.AllowUpdate()` is true (and/or right before the first possible `SpecsEquivalent` call).
- Keep behavior unchanged for update-allowed policies; for update-disallowed policies, skip building `diffConfig` entirely.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #29145 +/- ##
=======================================
Coverage 65.61% 65.61%
=======================================
Files 427 427
Lines 60564 60565 +1
=======================================
+ Hits 39738 39741 +3
Misses 17189 17189
+ Partials 3637 3635 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
Progressive Sync treated generated spec changes as pending updates even when the effective ApplicationSet policy did not allow updates. This caused the status to loop between
WaitingandPending.This passes the effective policy into the progressive sync status calculation and only checks spec changes when updates are allowed.
Fixes #29142
We reproduced the issue with a RollingSync ApplicationSet using
create-only. With the generated spec atv2and the live Application atv1, the unpatched controller repeatedly moved the status betweenWaitingandPending. With this fix, the status remained stable and the live Application was not updated.Checklist:
release-3.5,release-3.4, andrelease-3.3.