172 Commits

Author SHA1 Message Date
Maciej Skoczeń
17d733e243 KEP-5229: Send API calls through dispatcher and cache 2025-07-25 15:35:36 +00:00
Ania Borowiec
aecd37e6fb Moving Scheduler interfaces to staging: Move PodInfo and NodeInfo interfaces (together with related types) to staging repo, leaving internal implementation in kubernetes/kubernetes/pkg/scheduler 2025-07-24 12:10:58 +00:00
Ania Borowiec
ee8c265d35 Move Code and Status from pkg/scheduler/framework to k8s.io/kube-scheduler/framework 2025-06-30 10:06:22 +00:00
Ania Borowiec
00d3750503 Move ClusterEvent type to staging repo, leaving some functions (that contain logic internal to scheduler) in kubernetes/kubernetes (#132190)
* Move ClusterEvent type to staging repo, leaving some functions (that contain logic internal to scheduler) in kubernetes/kubernetes

apply review comment and fix linter warning

* update-vendor.sh

* update doc comments

* run update-vendor.sh
2025-06-26 08:06:29 -07:00
Kubernetes Prow Robot
e0859f91b7 Merge pull request #131887 from ania-borowiec/extract_cyclestate_interface
Moving Scheduler interfaces to staging: split CycleState into interface and implementation, move interface to staging repo
2025-05-30 04:00:18 -07:00
Ania Borowiec
d75af825fb Extract interface CycleState and move is to staging repo. CycleState implementation remains in k/k/pkg/scheduler/framework 2025-05-29 16:18:36 +00:00
Kubernetes Prow Robot
0afe2b839d Merge pull request #129983 from nickbp/master
feature(scheduler): Customizable pod selection and ordering in DefaultPreemption plugin
2025-05-20 05:09:15 -07:00
Nicholas Parker
7bccb1acb5 Update pkg/scheduler/framework/plugins/defaultpreemption/default_preemption.go
Co-authored-by: Dominik Marciński <gmidon@gmail.com>
2025-05-16 13:12:13 +12:00
Nicholas Parker
28602c66fc Update pkg/scheduler/framework/plugins/defaultpreemption/default_preemption_test.go
Co-authored-by: Maciej Skoczeń <87243939+macsko@users.noreply.github.com>
2025-05-13 06:56:27 +12:00
Nick Parker
52e7aa37da gofmt 2025-05-13 06:56:27 +12:00
Nick Parker
a507e64fe4 Have separate tests for custom selection vs ordering, add comments around system pod eligibility 2025-05-13 06:56:27 +12:00
Nick Parker
283c5e6b61 Have IsEligiblePod be supplemental to priority check, update tests 2025-05-13 06:56:27 +12:00
Nick Parker
3ed73e058a Clean up the affinity explanation, fix for new lint rule 2025-05-13 06:56:27 +12:00
Nick Parker
d4bc527a7b Update comments: affinity info, default behavior, priority->importance 2025-05-13 06:56:27 +12:00
Nicholas Parker
95ebc2c10e Apply suggestions from code review
Co-authored-by: Dominik Marciński <gmidon@gmail.com>
2025-05-13 06:56:27 +12:00
Nick Parker
7f57c6e52d Update factory to use generics, keep single New function 2025-05-13 06:56:27 +12:00
Nick Parker
137da6a488 Remove line about equal priority, fix typo 2025-05-13 06:56:27 +12:00
Nicholas Parker
b8ac171437 Apply suggestions from code review
Co-authored-by: Dominik Marciński <gmidon@gmail.com>
2025-05-13 06:56:27 +12:00
Nick Parker
224e6a3a35 Rename EligiblePod* to IsEligiblePod* 2025-05-13 06:56:27 +12:00
Nick Parker
4bf6841495 Update the customizations to operate on individual pods, for more flexibility later 2025-05-13 06:56:27 +12:00
Nick Parker
c34f8db559 Remove unnecessary context and typecheck, switch to cmp.Diff 2025-05-13 06:56:27 +12:00
Nick Parker
c6f2d3879b Fix gofmt in default_preemption_test.go 2025-05-13 06:56:26 +12:00
Nick Parker
78b059c064 rename OrderedPods -> OrderPods 2025-05-13 06:56:26 +12:00
Nick Parker
2616202ac9 Implement tests with example customizations, add direct constructor 2025-05-13 06:56:26 +12:00
Nick Parker
760daaf110 feature(scheduler): Custom pod selection/ordering in DefaultPreemption
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.
2025-05-13 06:56:26 +12:00
Kensei Nakada
47d296d62d feat: introduce pInfo.GatingPlugin to filter out events more generally 2025-05-07 13:54:47 +02:00
Kubernetes Prow Robot
8a6b916765 Merge pull request #130720 from saintube/scheduler-expose-nodeinfo-in-prefilter
Expose NodeInfo to PreFilter plugins
2025-04-23 13:31:29 -07:00
saintube
8dc6806d26 Expose NodeInfo to PreFilter plugins and Framework
Co-authored-by: Zhan Sheng <49895476+AxeZhan@users.noreply.github.com>
Co-authored-by: shenxin <rougang.hrg@alibaba-inc.com>
Signed-off-by: saintube <saintube@foxmail.com>
2025-03-21 14:55:25 +08:00
carlory
aab7a079fa make each scheduler test independent
Signed-off-by: carlory <baofa.fan@daocloud.io>
2025-03-13 14:39:50 +08:00
Jordan Liggitt
8090db5dcf Switch to private instances of rand for seeding for tests 2025-02-26 11:27:10 +01:00
Kensei Nakada
d4d91d4ace fix: use set methods 2024-11-07 14:09:35 +09:00
Kensei Nakada
a95b8b5085 fix: use Activate always 2024-11-07 14:09:35 +09:00
Kensei Nakada
677792663f fix: register Pod/Delete event at the preemption plugin 2024-11-07 14:09:35 +09:00
Kensei Nakada
fe3119fa69 make sure DefaultPreemption implements PreEnqueuePlugin 2024-11-07 14:09:35 +09:00
Kensei Nakada
69a8d0ec0b feature(KEP-4832): asynchronous preemption 2024-11-07 14:09:34 +09:00
NoicFank
68f7a7c682 bugfix(scheduler): preemption picks wrong victim node with higher priority pod on it.
Introducing pdb to preemption had disrupted the orderliness of pods in the victims,
which would leads picking wrong victim node with higher priority pod on it.
2024-10-29 19:50:55 +08:00
googs1025
69831b0043 chore(scheduler): refactor import package ordering 2024-09-18 20:31:03 +08:00
Kensei Nakada
fe3ab649d0 feat: remove node general update event from EventsToRegister when QHint is enabled 2024-09-14 16:15:40 +09:00
Richa Banker
6944af22d1 Initialize scheduler metrics after metrics options are applied 2024-09-13 12:52:32 -07:00
Kubernetes Prow Robot
e90364f45d Merge pull request #126465 from googs1025/podEligibleToPreemptOthers_refactor
feat: add ctx param for PodEligibleToPreemptOthers
2024-09-02 12:02:56 +01:00
Kensei Nakada
8519d3399f chore: move the scheduler internal components out of internal dir 2024-08-25 13:10:29 +09:00
Maciej Skoczeń
33815db3c1 Move NominatedPodsForNode to scheduling queue directly 2024-08-21 07:24:52 +00:00
googs1025
fc0fcd0044 feat: add ctx param for PodEligibleToPreemptOthers 2024-08-14 20:06:05 +08:00
Kubernetes Prow Robot
ea1143efc7 Merge pull request #126022 from macsko/new_node_to_status_map_structure
Change structure of NodeToStatus map in scheduler
2024-08-13 21:02:55 -07:00
Maciej Skoczeń
98be7dfc5d Change structure of NodeToStatus map in scheduler 2024-07-25 07:48:35 +00:00
Kubernetes Prow Robot
5d40866fae Merge pull request #125994 from carlory/fix-job-api
clean up codes after PodDisruptionConditions was promoted to GA
2024-07-17 14:37:09 -07:00
Kubernetes Prow Robot
d879103c28 Merge pull request #125820 from macsko/add_separate_lock_for_pod_nominator_scheduling_queue
Add a separate lock for pod nominator in scheduling queue
2024-07-17 12:06:10 -07:00
Maciej Skoczeń
5def93b10a Add a separate lock for pod nominator in scheduling queue 2024-07-17 07:58:59 +00:00
Kubernetes Prow Robot
31062790a1 Merge pull request #125855 from googs1025/refactor_scheduler_ut
chore: call close framework when finishing
2024-07-12 05:14:35 -07:00
googs1025
d4627f16a5 chore: call close framework when finishing
Signed-off-by: googs1025 <googs1025@gmail.com>
2024-07-12 18:11:04 +08:00