Commit Graph

103 Commits

Author SHA1 Message Date
vshkrabkov
b78cdbfdf4 Adds test cases for multiple preEnqueue plugins 2026-01-09 15:35:48 +00:00
vshkrabkov
779ff43005 Add unschedulabe pods metric drop for pod deletion 2026-01-07 15:17:27 +00:00
Manthan Parmar
41cde37f00 Update pkg/scheduler/backend/queue/scheduling_queue.go
Co-authored-by: Maciej Skoczeń <87243939+macsko@users.noreply.github.com>
2025-12-30 15:05:51 +00:00
Manuel Grandeit
66d4bd3206 Fix data race in PriorityQueue.UnschedulablePods()
The UnschedulablePods() function iterates over the unschedulablePods.podInfoMap
without holding any lock, while other goroutines may concurrently modify the map
via addOrUpdate(), delete(), or clear().

Other functions like PendingPods() and GetPod() correctly acquire p.lock.RLock()
before accessing unschedulablePods.podInfoMap, but UnschedulablePods() was
missing this.

Fix by adding p.lock.RLock()/RUnlock() to UnschedulablePods(), matching the
pattern used by PendingPods().
2025-12-20 13:46:58 +01:00
Patrick Ohly
ad79e479c2 build: remove deprecated '// +build' tag
This has been replaced by `//build:...` for a long time now.

Removal of the old build tag was automated with:

    for i in $(git grep -l '^// +build' | grep -v -e '^vendor/'); do if ! grep -q '^// Code generated' "$i"; then sed -i -e '/^\/\/ +build/d' "$i"; fi; done
2025-12-18 12:16:21 +01:00
Kubernetes Prow Robot
1757c6358b Merge pull request #135368 from vshkrabkov/fix/scheduler-queue-metric-sync
Scheduler: Fix GatedPods metric desync in unschedulable queue
2025-12-17 21:42:00 -08:00
Vlad Shkrabkov
5be527b78e Scheduler: Fix GatedPods metric desync in unschedulable queue
Previously, when a Pod residing in the 'unschedulablePods' queue was updated and subsequently rejected by PreEnqueue plugins (returning 'Wait'), the logic in 'moveToActiveQ' would return early because the Pod was already present in the queue.

This caused the 'scheduler_gated_pods_total' metric to fail to increment, leading to metric inconsistencies (and potentially negative values upon Pod deletion).

This change adds a check to detect the transition from Ungated to Gated. If detected, the Pod is removed and re-added to the queue to ensure metrics are correctly swapped (Unschedulable-- and Gated++).

Added regression test 'TestSchedulingQueueMetrics_UngatedToGated' to verify the fix.

