-
Notifications
You must be signed in to change notification settings - Fork 519
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
[Sample] Cross node preemption plugin #56
[Sample] Cross node preemption plugin #56
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Huang-Wei 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 |
16c7b50
to
ea4ef3e
Compare
@@ -50,7 +50,7 @@ update-vendor: | |||
hack/update-vendor.sh | |||
|
|||
.PHONY: unit-test | |||
unit-test: update-vendor | |||
unit-test: autogen |
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.
This is now needed as the testing in crossnodepreemption now needs the open API stuff to be fully generated. Otherwise, the test fails:
? sigs.k8s.io/scheduler-plugins/pkg/apis/config/scheme [no test files]
? sigs.k8s.io/scheduler-plugins/pkg/apis/config/v1beta1 [no test files]
ok sigs.k8s.io/scheduler-plugins/pkg/coscheduling 0.756s
# k8s.io/kubernetes/cmd/kube-apiserver/app
vendor/k8s.io/kubernetes/cmd/kube-apiserver/app/server.go:467:70: undefined: "k8s.io/kubernetes/pkg/generated/openapi".GetOpenAPIDefinitions
FAIL sigs.k8s.io/scheduler-plugins/pkg/crossnodepreemption [build failed]
ok sigs.k8s.io/scheduler-plugins/pkg/noderesources 0.187s
ok sigs.k8s.io/scheduler-plugins/pkg/qos 0.150s
FAIL
make: *** [Makefile:54: unit-test] Error 2
/cc @denkensk |
ea4ef3e
to
506a812
Compare
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.
thanks some small comments.
func (s *candidate) Victims() *extenderv1.Victims { | ||
return &extenderv1.Victims{ | ||
Pods: s.victims, | ||
NumPDBViolations: 0, |
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.
Why we add the field NumPDBViolations
here other than use the struct *extenderv1.Victims
like defaultPreempt?
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 intention is to make candidate
irrelevant with the extenderv1
pkg, so that in the preemption logic, we don't need to worry about extenderv1
pkg. And returning extenderv1.Victims
here does nothing magic but ensuring it adheres to Candidate
interface.
|
||
// nodesWherePreemptionMightHelp returns a list of nodes with failed predicates | ||
// that may be satisfied by removing pods from the node. | ||
func nodesWherePreemptionMightHelp(nodes []*framework.NodeInfo, m framework.NodeToStatusMap) []*framework.NodeInfo { |
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.
I also use this function in capacityScheduling.go
. Make it public in defaultPreempt?
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.
SG.
506a812
to
2d3143b
Compare
Thanks |
The PostFilter extension point was introduced in Kubernetes Scheduler since 1.19,
and the default implementation in upstream is to preempt Pods on the same node
to make room for the unschedulable Pod.
In contrast to the "same-node-preemption" strategy, we can come up with a "cross-node-preemption"
strategy to preempt Pods across multiple nodes, which is useful when a Pod cannot be
scheduled due to "cross node" constraints such as PodTopologySpread and PodAntiAffinity.
This was also mentioned in the original design document of Preemption.
This plugin is built as a sample to demonstrate how to use PostFilter extension point,
as well as inspiring users to built their own innovative strategies, such as preepmpting
a group of Pods.