-
Notifications
You must be signed in to change notification settings - Fork 828
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
feat: adopt zones in scheduler spread by constraints #4002
Conversation
For zone is not supported in scheduler's spread constraint yet,I do not know how to test the zone selection schedule. see the code here func selectBestClustersBySpreadConstraints(spreadConstraints []policyv1alpha1.SpreadConstraint,
groupClustersInfo *GroupClustersInfo, needReplicas int32) ([]*clusterv1alpha1.Cluster, error) {
spreadConstraintMap := make(map[policyv1alpha1.SpreadFieldValue]policyv1alpha1.SpreadConstraint)
for i := range spreadConstraints {
spreadConstraintMap[spreadConstraints[i].SpreadByField] = spreadConstraints[i]
}
if _, exist := spreadConstraintMap[policyv1alpha1.SpreadByFieldRegion]; exist {
return selectBestClustersByRegion(spreadConstraintMap, groupClustersInfo)
} else if _, exist := spreadConstraintMap[policyv1alpha1.SpreadByFieldCluster]; exist {
return selectBestClustersByCluster(spreadConstraintMap[policyv1alpha1.SpreadByFieldCluster], groupClustersInfo, needReplicas)
} else {
return nil, fmt.Errorf("just support cluster and region spread constraint")
}
} |
Signed-off-by: Tanggui Bian <softwarebtg@163.com>
6ac7049
to
10b5ff2
Compare
Codecov Report
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. @@ Coverage Diff @@
## master #4002 +/- ##
==========================================
+ Coverage 54.48% 54.62% +0.14%
==========================================
Files 232 232
Lines 22685 22854 +169
==========================================
+ Hits 12359 12485 +126
- Misses 9649 9688 +39
- Partials 677 681 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
The zone spread constraint is still dead code for now. So I think this PR is unnecessary.
I get it, This PR just adopted the new |
I agree that dead code should be removed. This PR just removed the reference to deprecated code, that's the benefit we can get before #3662. |
okay, just move it forward. |
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
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: RainbowMango The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind feature
/kind cleanup
What this PR does / why we need it:
Adopt
zones
in scheduler spread by constraints.Which issue(s) this PR fixes:
part of #3952
Special notes for your reviewer:
@RainbowMango @whitewindmills @huone1
Does this PR introduce a user-facing change?: