Commit Graph

146 Commits

Author SHA1 Message Date
Alex Wang
e772202e95 set PodMaxUnschedulableQDuration as 5 min 2022-03-17 15:37:34 +08:00
Harsh Prateek
840fc3ea7b
Add gauge metric to track unschedulable pod (#108475)
* Add gauge metric to track unschedulable pod

* Add review comments
2022-03-14 13:02:58 -07:00
Abdullah Gharaibeh
8a1c70b48c Graduate PodAffinityNamespaceSelector to GA 2022-02-18 12:07:29 -05:00
Alex Wang
87549203e9 add deprecated flag for flush pods to activeq interval 2022-02-16 11:05:52 +08:00
duc
040f8a4cf0 a flag to indicate whether or not to broadcast
change the returns above to breaks, add a flag to indicate whether or not to broadcast.
2022-01-27 21:52:30 +08:00
duc
c3bfb568f9
fix flushBackoffQCompleted: remove defer
'defer' is called in the 'for' loop, remove it
2022-01-27 17:08:12 +08:00
Wei Huang
2433b083a9
clear pod's .status.nominatedNodeName when necessary 2021-12-16 10:55:13 -08:00
BinacsLee
d484b1aa3d scheduler: cleanup return value 2021-12-15 21:51:42 +08:00
BinacsLee
f277864aa5 Scheduler queue: fix calculateBackoffDuration overflow in extreme data cases 2021-09-21 09:42:52 +08:00
sanposhiho
b7dd0a7660 Clean up: delete NumUnschedulablePods because it's no longer in use 2021-08-24 17:34:05 +09:00
Kubernetes Prow Robot
fcefb0bc2a
Merge pull request #104158 from mamil/modify-func-notes
make notes more easily to understand
2021-08-06 01:21:19 -07:00
raymonder jin
b66d52f6a8
make notes more easily to understand 2021-08-06 09:03:23 +08:00
Kubernetes Prow Robot
2d08fd4f56
Merge pull request #103864 from yuanchen8911/master
Fix inaccurate comments in scheduler_queue.go
2021-08-05 01:45:15 -07:00
Kubernetes Prow Robot
6fb005d4d4
Merge pull request #103792 from lixiaobing1/activeQ5
fix typo scheduling queue to active queue
2021-08-05 01:43:50 -07:00
Yuan Chen
00e31ce565 Fix incorrect comments in scheduler_queue.go 2021-07-22 20:57:21 -07:00
lixiaobing1
51e4694cd6 fix typo scheduling queue to active queue 2021-07-20 14:01:35 +08:00
boenn
1980b18c45 Solved the test problem and added update comment 2021-07-16 10:57:23 +08:00
Wei Huang
fb9cafc99b
sched: provide an option for plugin developers to move pods to activeQ 2021-07-07 12:50:12 -07:00
Wei Huang
36eaa11d50
cleanup usage of NewPodNominator
- replace NewPodNominator() with NewSafePodNominator()
- rename nominatedPodMap to nominator
2021-06-10 14:01:07 -07:00
Wei Huang
8e85a2b0c2
sched: fix a bug that a preemptor pod exists as a phantom
- SafePodNominator to resolve racing issue when dealing with nominated pod
2021-06-05 11:07:29 -07:00
Alexander Minbaev
8325c6b0da got rid of ClusterEventReg with generating ClusterEvent objects on the fly 2021-04-14 13:38:46 -05:00
卢振兴10069964
5ddb1be59a code cleanup for pkg/scheduler 2021-04-13 08:16:16 +08:00
Kubernetes Prow Robot
ae40c62c49
Merge pull request #100286 from tanjing2020/skip_updates_assumed_pods
Scheduler: skip updates of assumed pods
2021-04-08 20:29:29 -07:00
Kubernetes Prow Robot
7cd73076a2
Merge pull request #100049 from Huang-Wei/basic-check-prior-to-enq
sched: support PreEnqueueChecks prior to moving Pods
2021-04-08 17:11:04 -07:00
tanjing2020
d4465b995e Scheduler: skip updates of assumed pods 2021-03-24 10:01:22 +08:00
Wei Huang
6384f397b4
sched: support PreEnqueueChecks prior to moving Pods 2021-03-11 12:31:50 -08:00
renyuquan
53ee08a40e fix scheduler queue update logic 2021-03-10 15:48:18 +08:00
Abdullah Gharaibeh
c7fef196b6 Implements pod affinity NamespaceSelector feature 2021-03-04 07:30:24 -05:00
Wei Huang
f322019d7a
Store a cluster event to plugin map in SchedulerQueue 2021-03-03 07:20:07 -08:00
drfish
bc2df9de72 Use PodInfo instead of Pod for nominatedPods and QueuedPodInfo 2021-02-22 22:00:23 +08:00
tanjing2020
d0eecbd0a9 migrate scheduling_queue.go to structured logging 2021-02-18 09:56:31 +08:00
Justin SB
8797738c02 Fix spelling typos: scheduable -> schedulable
Bulk fix of a common typo.
2021-01-09 12:59:33 -05:00
jinde.zgm
17b084938a
fix gofmt bug 2020-12-15 20:07:47 +08:00
jindezgm
5e6177897d
Refresh Timestamp when pod is not present in the three sub-queues
The pInfo.Timestamp is refreshed but the sort in activeQ or podBackoffQ is not be updated when pod  is already present in the backoff or active queue.
AddUnschedulableIfNotPresent() return error if pod is already present in the backoff or active queue, and there is no re-add.
So  refresh  pInfo.Timestamp when  the pod is not present in the three sub-queues, otherwise need to update the order of the pod in the active or backoff queue, for example p.activeQ.Update(pInfo)
2020-12-14 22:39:08 +08:00
Ali
09b2e8f638 Move scheduler interface to pkg/scheduler/framework 2020-10-13 13:13:27 +11:00
Wei Huang
f4b726237a
Add function NominatedPodsForNode to PodNominator interface.
- replace SchedulingQueue with PodNominator in genericScheduler.
2020-05-20 14:05:18 -07:00
Wei Huang
bd184035c4
Extract logic related with scheduler nominatedPods to an interface
- rename `UpdateNominatedPodForNode` to `AddNominatedPod`
- promote `update` to `UpdateNominatedPod`
- anonymous lock in nominatedMap
- pass PodNominator as an option to NewFramework
2020-05-18 10:29:08 -07:00
Kubernetes Prow Robot
d4ce66fe0b
Merge pull request #90660 from Huang-Wei/synced-sched-err-call
Move unschedulable Pod to internal schedulingQ synchronously
2020-05-16 19:00:06 -07:00
Davanum Srinivas
442a69c3bd
switch over k/k to use klog v2
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2020-05-16 07:54:27 -04:00
Wei Huang
133a02540f
Move unschedulable Pod to internal schedulingQ synchronously
- use in-cache Pod instead of real-time Pod (by calling API server) to mark it as unschedulable
  in internal schedulingQ
- remove the backoff logic as now we don't call API server
- the whole logic is changed to a synchronous call
2020-05-15 19:27:28 -07:00
Abdullah Gharaibeh
5e0211c72d Added pre-processed required affinity terms to scheduler's PodInfo type. 2020-05-14 10:30:42 -04:00
lixiang
5844bc3b9f There's no need to set moveRequestCycle and do broadcast twice. 2020-04-28 00:43:58 +08:00
Abdullah Gharaibeh
a151682887 Split scheduler's PodInfo into two types, PodInfo and PodQueueInfo 2020-04-21 21:45:20 -04:00
Aldo Culquicondor
c048858471 Support multiple scheduling profiles in a single scheduler
Signed-off-by: Aldo Culquicondor <acondor@google.com>
2020-02-25 11:31:20 -05:00
notpad
a4e4a99435 Remove PodBackoffMap 2020-02-14 08:31:07 +08:00
Aldo Culquicondor
9d2786c383 Fix back off when scheduling cycle is delayed
Signed-off-by: Aldo Culquicondor <acondor@google.com>
2020-01-29 13:15:13 -05:00
Wei Huang
c712230ac1
Implement default queue sort logic as a scheduler plugin 2020-01-16 19:10:43 -08:00
Wei Huang
b2159b5d66
Remove scheduler/algorithm/priorities/util package 2020-01-09 20:16:05 -08:00
caiweidong
02e217759e update comments of some funs in scheduling_queue 2020-01-02 23:35:12 +08:00
Abdullah Gharaibeh
429448cb40 move inter pod affinity predicate logic to its Filter plugin 2019-12-20 16:58:36 -05:00
Kubernetes Prow Robot
ca7ad98d60
Merge pull request #85470 from cwdsuzhou/add_pod_info
add pod info when failing to add pod to unschedulableQ
2019-12-03 18:35:10 -08:00
Abdullah Gharaibeh
f388534082 make scheduling queue start before the scheduler starts and stops after the scheduler stops 2019-12-02 14:35:09 -05:00
caiweidong
81afa77e3b add pod info when failing to add pod to queue 2019-11-22 11:07:31 +08:00
draveness
39af760930 feat: several cleanups in the scheduling package
+ Remove unused variable in tests.
+ Use more common statement for interface conformance check.
+ Fix several comments in the framework plugins.
2019-10-18 11:14:05 +08:00
Cong Liu
fc226e0670 Add incoming pod metrics to scheduler queue. 2019-10-16 14:26:16 -04:00
Cong Liu
085852160a Add per-pod metrics for scheduler. 2019-10-10 16:58:21 -04:00
draveness
9646afb1f5 feat: add pod initial/max backoff duration to config API 2019-10-09 19:48:28 +08:00
Harsh Singh
f462a31e9b Move heap into its own internal package 2019-10-05 01:24:36 +05:30
Harsh Singh
6a9ef7f04f Move GetPodPriority from /scheduler/util to /api/pod 2019-09-24 22:02:13 +05:30
NickrenREN
315f34bb51 delete the pods from unschedulable queue only when Add succeeds 2019-07-28 11:24:11 +08:00
Wei Huang
29195faa69
supplemental logic to ensure nominatedPodMap.update() is still stateless 2019-05-17 07:44:05 -07:00
Wei Huang
115fe94b6f
scheduler: fix flaky test TestPreemptionRaces
In some cases, an Update event with no "NominatedNode" present is received right
after a node("NominatedNode") is reserved for this pod in memory.
If we go updating (delete and add) it, it actually un-reserves the node since
the newPod doesn't carry sped.status.nominatedNode.
In this case, during this time other low-priority pods have chances to take space which
was reserved for the nominatedPod.
2019-05-17 07:44:04 -07:00
draveness
d60bccc6a4 feat: implement "queue-sort" extension point for scheduling framework 2019-05-15 09:40:15 +08:00
draveness
6382595221 feat: move klog from AddUnschedulableIfNotPresent into the call site 2019-05-07 00:40:25 +08:00
xiuqiao
36effb4700 Remove FIFO scheduling queue and old pod backoff logic 2019-04-25 07:35:22 +08:00
Davanum Srinivas
7b8c9acc09
remove unused code
Change-Id: If821920ec8872e326b7d85437ad8d2620807799d
2019-04-19 08:36:31 -04:00
Wei Huang
7afbd68730
add metrics to record number of pending pods in different queues 2019-04-08 17:51:07 -07:00
Ted Yu
4b4c20be7c Use read lock for PendingPods 2019-04-06 13:48:51 -07:00
Kubernetes Prow Robot
52ec2a0009
Merge pull request #75497 from goodluckbot/remove-backoff-util
Integrate backoff mechanism into the scheduling queue and remove the …
2019-04-05 18:06:41 -07:00
goodluckbot
151649df4c Integrate backoff mechanism into the scheduling queue and remove the Backoff util 2019-04-06 00:15:00 +08:00
wangqingcan
8fd45d8300 clean up func podTimestamp 2019-03-27 11:05:19 +08:00
Wei Huang
2b554b4286
scheduler: cleanup unused parameters in unschedulableQ 2019-03-13 11:54:16 -07:00
Jonathan Basseri
df4d65d2e1 Ensure that pods obey backoff timers.
The function AddUnschedulableIfNotPresent is responsible for
initializing or updating backoff timers for pods that could not be
scheduled. The helper function backoffPod does that work, but was not
being called in all cases.

This moves that call to be (mostly) unconditional, while cleaning up
comments and error handling.
2019-02-26 10:21:18 -08:00
wangqingcan
ea9e1a4118 not updae timestamp for each scheduling attempt 2019-02-22 09:46:18 +08:00
Yecheng Fu
ba47beffd2 Fix weakness of current receivedMoveRequest
- add incremental scheduling cycle
- instead of set a flag on move reqeust, we cache current scheduling
cycle in moveRequestCycle
- when unschedulable pods are added back, compare its cycle with
moveRequestCycle to decide whether it should be added into active queue
or not
2019-01-30 10:13:49 +08:00
Wei Huang
02cdc24cd3
enforce unscheduable pod has proper chance to be retried 2019-01-22 09:23:51 +08:00
Kubernetes Prow Robot
d857790d36
Merge pull request #72558 from denkensk/add-goroutine-move-unschedulablepods-to-activeq
Move unschedulable pods to the active queue if they are not retried for more than 1 minute
2019-01-16 17:15:16 -08:00
wangqingcan
de8cfdcd79 add goroutine to move unschedulablepods to activeq regularly 2019-01-16 12:08:19 +08:00
Kubernetes Prow Robot
db60e4f20c
Merge pull request #72632 from danielqsj/sch_pod
Move getNextPod to closure
2019-01-08 19:22:19 -08:00
Kubernetes Prow Robot
5a708017e9
Merge pull request #72619 from everpeace/fix-starvation-by-sorting-queue-with-last-probe-time
change sort function of scheduling queue to avoid starvation when a lot of unscheduleable pods are in the queue
2019-01-07 20:24:24 -08:00
danielqsj
8dc1e83946 Add func comment for MakeNextPodFunc 2019-01-08 11:07:47 +08:00
danielqsj
554ad383e3 Move getNextPod to closure 2019-01-07 17:54:49 +08:00
Shingo Omura
22079a79d4 change sort function of scheduling queue to avoid starvation when unschedulable pods are in the queue
When starvation heppens:
- a lot of unschedulable pods exists in the head of queue
- because condition.LastTransitionTime is updated only when condition.Status changed
- (this means that once a pod is marked unschedulable, the field never updated until the pod successfuly scheduled.)

What was changed:
- condition.LastProbeTime is updated everytime when pod is determined
unschedulable.
- changed sort function so to use LastProbeTime to avoid starvation
described above

Consideration:
- This changes increases k8s API server load because it updates Pod.status whenever scheduler decides it as
unschedulable.

Signed-off-by: Shingo Omura <everpeace@gmail.com>
2019-01-07 11:05:45 +09:00
Kubernetes Prow Robot
222d7837a8
Merge pull request #72303 from cofyc/fix72013-cleanup-scheduler
Update comments to reflect current logic
2019-01-03 15:51:34 -08:00
Yecheng Fu
fa88bcc154 Update comments for PriorityQueue.
Log condition reason which is useful for debugging.
2019-01-03 09:25:05 +08:00
Bobby (Babak) Salamat
7044145920 Fix race in setting nominated node 2018-12-29 22:54:15 -08:00
Bobby (Babak) Salamat
48b6f75829 Add pods in the backoff queue to the list of pending pods 2018-12-20 17:28:23 -08:00
Jonathan Basseri
d27d28a44e Flatten nominated pod logic in PriorityQueue.
This replaces deeply nested ifs & fors with early returns & continues.
2018-12-14 18:11:12 -08:00
Jonathan Basseri
fae4f69d36 Fix return value of PriorityQueue.Add.
This function was returning a non-nil error for the common, non-failure
case. The fix is to properly scope local error values and add early
returns.
2018-12-14 16:44:21 -08:00
mlmhl
2fe9b1438c activate unschedulable pods only if the node became more schedulable 2018-12-10 09:48:23 +08:00
Gregory Haynes
5e4ccede4c Reschedule with backoff
With the alpha scheduling queue we move pods from unschedulable to
active on certain events without a backoff. As a result we can cause
starvation issues if high priority pods are in the unschedulable queue.
Implement a backoff mechanism for pods being moved to active.

Closes #56721
2018-12-06 16:38:34 +00:00
Gregory Haynes
c821f2ed2f Move scheduling Heap in to scheduler.core.utils
The Heap data structure is useful for our backoff system in addition to
scheduling queue. Move it to somewhere it can be consumed by both
systems and properly export needed names. Also adding unit tests
from client-go/tools/cache/heap.go.
2018-12-04 18:01:42 +00:00
Bobby (Babak) Salamat
554acf2b38 Change sort function of the scheduling queue to avoid starvation 2018-11-27 17:08:40 -08:00
Wei Huang
b4fd11512a
ensure scheduler preemptor behaves in an efficient/correct path
- don't update nominatedMap cache when Pop() an element from activeQ
- instead, delete the nominated info from cache when it's "assumed"
- unit test behavior adjusted
- expose SchedulingQueue in factory.Config
2018-11-16 14:22:15 -08:00
Davanum Srinivas
954996e231
Move from glog to klog
- Move from the old github.com/golang/glog to k8s.io/klog
- klog as explicit InitFlags() so we add them as necessary
- we update the other repositories that we vendor that made a similar
change from glog to klog
  * github.com/kubernetes/repo-infra
  * k8s.io/gengo/
  * k8s.io/kube-openapi/
  * github.com/google/cadvisor
- Entirely remove all references to glog
- Fix some tests by explicit InitFlags in their init() methods

Change-Id: I92db545ff36fcec83afe98f550c9e630098b3135
2018-11-10 07:50:31 -05:00
Wei Huang
9da576f03c
move SchedulingQueue to pkg/scheduler/internal/queue 2018-09-28 11:51:02 -07:00