Signed-off-by: Vlad Shkrabkov <vshkrabkov@google.com>
2025-12-15 11:47:22 +00:00
Mohammad Varmazyar
4c2fff1934 Address comments, log level, test assersion consistency and remove unnecessary locks in TestFlushUnschedulablePodsLeftoverSetsFlag 2025-11-26 14:08:05 +01:00
Mohammad Varmazyar
4f455c9c0d Refactor plugin clearing to use ClearRejectorPlugins method 2025-11-26 09:54:32 +01:00
Mohammad Varmazyar
d64e09c697 Clear plugins at handleSchedulingFailure and preserve both at Pop 2025-11-24 20:32:41 +01:00
Mohammad Varmazyar
ec05bcf186 test: simplify TestFlushUnschedulablePodsLeftoverSetsFlag
scheduler: add logging for pods scheduled after flush and preserve UnschedulablePlugins
2025-11-24 09:55:52 +01:00
Mohammad Varmazyar
e5e8ef993c Add unit test for WasFlushedFromUnschedulable flag 2025-11-24 09:38:41 +01:00
Mohammad Varmazyar
6a1a71ddc5 Removing the reduntant WasFlushedFromUnschedulable 2025-11-24 09:38:41 +01:00
Mohammad Varmazyar
bc632c72d0 scheduler: add metric for pods scheduled after flush
Add counter metric to track pods that schedule immediately after
being flushed from unschedulablePods due to timeout. Uses a boolean
flag that is cleared when pods return to queue or move via events.
2025-11-24 09:38:41 +01:00
Mohammad Varmazyar
b2a399cf30 scheduler: add metric for pods scheduled after flush
This metric tracks pods that successfully schedule after being
flushed from unschedulablePods due to timeout. High values may
indicate missing queue hint optimizations or event handling issues.
2025-11-24 09:38:40 +01:00
Maciej Skoczeń
9c5959e9de Fix failing test for pod group scheduling timeout on Windows 2025-11-07 10:31:47 +00:00
Kubernetes Prow Robot
544dfee60a Merge pull request #135180 from macsko/fix_asyncapicalls_onfinish
Fix sending OnFinish to in-flight async API calls in scheduler
2025-11-06 06:51:02 -08:00
Maciej Skoczeń
a9dcc8e2c9 Fix sending OnFinish to in-flight async API calls in scheduler 2025-11-06 12:00:37 +00:00
Maciej Skoczeń
049cb8558e Add integration test for gang scheduling 2025-11-06 10:47:30 +00:00
Maciej Skoczeń
8d67173de0 Implement Gang scheduling in kube-scheduler 2025-11-06 10:47:29 +00:00
Maciej Skoczeń
b29fdd1551 Forget pod from scheduler's cache immediately when it's deleted or has DeletionTimestamp set 2025-10-29 10:00:38 +00:00
Maciej Skoczeń
1137d51b35 Disable SchedulerAsyncAPICalls feature gate due to a known regression 2025-10-03 13:02:02 +00:00
Maciej Skoczeń
4275b8b759 Don't limit the number of goroutines dispatched by the API Dispatcher 2025-09-19 09:36:44 +00:00
Kubernetes Prow Robot
597a684bb0 Merge pull request #133172 from ania-borowiec/move_handle_and_plugin
Move interfaces: Handle and Plugin and related types from kubernetes/kubernetes to staging repo kube-scheduler
2025-09-08 06:05:31 -07:00
Maciej Skoczeń
4babdf8026 Fix race in movePodsToActiveOrBackoffQueue 2025-09-02 11:57:18 +00:00
Ania Borowiec
fadb40199f Move interfaces: Handle and Plugin and related types from kubernetes/kubernetes to staging repo kube-scheduler 2025-09-02 09:42:53 +00:00
Kubernetes Prow Robot
5fb3296920 Merge pull request #132451 from macsko/fix_race_in_scheduler_integration_tests
Fix race in scheduler integration tests
2025-08-31 05:03:09 -07:00
Maciej Skoczeń
46e10103ff Take activeQ lock for part of the Update method 2025-08-25 12:30:43 +00:00
Maciej Skoczeń
8b0b0df431 Don't run PreEnqueue when pod is activated from backoffQ 2025-08-22 12:40:41 +00:00
Maciej Skoczeń
aa59f930b3 Add lock to TestAsyncPreemption to prevent races 2025-08-05 09:43:12 +00:00
Maciej Skoczeń
c5ef720837 Fix race in scheduler integration tests 2025-08-05 09:42:52 +00:00
yliao
34a64db2c7 extended resource backed by DRA: implementation 2025-07-29 18:55:21 +00:00
Kensei Nakada
ac9fad6030 feat: trigger PreFilterPreBind in the binding cycle 2025-07-29 19:01:02 +09:00
Kubernetes Prow Robot
2a03dd1d5e Merge pull request #133120 from utam0k/kep-5229-metrics
KEP-5229: Add the metrics
2025-07-28 03:58:36 -07:00
Maciej Skoczeń
17d733e243 KEP-5229: Send API calls through dispatcher and cache 2025-07-25 15:35:36 +00:00
utam0k
b956484c25 KEP-5229: Add metrics for async API dispatcher
Signed-off-by: utam0k <k0ma@utam0k.jp>
2025-07-25 19:29:14 +09:00
Kubernetes Prow Robot
a11bc701e8 Merge pull request #132457 from ania-borowiec/depends_on_cluster_move_podinfo
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 09:38:27 -07: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
Maciej Skoczeń
4fc9546e0e KEP-5229: Implement API dispatcher 2025-07-21 14:00:34 +00:00
Omar Nasser
45c355ca58 Move unschedulablePods struct to a separate file 2025-07-11 19:48:11 +03:00
Junhao Zou
1b730abf8d cleanup: use HandleErrorWithXXX instead of logger.Error where errors are intentionally ignored 2025-07-08 09:34:49 +08: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
Kensei Nakada
f694c58c6c feat: graduate QueueingHint to GA 2025-05-26 21:23:46 +02:00
Maciej Skoczeń
157903b09b Skip backoff when PodMaxBackoffDuration is set to zero 2025-05-26 09:35:53 +00:00
Kensei Nakada
adc4916dfe feat: introduce pInfo.UnschedulableCount to make the backoff calculation more appropriate 2025-05-17 12:39:58 +02:00
Kubernetes Prow Robot
0113538e59 Merge pull request #127180 from sanposhiho/general-gate
feat: introduce pInfo.GatingPlugin to filter out events more generally
2025-05-14 05:13:18 -07:00
Kensei Nakada
5140786829 feat: improve the backoff calculation to o(1) 2025-05-12 01:26:47 +02:00
Kensei Nakada
d28c8cd488 fix: not removing the plugin from the unsched plugins after PreEnqueue 2025-05-07 14:12:23 +02:00
Kensei Nakada
47d296d62d feat: introduce pInfo.GatingPlugin to filter out events more generally 2025-05-07 13:54:47 +02:00