Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ApplicationSet): Check strategy type to verify it's a progressive sync #22563

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

fcrespofastly
Copy link

@fcrespofastly fcrespofastly commented Apr 3, 2025

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • The title of the PR conforms to the Toolchain Guide
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).
  • My new feature complies with the feature status guidelines.
  • I have added a brief description of why this PR is necessary and/or what this PR solves.
  • Optional. My organization is added to USERS.md.
  • Optional. For bug fixes, I've indicated what older releases this fix should be cherry-picked into (this may or may not happen depending on risk/complexity).

Description

From ArgoCD Progressive-Syncs manual argocd supports two strategies for applicationSets, AllAtOnce or RollingSync. Being AllAtOnce the default when no strategy is selected.

On the other hand, it seems that within the appset controller logic, there's a path in the code: https://github.com/argoproj/argo-cd/blob/master/applicationset/controllers/applicationset_controller.go#L213-L225

Where we do not check exhaustively the strategy type and thus:

strategy:
  type: AllAtOnce

Can cause an infinite reconciliation loop. See:

#14712
#22558

Signed-off-by: Fernando Crespo Gravalos <fcrespo@fastly.com>
@fcrespofastly fcrespofastly requested a review from a team as a code owner April 3, 2025 21:44
Copy link

bunnyshell bot commented Apr 3, 2025

❗ Preview Environment deployment failed on Bunnyshell

See: Environment Details | Pipeline Logs

Available commands (reply to this comment):

  • 🚀 /bns:deploy to redeploy the environment
  • /bns:delete to remove the environment

@rumstead
Copy link
Member

rumstead commented Apr 4, 2025

@fcrespofastly thanks for the PR! some build and linting errors need to be addressed. Additionally, please add some tests, especially one that reproduces the bug.

@jbmothiki
Copy link

Yola

@fcrespofastly
Copy link
Author

Hey folks! Just a quick not to let you know that I'm still working on it last week with ArgoCon and KubeCon was a bit busy, so didn't have much time to work on this.

Signed-off-by: Fernando Crespo Gravalos <fcrespo@fastly.com>
@fcrespofastly fcrespofastly changed the title Check strategy type to verify it's a progressive sync fix(ApplicationSet): Check strategy type to verify it's a progressive sync Apr 8, 2025
Signed-off-by: Fernando Crespo Gravalos <fcrespo@fastly.com>
Copy link

codecov bot commented Apr 8, 2025

Codecov Report

Attention: Patch coverage is 55.55556% with 4 lines in your changes missing coverage. Please review.

Project coverage is 56.02%. Comparing base (73495d0) to head (624771e).
Report is 19 commits behind head on master.

Files with missing lines Patch % Lines
...cationset/controllers/applicationset_controller.go 55.55% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #22563      +/-   ##
==========================================
+ Coverage   55.96%   56.02%   +0.05%     
==========================================
  Files         343      343              
  Lines       57527    57531       +4     
==========================================
+ Hits        32197    32230      +33     
+ Misses      22679    22649      -30     
- Partials     2651     2652       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fcrespofastly
Copy link
Author

Hey @rumstead 👋🏻

Updated the PR and added some tests. Let me know what you think. Does all of this make sense to you?

@@ -1000,8 +1000,14 @@ func appSyncEnabledForNextStep(appset *argov1alpha1.ApplicationSet, app argov1al
return true
}

func isRollingSyncStrategy(appset *argov1alpha1.ApplicationSet) bool {
// It's only RollingSync if it's especifically set by the type
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// It's only RollingSync if it's especifically set by the type
// It's only RollingSync if the type specifically sets it

@rumstead
Copy link
Member

rumstead commented Apr 8, 2025

Hey @rumstead 👋🏻

Updated the PR and added some tests. Let me know what you think. Does all of this make sense to you?

The code and tests make sense, I think it would be great if we can reproduce the bug via the reconcile loop and have a test that fails before your change and passes after. the current tests pass before and after your change.

@fcrespofastly
Copy link
Author

fcrespofastly commented Apr 8, 2025

Hey @rumstead 👋🏻
Updated the PR and added some tests. Let me know what you think. Does all of this make sense to you?

The code and tests make sense, I think it would be great if we can reproduce the bug via the reconcile loop and have a test that fails before your change and passes after. the current tests pass before and after your change.

Yeah I've been looking into it as well, it's just going to be tricky. To be clear with my change nothing should fail, it should still reconcile but not in a progressive sync fashion if not explicitly set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants