-
Notifications
You must be signed in to change notification settings - Fork 31
Add some resilience to toggling allowPXE in Hardware: #254
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
There were some observed errors with toggling allowPXE. "Operation cannot be fulfilled on the object has been modified; please apply your changes to the latest version and try again" This gets the Hardware object again so that the Update will be successful. Signed-off-by: Jacob Weinstock <[email protected]>
Use a for loop instead of goto. goto's are difficult to debug and maintain. Handle nil spec.interfaces.netboot structs. Signed-off-by: Jacob Weinstock <[email protected]>
Signed-off-by: Jacob Weinstock <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #254 +/- ##
==========================================
+ Coverage 48.08% 48.39% +0.30%
==========================================
Files 102 102
Lines 8622 8648 +26
==========================================
+ Hits 4146 4185 +39
+ Misses 4217 4208 -9
+ Partials 259 255 -4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: Jacob Weinstock <[email protected]>
Provides a backoff to retrying the Get Hardware calls to the Kube API server. Signed-off-by: Jacob Weinstock <[email protected]>
Signed-off-by: Jacob Weinstock <[email protected]>
Signed-off-by: Jacob Weinstock <[email protected]>
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.
Pull Request Overview
This PR adds resilience to toggling the allowPXE field in Hardware objects by implementing a retry mechanism with exponential backoff to handle conflict errors that occur when multiple processes attempt to modify the same Hardware object simultaneously.
- Implements retry logic with exponential backoff for handling Kubernetes API conflict errors
- Adds comprehensive test coverage for the retry mechanism and various edge cases
- Updates existing test calls to include the new backoff configuration parameter
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
tink/controller/internal/workflow/hardware.go |
Implements retry mechanism with exponential backoff for setAllowPXE function to handle conflict errors |
tink/controller/internal/workflow/hardware_test.go |
Adds comprehensive test suite covering retry mechanisms, conflict scenarios, and edge cases |
tink/controller/internal/workflow/reconciler_test.go |
Updates existing test call to include new backoff configuration parameter |
Description
Some observed errors were noted when toggling allowPXE.
"Operation cannot be fulfilled on the object has been modified; please apply your changes to the latest version and try again"This updates the code to get the Hardware object again so that the Update will be successful.
Why is this needed
Fixes: #
How Has This Been Tested?
How are existing users impacted? What migration steps/scripts do we need?
Checklist:
I have: