-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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(settings): race condition on settings configMap #21225
Conversation
Signed-off-by: Alexandre Gaudreault <[email protected]>
❌ Preview Environment deleted from BunnyshellAvailable commands (reply to this comment):
|
Signed-off-by: Alexandre Gaudreault <[email protected]>
Signed-off-by: Alexandre Gaudreault <[email protected]>
Signed-off-by: Alexandre Gaudreault <[email protected]>
Signed-off-by: Alexandre Gaudreault <[email protected]>
Signed-off-by: Alexandre Gaudreault <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #21225 +/- ##
==========================================
+ Coverage 55.03% 55.07% +0.03%
==========================================
Files 338 338
Lines 57075 57048 -27
==========================================
+ Hits 31410 31417 +7
+ Misses 22968 22933 -35
- Partials 2697 2698 +1 ☔ View full report in Codecov by Sentry. |
Will test in a real instance with #21208 and 2.13. Edit: tested and seems to work without issues |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* fix(settings): race condition on settings configMap Signed-off-by: Alexandre Gaudreault <[email protected]> * fix secret update Signed-off-by: Alexandre Gaudreault <[email protected]> * simplify sync method usage Signed-off-by: Alexandre Gaudreault <[email protected]> * remove unnecessary lister usage Signed-off-by: Alexandre Gaudreault <[email protected]> * tests Signed-off-by: Alexandre Gaudreault <[email protected]> * fix cache nil ref Signed-off-by: Alexandre Gaudreault <[email protected]> --------- Signed-off-by: Alexandre Gaudreault <[email protected]> Signed-off-by: Brett C. Dudo <[email protected]>
Sometimes, the test are failing with a race condition on settings usage. We return a pointer to the value of the ArgoCM in multiple thread and assume all methods will be nice and never update the object.
updateConfigMap
exist to write back the configMap to Kubernetes. Updating the object in the informer should never be done. The same is true for the secretsThis PR returns a deepCopy of what is in the informer, causing a slight performance impact. However, now threads can modify that object without side effects on other threads. The usage is simpler than using a RW Mutex or a concurrent map.
This is not perfect, because the secret informer/lister are exposed externally, but it improves the current situation.
Ran on https://github.com/argoproj/argo-cd/commits/3057a285bc2dde547db0947f62115f32c4804838