mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-18 13:57:38 +00:00
The current behavior is to select only based on pod priority, where any pod with higher priority can preempt any pod with lower priority. In our case, we have multiple priority classes but where only a subset of those are considered preemptible. Here's roughly how this looks: - High priority: higher in the scheduling queue, not preemptible - Low priority: lower in the scheduling queue, not preemptible - Preemptible priority: lowest in the scheduling queue, preemptible This PR allows the preemption selection to be configured against the `DefaultPreemption` plugin, rather than needing to reimplement the plugin itself. The structure used here mimics [what's currently being done for the `Evaluator`](https://github.com/kubernetes/kubernetes/blob/release-1.32/pkg/scheduler/framework/preemption/preemption.go#L161-L165), where a `PreemptPod` callback may be overridden to customize what happens when performing a preemption. This PR also updates the plugin's tests to call the updated `New()` function rather than constructing `DefaultPreemption` directly, so that `New()` is now being exercised in tests.