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 reduce redundant reconciles (#12457) #12480

Merged
merged 38 commits into from
Mar 28, 2023

Conversation

rumstead
Copy link
Contributor

fixes #12457

Note on DCO:

If the DCO action in the integration test fails, one or more of your commits are not signed off. Please click on the Details link next to the DCO action for instructions on how to resolve this.

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).
  • 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.
  • Optional. My organization is added to USERS.md.
  • 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).

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
@codecov
Copy link

codecov bot commented Feb 15, 2023

Codecov Report

Patch coverage: 86.79% and project coverage change: +0.04 🎉

Comparison is base (82f006c) 48.94% compared to head (72f96e0) 48.99%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #12480      +/-   ##
==========================================
+ Coverage   48.94%   48.99%   +0.04%     
==========================================
  Files         246      246              
  Lines       42435    42486      +51     
==========================================
+ Hits        20770    20816      +46     
- Misses      19555    19559       +4     
- Partials     2110     2111       +1     
Impacted Files Coverage Δ
...cationset/controllers/applicationset_controller.go 63.44% <86.79%> (+1.40%) ⬆️

... and 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@rumstead
Copy link
Contributor Author

rumstead commented Feb 15, 2023

TODO: Add tests

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
Copy link
Collaborator

@crenshaw-dev crenshaw-dev left a comment

Choose a reason for hiding this comment

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

@rumstead I just remembered... when progressive syncs are enabled, and when the applicationset has a sync strategy, we should trigger reconciles on changes to certain parts of the status field. Specifically, looks like we care about

  • status.health.status
  • status.sync.status
  • status.operationstate
  • status.operationstate.phase

@wmgroot am I missing anything?

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
@rumstead
Copy link
Contributor Author

rumstead commented Feb 22, 2023

@rumstead I just remembered... when progressive syncs are enabled, and when the applicationset has a sync strategy, we should trigger reconciles on changes to certain parts of the status field. Specifically, looks like we care about

  • status.health.status
  • status.sync.status
  • status.operationstate
  • status.operationstate.phase

@wmgroot am I missing anything?

Great catch. It took me a while to understand the different statuses.

The statuses on the applicationset track the statuses of the owned applications. The owned applications have their statuses updated by the application controller. Thus, when the application controller updates one of those statuses, we would want to reconcile to trigger the next step in the progressive sync.

@wmgroot
Copy link
Contributor

wmgroot commented Feb 22, 2023

I believe those will cover what the Progressive Syncs feature needs.

func statusStrings(app argov1alpha1.Application) (string, string, string) {
healthStatusString := string(app.Status.Health.Status)
syncStatusString := string(app.Status.Sync.Status)
operationPhaseString := ""
if app.Status.OperationState != nil {
operationPhaseString = string(app.Status.OperationState.Phase)
}
return healthStatusString, syncStatusString, operationPhaseString
}

@wmgroot
Copy link
Contributor

wmgroot commented Feb 22, 2023

Assuming Status.OperationState covers Status.OperationState.StartedAt we should be good.

if operationPhaseString == "Succeeded" && app.Status.OperationState.StartedAt.After(currentAppStatus.LastTransitionTime.Time) {

Edit: Looks like it isn't covered, I added a comment.

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
@rumstead
Copy link
Contributor Author

@crenshaw-dev just wanted to see if you had any bandwidth soon to review the bug fix?

Copy link
Collaborator

@crenshaw-dev crenshaw-dev left a comment

Choose a reason for hiding this comment

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

Small things

@crenshaw-dev
Copy link
Collaborator

/cherry-pick release-2.7

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
@crenshaw-dev
Copy link
Collaborator

@rumstead how would you feel about me just cherry-picking this back to 2.7? If it behaves, and folks later want it picked further-back, I'd be happy to do that.

@rumstead
Copy link
Contributor Author

@rumstead how would you feel about me just cherry-picking this back to 2.7? If it behaves, and folks later want it picked further-back, I'd be happy to do that.

I know I wouldn't mind this picked back to 2.4 (of the appset controller). To be on the safer route, I think it makes sense to soak in 2.7.

@crenshaw-dev
Copy link
Collaborator

Word, let's give it some time in 2.7 and then look at picking it further back. Thanks!

Copy link
Collaborator

@crenshaw-dev crenshaw-dev left a comment

Choose a reason for hiding this comment

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

Looks great to me.

@crenshaw-dev crenshaw-dev enabled auto-merge (squash) March 28, 2023 13:52
@crenshaw-dev crenshaw-dev merged commit 772721b into argoproj:master Mar 28, 2023
gcp-cherry-pick-bot bot pushed a commit that referenced this pull request Mar 28, 2023
* fix: applicationset reduce redundant reconciles

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>

* fix: applicationset reduce redundant reconciles

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>

* adding tests

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>

* every line counts

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>

* deep copy applications from event object

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>

* update from code review

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>

* check progressive sync fields

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>

* check progressive sync fields

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>

* selective checks for progressive syncs

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>

* selective checks for progressive syncs

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>

* pural

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>

---------

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
@rumstead rumstead deleted the fix/reduce-reconciles branch March 28, 2023 14:35
crenshaw-dev pushed a commit that referenced this pull request Mar 28, 2023
…3029)

* fix: applicationset reduce redundant reconciles



* fix: applicationset reduce redundant reconciles



* adding tests



* every line counts



* deep copy applications from event object



* update from code review



* check progressive sync fields



* check progressive sync fields



* selective checks for progressive syncs



* selective checks for progressive syncs



* pural



---------

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
Co-authored-by: rumstead <37445536+rumstead@users.noreply.github.com>
schakrad pushed a commit to schakrad/argo-cd that referenced this pull request Jul 24, 2023
…oproj#12480) (argoproj#13029)

* fix: applicationset reduce redundant reconciles

* fix: applicationset reduce redundant reconciles

* adding tests

* every line counts

* deep copy applications from event object

* update from code review

* check progressive sync fields

* check progressive sync fields

* selective checks for progressive syncs

* selective checks for progressive syncs

* pural

---------

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
Co-authored-by: rumstead <37445536+rumstead@users.noreply.github.com>
Signed-off-by: schakrad <58915923+schakrad@users.noreply.github.com>
yyzxw pushed a commit to yyzxw/argo-cd that referenced this pull request Aug 9, 2023
…oproj#12480)

* fix: applicationset reduce redundant reconciles

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>

* fix: applicationset reduce redundant reconciles

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>

* adding tests

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>

* every line counts

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>

* deep copy applications from event object

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>

* update from code review

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>

* check progressive sync fields

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>

* check progressive sync fields

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>

* selective checks for progressive syncs

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>

* selective checks for progressive syncs

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>

* pural

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>

---------

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
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.

ApplicationSet owning (watching) Applications triggers redundant reconciles of ApplicationSets
5 participants