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: inject artificial delay between sync waves to better support health assessments #4715

Merged
merged 1 commit into from
Nov 2, 2020

Conversation

jessesuen
Copy link
Member

Resolves #4669

Reduces (but does not eliminate) the possibility of sync waves/hooks firing pre-maturely, by introducing an artificial delay between each sync waves, allowing external controllers to react to the spec changes which were just applied.

Signed-off-by: Jesse Suen jesse_suen@intuit.com

go.mod Outdated Show resolved Hide resolved
@codecov-io
Copy link

codecov-io commented Oct 30, 2020

Codecov Report

Merging #4715 into master will decrease coverage by 0.16%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4715      +/-   ##
==========================================
- Coverage   41.28%   41.11%   -0.17%     
==========================================
  Files         127      127              
  Lines       17484    17556      +72     
==========================================
+ Hits         7218     7219       +1     
- Misses       9233     9306      +73     
+ Partials     1033     1031       -2     
Impacted Files Coverage Δ
controller/sync.go 67.47% <0.00%> (-4.70%) ⬇️
controller/appcontroller.go 50.56% <0.00%> (-1.92%) ⬇️
pkg/apis/application/v1alpha1/types.go 56.84% <0.00%> (-1.14%) ⬇️
reposerver/repository/repository.go 59.88% <0.00%> (-1.07%) ⬇️
cmd/argocd/commands/cluster.go 11.53% <0.00%> (-0.50%) ⬇️
server/cluster/cluster.go 17.85% <0.00%> (-0.33%) ⬇️
util/git/client.go 50.00% <0.00%> (+2.36%) ⬆️
util/webhook/webhook.go 59.76% <0.00%> (+2.70%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 21304ee...89715a9. Read the comment docs.

@jessesuen jessesuen force-pushed the sync-wave-delays branch 5 times, most recently from 0cd1ec9 to e084700 Compare November 2, 2020 09:48
Comment on lines -39 to -49
Expect(OperationPhaseIs(OperationFailed)).
Expect(SyncStatusIs(SyncStatusCodeOutOfSync)).
Expect(HealthIs(health.HealthStatusMissing)).
Expect(ResourceResultNumbering(1)).
Expect(ResourceSyncStatusIs("Pod", "pod-1", SyncStatusCodeSynced)).
Expect(ResourceHealthIs("Pod", "pod-1", health.HealthStatusHealthy)).
Expect(ResourceSyncStatusIs("Pod", "pod-2", SyncStatusCodeOutOfSync)).
Expect(ResourceHealthIs("Pod", "pod-2", health.HealthStatusMissing)).
When().
Sync().
Then().
Copy link
Member Author

@jessesuen jessesuen Nov 2, 2020

Choose a reason for hiding this comment

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

The reason this was deleted is because this test had two syncs in a row (even though nothing changed in between those two syncs). The first sync would immediately detect the pod in a ImagePullBackoff state (from the previous state) and always fail.

After my change, the 2-second delay actually allowed the pod time to go from Degraded->Healthy, so that by the time the controller re-reconciled the operation, it saw the pod was healthy and the sync would succeed.

…lth assessments

Signed-off-by: Jesse Suen <jesse_suen@intuit.com>
Copy link
Collaborator

@alexmt alexmt left a comment

Choose a reason for hiding this comment

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

LGTM

@jessesuen jessesuen merged commit dea75eb into argoproj:master Nov 2, 2020
@jessesuen jessesuen deleted the sync-wave-delays branch November 2, 2020 20:17
terrycorley pushed a commit to terrycorley/argo-cd that referenced this pull request Nov 3, 2020
…zation-generators

* 'master' of github.com:argoproj/argo-cd:
  fix: RevisionFormField component crashes in 'refs' API returns no tags (argoproj#4735)
  docs: add Opensurvey to USERS.md (argoproj#4727)
  docs: correct parameters usage in CLI (argoproj#4725)
  fix: Repo-server has silent unmarshalling errors leading to empty applications (argoproj#4423) (argoproj#4708)
  fix: inject artificial delay between sync waves to better support health assessments (argoproj#4715)
  fix: exclude files listed under exclusions (argoproj#4686)
  feat: support resource actions on CRDs that use status subresources (argoproj#4690)
  feat: Add autocomplete for repo Revisions (argoproj#4645) (argoproj#4713)
  fix: webhook don't refresh apps pointing to HEAD (argoproj#4717)
  feat: Add support for ExecProvider cluster auth (argoproj#4600) (argoproj#4710)
  fix: adding helm values file in New App (argoproj#4635)
  docs: Instructions on `make verify-kube-connect` step when using k3d (argoproj#4687)
  feat:  Annotation based app paths detection in webhooks (argoproj#4699)
  fix: adding commonAnnotations for Kustomize (argoproj#4613)
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.

Argo CD might progress through waves/PostSync prematurely
4 participants