-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix graceful eviction race condition causing premature Work deletion #7129
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
base: master
Are you sure you want to change the base?
Fix graceful eviction race condition causing premature Work deletion #7129
Conversation
Summary of ChangesHello @Aman-Cool, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves a critical race condition within the graceful eviction controller that could result in Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request effectively addresses a critical race condition in the graceful eviction process. The solution is well-designed, ensuring the status controller updates AggregatedStatus upon scheduling changes and that the eviction controller verifies status freshness before acting. This prevents premature Work deletion during failover. The code changes are clear, well-commented, and include thorough testing for the new logic. I've identified one potential issue in a new helper function and provided a suggestion for a more robust implementation.
d43acb0 to
dcf4e60
Compare
|
This PR fixes a race where graceful eviction can act on stale status during failover, causing workloads to be deleted before the new cluster is ready. The change makes eviction wait for up-to-date status, preventing accidental downtime. |
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7129 +/- ##
=======================================
Coverage 46.54% 46.54%
=======================================
Files 700 700
Lines 48134 48163 +29
=======================================
+ Hits 22403 22419 +16
- Misses 24045 24056 +11
- Partials 1686 1688 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
The graceful eviction controller could make eviction decisions based on stale AggregatedStatus, causing premature deletion of Works during cluster failover. This fix: - Triggers status controller when Spec.Clusters changes - Adds statusUpToDate check before allowing eviction task removal Signed-off-by: Aman-Cool <[email protected]>
3496e8b to
20c106c
Compare
|
Hi @Aman-Cool Thank you for your feedback. |
|
Hi @XiShanYongYe-Chang , thanks for taking a look. |
|
Test Plan
Expected behavior
Verification
|
|
Thanks @Aman-Cool Let me take a look at this. By the way, may I ask what your company is? Are you currently using Karmada and the ClusterFailover feature? |
|
Thanks @XiShanYongYe-Chang for taking a look! |
|
Thanks, I get it~ |
|
/retest |
Fix: Graceful Eviction Race Condition
This change fixes a race condition between the graceful eviction controller and the status controller that could cause Work objects to be deleted too early during failover.
Previously, graceful eviction relied on
AggregatedStatuswithout ensuring it had been updated for the current binding generation. Under certain controller execution orders, this could result in eviction tasks being removed before the new target cluster was ready, causing temporary workload unavailability.The fix ensures eviction decisions are only made when the status is confirmed fresh for the current scheduling decision, restoring safe and deterministic failover behavior.