-
Notifications
You must be signed in to change notification settings - Fork 38.6k
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
Option to ignore existing pods' preferred inter-pod affinities if the incoming pod has no preferred inter-pod affinities #114393
Conversation
Welcome @danielvegamyhre! |
Hi @danielvegamyhre. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
This PR may require API review. If so, when the changes are ready, complete the pre-review checklist and request an API review. Status of requested reviews is tracked in the API Review project. |
/assign |
@ahg-g any chance you could take a quick look at this when you have a moment? I would really appreciate it. |
pkg/scheduler/framework/plugins/interpodaffinity/scoring_test.go
Outdated
Show resolved
Hide resolved
Thanks for the review @ahg-g I have addressed all your comments, this is ready for another look. The only outstanding issue is in the test case I added to I have tried both |
You need to update the auto-generated code that does the translation between the external and internal types. Run |
@@ -1186,6 +1186,7 @@ profiles: | |||
- args: | |||
apiVersion: kubescheduler.config.k8s.io/v1beta2 | |||
hardPodAffinityWeight: 5 | |||
ignorePreferredTermsOfExistingPods: false |
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.
worth adding a test to the scheme tests that sets it to true.
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.
Ok I added test cases for both scheme encoding/decoding tests when ignorePreferredTermsOfExistingPods
is true.
cycleState.Write(preScoreStateKey, &preScoreState{ | ||
topologyScore: make(map[string]map[string]int64), | ||
}) | ||
return nil |
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.
@alculquicondor @Huang-Wei are we going to allow returning Skip
for PreScore extensions to indicate that Score shouldn't run for the same plugin?
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.
that sounds like a better contract, compared to plumbing the placeholder and checking if it's empty in Score.
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.
yes, we should have support for Skip in Score as well, but the work didn't start yet.
/retitle "Option to ignore existing pods' inter-pod affinities if the incoming pod has no inter-pod affinities" |
/cc |
Adding fields is allowed, removing them requires a new version. |
Maybe the question is why no KEP? Since the component config API is not stored, we don't need feature gates or other things that a KEP imposes. btw /remove-sig api-machinery this has nothing to do. |
|
||
// IgnorePreferredTermsOfExistingPods configures the scheduler to ignore existing pods' preferred affinity | ||
// rules when scoring candidate nodes, unless the incoming pod has inter-pod affinities. | ||
IgnorePreferredTermsOfExistingPods bool |
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 "unless incoming pod..." aspect is not captured in the name... would we eventually want to also allow unconditionally ignoring preferred terms of existing pods? if so, it would be worth thinking about how we would name this field and that eventual field in ways that wouldn't be confusing
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.
Based on my understanding, unconditionally ignoring preferred terms of existing pods is not something we'll want to do in the future. However, @ahg-g has more knowledge about future plans in this area so I will defer to his recommendation here.
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.
Right, I don't think we will want to do that
one question on the field name and future plans around this incoming/existing preferred term behavior |
/approve scheduling reviewer has lgtm |
Please squash the commits to one |
fa1fee8
to
6c23b46
Compare
has inter-pod affinities
6c23b46
to
41817b1
Compare
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: danielvegamyhre, liggitt 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 |
/lgtm Thanks @danielvegamyhre |
LGTM label has been added. Git tree hash: 307acffe5710111b780cc246c25bce08a81b89b4
|
What type of PR is this?
/kind api-change
/sig scheduling
/sig api-machinery
/priority backlog
What this PR does / why we need it:
The purpose of these changes are to add an option for the scheduler to ignore existing pods` preferred inter-pod affinities if the incoming pod has no preferred inter-pod affinities.
Preferred inter-pod affinity/anti-affinity rules tend to be made in both directions (i.e. if pod type A has a preferred affinity for pod type B, then pod type B will usually have a preferred affinity for pod type A). If an incoming pod that needs to be scheduled has no preferred inter-pod affinity rules, it is most likely the case that no existing pods have no preferred inter-pod affinity rules relating to it.
Therefore, the linear scan through existing pods checking their preferred inter-pod affinities is usually a waste of time that the user can choose to optimize away by enabling this option in the InterPodAffinity plugin config args (at the cost of an occasional pod being scheduled non-optimally/violating existing pods affinity rules).
Specifically, this option will cause PreScore to exit early if this option is enabled and the incoming pod has no existing inter-pod affinity rules.
Which issue(s) this PR fixes:
Fixes #114267
Does this PR introduce a user-facing change?