-
Notifications
You must be signed in to change notification settings - Fork 1k
Fix: Ignore historical assigned replicas when clusters no longer meet updated scheduling constraints. #6779
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: Ignore historical assigned replicas when clusters no longer meet updated scheduling constraints. #6779
Conversation
Summary of ChangesHello @rohan-019, 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 bug within the Karmada scheduler's replica assignment logic. Previously, historical replica assignments were unconditionally added to a cluster's available capacity, even if the cluster no longer satisfied the workload's updated scheduling constraints. This flaw could lead to inefficient and incorrect replica placement. The implemented fix introduces a conditional check, ensuring that historical assignments are only factored in for clusters that genuinely meet the current constraints, thereby promoting more accurate and optimal scheduling decisions. 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
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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 fixes a bug in the Karmada scheduler where historical replica counts could lead to poor scheduling decisions for clusters that no longer meet constraints. The proposed logic change correctly addresses this by only considering historical replicas if a cluster can accommodate new ones. My review includes a suggestion to improve a comment for clarity and strongly recommends adding a regression test to prevent this issue from recurring.
… constraints Signed-off-by: rohan-019 <[email protected]>
78fa8ee
to
45c5120
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6779 +/- ##
=======================================
Coverage 45.74% 45.75%
=======================================
Files 689 689
Lines 57161 57163 +2
=======================================
+ Hits 26149 26154 +5
+ Misses 29383 29379 -4
- Partials 1629 1630 +1
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:
|
Hey, @GitHubxsy @zhzhuang-zju |
@rohan-019 I apologize for the delay in seeing your PR. Your PR can only solve part of the scenario, such as when affinity rules are modified and the cluster has no nodes that meet the new affinity requirements. However, if the user modifies the resource requests (e.g., CPU/memory requests for the Pods), the current calculated maximum available replicas will still be incorrect. |
What type of PR is this?
/kind bug
What this PR does / why we need it:
This PR fixes an issue in the Karmada scheduler where historical replica assignments (AssignedReplicasForCluster) were unconditionally added to a cluster’s available replicas, even when the cluster no longer satisfies the workload’s updated scheduling constraints (e.g., nodeAffinity, resourceRequests).
With the previous logic, clusters that became unsuitable after constraint changes could appear more attractive due to inflated available replicas, leading to suboptimal scheduling decisions.
This PR ensures that historical assignments are only counted for clusters that still meet the current constraints, so new replicas are scheduled to clusters that can actually accommodate them.
Which issue(s) this PR fixes:
Fixes #6771
Special notes for your reviewer:
Modified pkg/scheduler/core/spreadconstraint/group_clusters.go to conditionally include historical assignments.
Verified behavior with unit tests and scaling scenarios under constraint changes.
Does this PR introduce a user-facing change?: NO