Extract preemption executor into Framework#137562
Extract preemption executor into Framework#137562Argh4k wants to merge 1 commit intokubernetes:masterfrom
Conversation
|
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The DetailsInstructions 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-sigs/prow repository. |
|
/area workload-aware |
|
/hold |
6404ffb to
d476361
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Argh4k The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
290a31c to
dc03e8e
Compare
| for _, fwk := range profiles { | ||
| fwk.SetPreemptionExecutor(preemption.NewExecutor(fwk, plfeature.NewSchedulerFeaturesFromGates(feature.DefaultFeatureGate))) | ||
| } |
There was a problem hiding this comment.
Ack. If so, could we open an issue for cleaning this up and mention it here with a TODO?
| return nil | ||
| } | ||
| if pl.Evaluator.IsPodRunningPreemption(p.GetUID()) { | ||
| executor := pl.fh.PreemptionExecutor() |
There was a problem hiding this comment.
Why not make this a top-level field of DefaultPreemption struct?
There was a problem hiding this comment.
Same as with podLister, the executor is initialized after the plugins in the current scenario.
| func NewExecutor(fh fwk.Handle, fts feature.Features) *Executor { | ||
| e := &Executor{ | ||
| fh: fh, | ||
| podLister: fh.SharedInformerFactory().Core().V1().Pods().Lister(), |
There was a problem hiding this comment.
Ok - in that case, leaving the decision what to do here to you - I don't have any strong opinion here :)
363804c to
061a224
Compare
|
/retest |
| }() | ||
|
|
||
| executor := pl.fh.PreemptionExecutor() | ||
| if executor == nil { |
There was a problem hiding this comment.
Should we check the nil? Isn't it always set?
There was a problem hiding this comment.
With that I managed to quickly get some tests that were doing some manual initialization of scheduler, where I had to add also the initialization of preemption executor. So I would leave it as it is, as this check should not be expensive but it can allow for quicker debugging.
There was a problem hiding this comment.
So, can you add a comment that it can happen only in tests?
| return nil, fwk.NewStatus(fwk.Error, "preemption executor is nil") | ||
| } | ||
|
|
||
| result, status := pl.Evaluator.Preempt(ctx, state, pod, m) |
There was a problem hiding this comment.
The name Preempt becomes misleading now, because it only evaluates potential preemption without preempting anything
There was a problem hiding this comment.
I wonder whether we can rename it directly. Given that I want to split Evaluator and Executor completely, I can:
- add a note that use of executor in evaluator is deprecated and eventually will be removed
- once the executor is removed from an evaluator rename the method.
WDYT?
061a224 to
768ce00
Compare
There was a problem hiding this comment.
I don't understand why we need this effort decoupling executor from the preemption given we already dropped the delayed preemption.
I know we might need such if we really end up implementing the delayed preemption, but can we delay implementing it later? if this work is not particularly necessary for WAP implementation. As I commented in the other PR, I feel like it stays simpler if Preempt actually preempts pods.
881160d to
484bf54
Compare
We still need to have Executor as a part of the framework to easily pass it to the pod group preemption evaluator in the pod group cycle. However the effort to call ActuatePreemption outside of the Evaluator.Preempt() can be removed. I will do so |
484bf54 to
0f497ca
Compare
0f497ca to
33af82a
Compare
|
@sanposhiho @macsko @tosi3k, so I removed the move of victim actuation outside of the Evalautor, but I kept the Executor as a part of the framework handle. I need that so in the main PR adding workload preemption, the same executor can be shared between pod group and pod evaluator, so we can check whether we run pod group preemption for given pod in the IsPodRunningPreemption method. |
|
/retest |
|
Also, given the limited time before 1.36 I lean towards closing this PR and just merging this as a part of the #137606. The workload aware preemption is rebased on top of this one, including changes that resolved comments. @sanposhiho @tosi3k @macsko any objections? |
Sounds good |
|
Closing in favor of #137606 |
What type of PR is this?
/kind feature
What this PR does / why we need it:
This PR is a prework for two other features: Workload Aware Preeemption from KEP-5710 and delayed preemption from KEP-4671. With that we make preemption a first class citizen in the scheduler framework, which will allow us to call the executor outside of the default preemption plugin.
Which issue(s) this PR is related to:
Special notes for your reviewer:
For now, the Preempt from preemption.go still actuates the preemptions if the Evaluator has the Executor set. In the future we should get rid of that completely and rely only on external Executor to actuate preemptions but I wanted to minimize the changes. This should result in no user-facing changes.
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: