Skip to content
New issue

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

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

Already on GitHub? # to your account

fix(appset): Fix perpetual appset reconciliation #19822

Merged
merged 1 commit into from
Sep 13, 2024

Conversation

tjamet
Copy link
Contributor

@tjamet tjamet commented Sep 6, 2024

ScmProvider does not guarantee order of the application resources from the applicationset which causes rapid sync activity for the applicationset as the objects and hence their resourceVersions are updated after each reconcile loop.

This then triggers reconciliation of all objects watching the ApplicationSet.

In order to prevent this behaviour, ensure that the ApplicationSet reconciler provides an idempotent list of resources, ensuring objects are not updated.

Fixes: #19757

This PR is an alternate approach to #19676.

In #19676, the approach is to only reconcile based on generation changes, i.e. spec changes as defined by the generation implementation in CRDs.
This means that, with this PR, any change of metadata (labels, annotations, ...) or status will be taken into consideration on the next run (triggered by requeueAfter, 3mn by default in my trials), which is the way new SCM repos or folders are discovered from my understanding.

This PR takes a different approach, ensuring that status updates are idempotent across reconcile loops and hence prevents from triggering any reconciliation in other reconcilers unless there is an actual change on the ApplicationSet.

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).

@tjamet tjamet requested a review from a team as a code owner September 6, 2024 14:31
Copy link

bunnyshell bot commented Sep 6, 2024

❌ Preview Environment deleted from Bunnyshell

Available commands (reply to this comment):

  • 🚀 /bns:deploy to deploy the environment

Copy link

bunnyshell bot commented Sep 6, 2024

❌ Preview Environment deleted from Bunnyshell

Available commands (reply to this comment):

  • 🚀 /bns:deploy to deploy the environment

Copy link

codecov bot commented Sep 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (master@031fb88). Learn more about missing BASE report.
Report is 39 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master   #19822   +/-   ##
=========================================
  Coverage          ?   55.84%           
=========================================
  Files             ?      320           
  Lines             ?    44381           
  Branches          ?        0           
=========================================
  Hits              ?    24786           
  Misses            ?    17027           
  Partials          ?     2568           

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

@tjamet
Copy link
Contributor Author

tjamet commented Sep 6, 2024

I see there is a license check problem, if I read correctly, the problem also appears on other PRs, is there anything needed from us to fix it?

@Fsero Fsero force-pushed the appset-resource-status branch 4 times, most recently from 6aed467 to aa67e2d Compare September 10, 2024 07:49
Golang maps do not guarantee the order of the application resources
from the applicationset which causes rapid sync activity for the applicationset
as the objects and hence their resourceVersions are updated after each reconcile loop.

This then triggers reconciliation of all objects watching the
ApplicationSet.

In order to prevent this behaviour, ensure that the ApplicationSet
reconciler provides an idempotent list of resources, ensuring objects
are not updated.

Fixes: argoproj#19757

Co-authored-by: Fabian Selles <fabian.sellesrosa@gmail.com>
Co-authored-by: Ariadna Rouco <ariadna.rouco@adevinta.com>
Signed-off-by: Thibault Jamet <thibault.jamet@adevinta.com>
Signed-off-by: Fabián Sellés <fabian.selles@adevinta.com>
Copy link
Contributor

@jetersen jetersen left a comment

Choose a reason for hiding this comment

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

Looks good to me 👍 Thanks for implementing a fix for #19757

Copy link
Member

@agaudreault agaudreault left a comment

Choose a reason for hiding this comment

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

LGTM

@agaudreault agaudreault merged commit 42c001d into argoproj:master Sep 13, 2024
27 of 28 checks passed
@jetersen
Copy link
Contributor

Would be great to get a patch release for this, it is very noisy inside our etcd 😓

@gmauleon
Copy link

yes please! 👆 🙏

@agaudreault
Copy link
Member

/cherry-pick release-2.12

gcp-cherry-pick-bot bot pushed a commit that referenced this pull request Sep 18, 2024
Golang maps do not guarantee the order of the application resources
from the applicationset which causes rapid sync activity for the applicationset
as the objects and hence their resourceVersions are updated after each reconcile loop.

This then triggers reconciliation of all objects watching the
ApplicationSet.

In order to prevent this behaviour, ensure that the ApplicationSet
reconciler provides an idempotent list of resources, ensuring objects
are not updated.

Fixes: #19757

Signed-off-by: Thibault Jamet <thibault.jamet@adevinta.com>
Signed-off-by: Fabián Sellés <fabian.selles@adevinta.com>
Co-authored-by: Fabian Selles <fabian.sellesrosa@gmail.com>
Co-authored-by: Ariadna Rouco <ariadna.rouco@adevinta.com>
gdsoumya pushed a commit that referenced this pull request Sep 19, 2024
Golang maps do not guarantee the order of the application resources
from the applicationset which causes rapid sync activity for the applicationset
as the objects and hence their resourceVersions are updated after each reconcile loop.

This then triggers reconciliation of all objects watching the
ApplicationSet.

In order to prevent this behaviour, ensure that the ApplicationSet
reconciler provides an idempotent list of resources, ensuring objects
are not updated.

Fixes: #19757

Signed-off-by: Thibault Jamet <thibault.jamet@adevinta.com>
Signed-off-by: Fabián Sellés <fabian.selles@adevinta.com>
Co-authored-by: Thibault Jamet <tjamet@users.noreply.github.com>
Co-authored-by: Fabian Selles <fabian.sellesrosa@gmail.com>
Co-authored-by: Ariadna Rouco <ariadna.rouco@adevinta.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ArgoCD applicationset scm provider does not guarantee status resources order
4 participants