Skip to content
This repository was archived by the owner on May 14, 2026. It is now read-only.

fix: handle stale BeforeHookCreation resources as progressing - #461

Closed
nazarewk wants to merge 2 commits into
argoproj:masterfrom
freshaengineering:fix-before-hook-creation
Closed

nazarewk wants to merge 2 commits into
argoproj:masterfrom
freshaengineering:fix-before-hook-creation

Conversation

@nazarewk

@nazarewk nazarewk commented Sep 13, 2022 •

Copy link
Copy Markdown

TLDR; DELETE event during handling of BeforeHookCreation deletion policy can be delayed while etcd is running garbage collection:
1. at the same time "finished" hook is present in the cache,
2. gitops-engine does not verify creation timestamp of BeforeHookCreation objects against start time of sync operation,
3. gitops-engine is unaware (old) object should be purged from cache and happily proceeds to next Sync Wave

The PR fixes this specific failure mode with minimal changes to the code.

The change is impossible to reproduce as etcd's GC usually does not take long enough to trigger the issue. At the same time it is very difficult to debug.

the EKS cluster I observed issues at had tens of thousands objects with >1k objects churned every few minutes and still GC triggered the issue only few times a week

fixes #446
closes argoproj/argo-cd#10579
original issue argoproj/argo-cd#10077

@nazarewk
nazarewk force-pushed the fix-before-hook-creation branch from 5c153c9 to ed6a1e1 Compare September 13, 2022 13:06
@nazarewk
nazarewk force-pushed the fix-before-hook-creation branch from ed6a1e1 to 407dc83 Compare September 13, 2022 13:09
@nazarewk
nazarewk marked this pull request as ready for review September 13, 2022 13:10
@codecov

codecov Bot commented Sep 13, 2022 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 55.59%. Comparing base (517c1ff) to head (e4d98aa).
⚠️ Report is 117 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #461      +/-   ##
==========================================
+ Coverage   55.38%   55.59%   +0.21%     
==========================================
  Files          41       41              
  Lines        4478     4493      +15     
==========================================
+ Hits         2480     2498      +18     
+ Misses       1807     1804       -3     
  Partials      191      191              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nazarewk
nazarewk force-pushed the fix-before-hook-creation branch from 407dc83 to 7631b8e Compare September 13, 2022 13:29
- fixes argoproj#446
- closes argoproj/argo-cd#10579
- original issue argoproj/argo-cd#10077

Signed-off-by: Krzysztof Nazarewski <3494992+nazarewk@users.noreply.github.com>
@nazarewk
nazarewk force-pushed the fix-before-hook-creation branch from 7631b8e to 327f8d9 Compare September 14, 2022 09:01
@nazarewk
nazarewk marked this pull request as draft September 14, 2022 11:55
@nazarewk

This comment was marked as outdated.

Signed-off-by: Krzysztof Nazarewski <3494992+nazarewk@users.noreply.github.com>
@nazarewk
nazarewk force-pushed the fix-before-hook-creation branch from 4382fe9 to e4d98aa Compare September 14, 2022 13:30
@nazarewk
nazarewk marked this pull request as ready for review September 14, 2022 13:30
@sonarqubecloud

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@nazarewk

Copy link
Copy Markdown
Author

managed to fully test expected flow, PR is ready for review

@rbreeze
rbreeze requested a review from alexmt October 20, 2022 15:50
@crenshaw-dev crenshaw-dev changed the title handle stale BeforeHookCreation resources as progressing fix: handle stale BeforeHookCreation resources as progressing Dec 9, 2022

@leoluz leoluz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks a lot @nazarewk for this work!

Please make sure to create a PR in Argo CD repo pointing to this change so we can validate that all integration and e2e tests are passing. It would be great to make sure that there is an existing integration or e2e test that validates this scenario. If such test is not yet implemented it would be awesome to add it in Argo CD test suite.

@ppapapetrou76

Copy link
Copy Markdown
Contributor

The gitops-engine repository is migrating to https://github.com/argoproj/argo-cd. We are closing all draft PRs.
Please feel free to submit it again once the migration is over.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: cache does not get invalidated on resource deletion?

4 participants