Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
aee1ab34
Unverified
Commit
aee1ab34
authored
Dec 27, 2018
by
Kubernetes Prow Robot
Committed by
GitHub
Dec 27, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #72260 from bsalamat/fix_waiting_pods
Add pods in the backoff queue to the list of pending pods
parents
81a1f12d
48b6f758
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
9 deletions
+29
-9
comparer.go
pkg/scheduler/internal/cache/debugger/comparer.go
+2
-2
dumper.go
pkg/scheduler/internal/cache/debugger/dumper.go
+2
-2
scheduling_queue.go
pkg/scheduler/internal/queue/scheduling_queue.go
+9
-5
scheduling_queue_test.go
pkg/scheduler/internal/queue/scheduling_queue_test.go
+16
-0
No files found.
pkg/scheduler/internal/cache/debugger/comparer.go
View file @
aee1ab34
...
...
@@ -54,13 +54,13 @@ func (c *CacheComparer) Compare() error {
snapshot
:=
c
.
Cache
.
Snapshot
()
waitingPods
:=
c
.
PodQueue
.
Wait
ingPods
()
pendingPods
:=
c
.
PodQueue
.
Pend
ingPods
()
if
missed
,
redundant
:=
c
.
CompareNodes
(
nodes
,
snapshot
.
Nodes
);
len
(
missed
)
+
len
(
redundant
)
!=
0
{
klog
.
Warningf
(
"cache mismatch: missed nodes: %s; redundant nodes: %s"
,
missed
,
redundant
)
}
if
missed
,
redundant
:=
c
.
ComparePods
(
pods
,
wait
ingPods
,
snapshot
.
Nodes
);
len
(
missed
)
+
len
(
redundant
)
!=
0
{
if
missed
,
redundant
:=
c
.
ComparePods
(
pods
,
pend
ingPods
,
snapshot
.
Nodes
);
len
(
missed
)
+
len
(
redundant
)
!=
0
{
klog
.
Warningf
(
"cache mismatch: missed pods: %s; redundant pods: %s"
,
missed
,
redundant
)
}
...
...
pkg/scheduler/internal/cache/debugger/dumper.go
View file @
aee1ab34
...
...
@@ -52,9 +52,9 @@ func (d *CacheDumper) dumpNodes() {
// dumpSchedulingQueue writes pods in the scheduling queue to the scheduler logs.
func
(
d
*
CacheDumper
)
dumpSchedulingQueue
()
{
waitingPods
:=
d
.
podQueue
.
Wait
ingPods
()
pendingPods
:=
d
.
podQueue
.
Pend
ingPods
()
var
podData
strings
.
Builder
for
_
,
p
:=
range
wait
ingPods
{
for
_
,
p
:=
range
pend
ingPods
{
podData
.
WriteString
(
printPod
(
p
))
}
klog
.
Infof
(
"Dump of scheduling queue:
\n
%s"
,
podData
.
String
())
...
...
pkg/scheduler/internal/queue/scheduling_queue.go
View file @
aee1ab34
...
...
@@ -65,7 +65,7 @@ type SchedulingQueue interface {
AssignedPodAdded
(
pod
*
v1
.
Pod
)
AssignedPodUpdated
(
pod
*
v1
.
Pod
)
WaitingPodsForNode
(
nodeName
string
)
[]
*
v1
.
Pod
Wait
ingPods
()
[]
*
v1
.
Pod
Pend
ingPods
()
[]
*
v1
.
Pod
// Close closes the SchedulingQueue so that the goroutine which is
// waiting to pop items can exit gracefully.
Close
()
...
...
@@ -131,8 +131,8 @@ func (f *FIFO) Pop() (*v1.Pod, error) {
return
result
.
(
*
v1
.
Pod
),
err
}
//
WaitingPods returns all the waiting
pods in the queue.
func
(
f
*
FIFO
)
Wait
ingPods
()
[]
*
v1
.
Pod
{
//
PendingPods returns all the
pods in the queue.
func
(
f
*
FIFO
)
Pend
ingPods
()
[]
*
v1
.
Pod
{
result
:=
[]
*
v1
.
Pod
{}
for
_
,
pod
:=
range
f
.
FIFO
.
List
()
{
result
=
append
(
result
,
pod
.
(
*
v1
.
Pod
))
...
...
@@ -675,8 +675,9 @@ func (p *PriorityQueue) WaitingPodsForNode(nodeName string) []*v1.Pod {
return
nil
}
// WaitingPods returns all the waiting pods in the queue.
func
(
p
*
PriorityQueue
)
WaitingPods
()
[]
*
v1
.
Pod
{
// PendingPods returns all the pending pods in the queue. This function is
// used for debugging purposes in the scheduler cache dumper and comparer.
func
(
p
*
PriorityQueue
)
PendingPods
()
[]
*
v1
.
Pod
{
p
.
lock
.
Lock
()
defer
p
.
lock
.
Unlock
()
...
...
@@ -684,6 +685,9 @@ func (p *PriorityQueue) WaitingPods() []*v1.Pod {
for
_
,
pod
:=
range
p
.
activeQ
.
List
()
{
result
=
append
(
result
,
pod
.
(
*
v1
.
Pod
))
}
for
_
,
pod
:=
range
p
.
podBackoffQ
.
List
()
{
result
=
append
(
result
,
pod
.
(
*
v1
.
Pod
))
}
for
_
,
pod
:=
range
p
.
unschedulableQ
.
pods
{
result
=
append
(
result
,
pod
)
}
...
...
pkg/scheduler/internal/queue/scheduling_queue_test.go
View file @
aee1ab34
...
...
@@ -338,6 +338,22 @@ func TestPriorityQueue_WaitingPodsForNode(t *testing.T) {
}
}
func
TestPriorityQueue_PendingPods
(
t
*
testing
.
T
)
{
q
:=
NewPriorityQueue
(
nil
)
q
.
Add
(
&
medPriorityPod
)
q
.
unschedulableQ
.
addOrUpdate
(
&
unschedulablePod
)
q
.
unschedulableQ
.
addOrUpdate
(
&
highPriorityPod
)
expectedList
:=
[]
*
v1
.
Pod
{
&
medPriorityPod
,
&
unschedulablePod
,
&
highPriorityPod
}
if
!
reflect
.
DeepEqual
(
expectedList
,
q
.
PendingPods
())
{
t
.
Error
(
"Unexpected list of pending Pods for node."
)
}
// Move all to active queue. We should still see the same set of pods.
q
.
MoveAllToActiveQueue
()
if
!
reflect
.
DeepEqual
(
expectedList
,
q
.
PendingPods
())
{
t
.
Error
(
"Unexpected list of pending Pods for node."
)
}
}
func
TestUnschedulablePodsMap
(
t
*
testing
.
T
)
{
var
pods
=
[]
*
v1
.
Pod
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment