-
Notifications
You must be signed in to change notification settings - Fork 150
Retry NGINX provisioning on all errors #4399
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
Conversation
Problem: Formerly, we would not retry provisioning if we got an error that a resource already exists. However, in certain cases, the timing was just right where back to back calls to CreateOrUpdate would result in the second call initially not finding the resource (as it was being created but didn't exist yet), and then when it decided to call Create, the resource now existed, and it would fail to update the resource to the new change. Solution: Retry the CreateOrUpdate call no matter what error is returned. This ensures that if we happen to hit this quick succession scenario, the second update call would eventually succeed and not fail immediately, after the CreateOrUpdate function determined that the resource does exist and simply needs an update, not a Create. Also added a return statement to safeguard against potential panics if an object is nil, due to a similar potential timing issue.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4399 +/- ##
==========================================
- Coverage 86.16% 86.11% -0.06%
==========================================
Files 132 132
Lines 14376 14381 +5
Branches 35 35
==========================================
- Hits 12387 12384 -3
- Misses 1780 1786 +6
- Partials 209 211 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
bjee19
left a comment
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.
nice fix! Might also be good to add a release note about it
Good call, meant to do that and forgot. Thanks. |
Problem: Formerly, we would not retry provisioning if we got an error that a resource already exists. However, in certain cases, the timing was just right where back to back calls to CreateOrUpdate would result in the second call initially not finding the resource (as it was being created but didn't exist yet), and then when it decided to call Create, the resource now existed, and it would fail to update the resource to the new change.
Solution: Retry the CreateOrUpdate call no matter what error is returned. This ensures that if we happen to hit this quick succession scenario, the second update call would eventually succeed and not fail immediately, after the CreateOrUpdate function determined that the resource does exist and simply needs an update, not a Create.
Also added a return statement to safeguard against potential panics if an object is nil, due to a similar potential timing issue.
Testing: Multiple attempts at reproducing the issue, didn't see it occur anymore.
Closes #4326
Checklist
Before creating a PR, run through this checklist and mark each as complete.
Release notes
If this PR introduces a change that affects users and needs to be mentioned in the release notes,
please add a brief note that summarizes the change.