Commit Graph

182 Commits

Author SHA1 Message Date
Antoni Zawodny
833b7205fc Run PreBind plugins in parallel if feasible 2026-01-11 14:19:18 +01:00
bwsalmon
854e67bb51 KEP 5598: Opportunistic Batching (#135231)
* First version of batching w/out signatures.

* First version of pod signatures.

* Integrate batching with signatures.

* Fix merge conflicts.

* Fixes from self-review.

* Test fixes.

* Fix a bug that limited batches to size 2
Also add some new high-level logging and
simplify the pod affinity signature.

* Re-enable batching on perf tests for now.

* fwk.NewStatus(fwk.Success)

* Review feedback.

* Review feedback.

* Comment fix.

* Two plugin specific unit tests.:

* Add cycle state to the sign call, apply to topo spread.
Also add unit tests for several plugi signature
calls.

* Review feedback.

* Switch to distinct stats for hint and store calls.

* Switch signature from string to []byte

* Revert cyclestate in signs. Update node affinity.
Node affinity now sorts all of the various
nested arrays in the structure. CycleState no
longer in signature; revert to signing fewer
cases for pod spread.

* hack/update-vendor.sh

* Disable signatures when extenders are configured.

* Update pkg/scheduler/framework/runtime/batch.go

Co-authored-by: Maciej Skoczeń <87243939+macsko@users.noreply.github.com>

* Update staging/src/k8s.io/kube-scheduler/framework/interface.go

Co-authored-by: Maciej Skoczeń <87243939+macsko@users.noreply.github.com>

* Review feedback.

* Disable node resource signatures when extended DRA enabled.

* Review feedback.

* Update pkg/scheduler/framework/plugins/imagelocality/image_locality.go

Co-authored-by: Maciej Skoczeń <87243939+macsko@users.noreply.github.com>

* Update pkg/scheduler/framework/interface.go

Co-authored-by: Maciej Skoczeń <87243939+macsko@users.noreply.github.com>

* Update pkg/scheduler/framework/plugins/nodedeclaredfeatures/nodedeclaredfeatures.go

Co-authored-by: Maciej Skoczeń <87243939+macsko@users.noreply.github.com>

* Update pkg/scheduler/framework/runtime/batch.go

Co-authored-by: Maciej Skoczeń <87243939+macsko@users.noreply.github.com>

* Review feedback.

* Fixes for review suggestions.

* Add integration tests.

* Linter fixes, test fix.

* Whitespace fix.

* Remove broken test.

* Unschedulable test.

* Remove go.mod changes.

---------

Co-authored-by: Maciej Skoczeń <87243939+macsko@users.noreply.github.com>
2025-11-12 21:51:37 -08:00
Kubernetes Prow Robot
f86edc2665 Merge pull request #133929 from huww98/fix-pv-cache-race-v2
scheduler/volumebinding: passive assume cache
2025-10-02 08:42:56 -07:00
胡玮文
e39ed4a4b4 scheduler/volumebinding: add test for PVAssumeCache 2025-09-13 19:23:03 +08:00
胡玮文
bbee7b9d6b scheduler/volumebinding: rename passive_assume_cache_test.go 2025-09-13 13:16:39 +08:00
胡玮文
4b0eff59c0 scheduler/volumebinding: target AssumeCache UT generic passiveAssumeCache
And removing duplicate tests
2025-09-13 13:15:24 +08:00
胡玮文
5a708a7ff0 scheduler/volumebinding: remove Get[API]{PV,PVC}
should be replaced by generic Get[APIObj]
2025-09-13 00:26:46 +08:00
胡玮文
ed19492dc2 scheduler/volumebinding: passive assume cache
Currently volume and dynamic-resource plugin shares an AssumeCache
implementation. However, they features significantly different use case.  DRA
call Assume() on objects returned by APIServer, but volume call Assume() on
objects yet to be sent to the APIServer.

VolumeBinding plugin only makes one update request, while DynamicResource makes
2 requests (add finalizer then update allocation status).  Taking advantage of
this, currently the volume cache is simpler:

1. Reserve: assume PV/PVC will be updated
2. PreBind: really send the update request
3. AssumeCache receives an update from informer and overwrite the assumed state.
   a. if Prebind succeeded, this will surely include the update from step 2.
   b. if PreBind is not finished yet, and this is an irrelevant update, it is safe to
      overwrite the assumed state, because our update in PreBind will surely fail with Conflict.

While for DynamicResource:

1. Reserve: add devices to inFlightAllocations
2. PreBind:
   a. send the 2 update requests
   b. add the returned object into AssumeCache
   c. AssumeCache dispatch events synchronously to update allocatedDevices
   d. remove devices from inFlightAllocations

DynamicResource needs some features from AssumeCache that is not necessary for VolumeBinding:
1. DynamicResource needs strictly ordered update events to update allocatedDevices,
   including those from Assume() and Restore()
2. DynamicResource needs to compare ResourceVersion to prevent the assumed state from being
   overwritten by older version from informer.  While this works, the doc[1] says:
   "you must not compare resource versions for greater-than or less-than relationships".

Given so much difference, it can be beneficial to fork another simpler
AssumeCache for VolumeBinding plugin. Because of no need to send events, the
lite AssumeCache is a passive component. It only record the assumed version
without copying all objects from informer into its local cache. When reading,
we read from both informer and local cache.  So it will always be up-to-date
with informer, no need to wait for event handler.

This resolves a race condition where AssumeCache and scheduler queue both
receive events from informer. When a pod is scheduling due to PV update event,
the PVCache may be not updated yet because it has not processed the relevant
event.

The passive version still listens events from informer, but only for cleaning up
its local cache to save memory.

[1]: https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions
2025-09-13 00:26:45 +08:00
胡玮文
c385a229d4 scheduler/volumebinding: introduce testInformer 2025-09-12 15:11:52 +08:00
胡玮文
eaf87d5907 scheduler/volumebinding: pass testing.T to helper 2025-09-12 14:29:02 +08:00
胡玮文
dce23dac03 scheduler/volumebinding: use subtest 2025-09-12 14:23:06 +08: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
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
Kubernetes Prow Robot
ab685237f0 Merge pull request #132391 from sanposhiho/pre-bind-pre-flight
feat: add PreBindPreFlight and implement in in-tree plugins
2025-07-15 04:06:23 -07:00
Pawel Mechlinski
f2b24b9849 Increase verbosity of frequently printed loglines in binder plugin 2025-07-09 12:10:10 +00:00
Kensei Nakada
ebae419337 feat: add PreBindPreFlight and implement in in-tree plugins 2025-07-05 17:14:21 -07: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
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
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
Yuma Ogami
43382b1b39 Switch control from VolumeCapacityPriority to StorageCapacityScoring
The tests and comments have also been updated because while
VolumeCapacityPriority preferred a node with the least allocatable,
StorageCapacityScoring preferred a node with the maximum allocatable.
2025-03-17 00:49:58 +00:00
bells17
f6ddee95f9 Add storage capacity scoring to VolumeBinding plugin 2025-03-17 00:49:58 +00:00
Kubernetes Prow Robot
0f7becbc44 Merge pull request #130537 from saintube/scheduler-expose-nodeinfo-in-score
Expose NodeInfo to the ScorePlugin
2025-03-06 06:53:55 -08:00
saintube
afb4e96510 Expose NodeInfo to Score plugins
Co-authored-by: shenxin <rougang.hrg@alibaba-inc.com>
Signed-off-by: saintube <saintube@foxmail.com>
2025-03-04 17:57:14 +08:00
Kubernetes Prow Robot
58704903c5 Merge pull request #129887 from rhrmo/STOR-2270-make-failedscheduling-event-more-intuitive
Change volume affinity scheduling error message to be more intuitive
2025-03-03 22:51:48 -08:00
Richard Hrmo
526960f988 Change FailedScheduling Event message to be more intuitive 2025-03-03 16:56:18 +01:00
googs1025
239aad8e4b chore(scheduler): use framework.Features in scheduler plugins 2025-02-26 19:16:07 +08:00
saza-ku
e26fb1c393 remove duplicated test case of pvc not found 2025-01-20 01:52:35 +09:00
YamasouA
6dbaa5660e fix test 2024-10-02 22:50:39 +09:00
YamasouA
84f45c81ca tweak 2024-09-25 22:37:05 +09:00
YamasouA
b4d9fe3957 delete framework.Add 2024-09-25 22:37:05 +09:00
YamasouA
b98634c2da volumebinding: scheduler queueing hints - CSIDriver
fix if condition

add test

add log

eliminate unnecessary args from log

fix Queue condition

check original pod status

fix return value when can scheduleable

fix tweak

fix testcase
2024-09-25 22:37:05 +09:00
Kubernetes Prow Robot
75214d11d5 Merge pull request #127428 from googs1025/scheduler/plugin
chore(scheduler): refactor import package ordering in scheduler
2024-09-25 11:40:07 +01:00
Kubernetes Prow Robot
211d67a511 Merge pull request #125398 from AxeZhan/pvAffinity
[scheduler] When the hostname and nodename of a node do not match, ensure that pods carrying PVs with nodeAffinity are scheduled correctly.
2024-09-23 21:22:02 +01: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
Kubernetes Prow Robot
113b12c6fb Merge pull request #124439 from bells17/csi-translation-lib-structured-and-contextual-logging
Migrate k8s.io/csi-translation-lib/.* to structured logging
2024-08-19 18:13:54 -07:00
Kubernetes Prow Robot
a00181d4d4 Merge pull request #121902 from carlory/kep-3751-pv-controller
[kep-3751] pvc bind pv with vac
2024-07-23 11:02:13 -07:00
carlory
3a6a4830df pvc bind pv with vac 2024-07-23 15:04:11 +08:00
bells17
e1aa8197ed volumebinding: scheduler queueing hints - CSIStorageCapacity (#124961)
* volumebinding: scheduler queueing hints - CSIStorageCapacity

* Fixed points mentioned in the review

* Fixed points mentioned in the review

* Update pkg/scheduler/framework/plugins/volumebinding/volume_binding.go

Co-authored-by: Kensei Nakada <handbomusic@gmail.com>

* Update pkg/scheduler/framework/plugins/volumebinding/volume_binding_test.go

Co-authored-by: Kensei Nakada <handbomusic@gmail.com>

* Fixed points mentioned in the review

* volume_binding.go を更新

Co-authored-by: Kensei Nakada <handbomusic@gmail.com>

---------

Co-authored-by: Kensei Nakada <handbomusic@gmail.com>
2024-07-19 07:53:52 -07:00
bells17
1298c8a5fe csi-translation-lib: Support structured and contextual logging 2024-07-18 14:01:27 +09:00
googs1025
a3978e8315 scheduler: Add ctx param and error return to EnqueueExtensions.EventsToRegister() 2024-07-18 12:22:17 +08:00
bells17
4c3c4128af volumebinding: scheduler queueing hints - StorageClass 2024-07-17 15:03:17 +09:00
bells17
aceb4468b6 volumebinding: scheduler queueing hints - PersistentVolumeClaim 2024-07-16 12:48:50 +09:00
AxeZhan
4ef58b2877 manually revert #109877 2024-06-08 17:06:47 +08:00
YamasouA
f409dedb5d Implement QHint for CSINode 2024-06-04 23:04:52 +09:00
carlory
c8e91b9bc2 CephRBD volume plugin ( ) and its csi migration support were removed in this release 2024-05-09 22:55:34 +08:00
Patrick Ohly
7f54c5dfec scheduler: remove AssumeCache interface
There's no reason for having the interface because there is only one
implementation. Makes the implementation of the test functions a bit
simpler (no casting). They are still stand-alone functions instead of methods
because they should not be considered part of the "normal" API.
2024-04-25 11:46:58 +02:00
Patrick Ohly
26e0409c36 scheduler: move assume cache to utils, part 2
This is now used by both the volumebinding and dynamicresources plugin, so
promoting it to a common helper package is better.

In terms of functionality, nothing was changed. Documentation got
updated (warns about storing locally modified objects, clarifies what the Get
parameters are). Code coverage should be a bit better than before (tested with
and without indexer, exercises event handlers, more error paths).

Checking for specific errors can now be done via errors.Is.
2024-04-25 11:45:43 +02:00