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
67f9528e
Commit
67f9528e
authored
Dec 17, 2018
by
Bobby (Babak) Salamat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix race in setting nominated node
parent
c75356fd
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
233 additions
and
89 deletions
+233
-89
generic_scheduler.go
pkg/scheduler/core/generic_scheduler.go
+2
-2
scheduling_queue.go
pkg/scheduler/internal/queue/scheduling_queue.go
+111
-65
scheduling_queue_test.go
pkg/scheduler/internal/queue/scheduling_queue_test.go
+112
-22
scheduler.go
pkg/scheduler/scheduler.go
+8
-0
No files found.
pkg/scheduler/core/generic_scheduler.go
View file @
67f9528e
...
...
@@ -351,7 +351,7 @@ func (g *genericScheduler) processPreemptionWithExtenders(
// worth the complexity, especially because we generally expect to have a very
// small number of nominated pods per node.
func
(
g
*
genericScheduler
)
getLowerPriorityNominatedPods
(
pod
*
v1
.
Pod
,
nodeName
string
)
[]
*
v1
.
Pod
{
pods
:=
g
.
schedulingQueue
.
Waiting
PodsForNode
(
nodeName
)
pods
:=
g
.
schedulingQueue
.
Nominated
PodsForNode
(
nodeName
)
if
len
(
pods
)
==
0
{
return
nil
...
...
@@ -501,7 +501,7 @@ func addNominatedPods(pod *v1.Pod, meta algorithm.PredicateMetadata,
// This may happen only in tests.
return
false
,
meta
,
nodeInfo
}
nominatedPods
:=
queue
.
Waiting
PodsForNode
(
nodeInfo
.
Node
()
.
Name
)
nominatedPods
:=
queue
.
Nominated
PodsForNode
(
nodeInfo
.
Node
()
.
Name
)
if
nominatedPods
==
nil
||
len
(
nominatedPods
)
==
0
{
return
false
,
meta
,
nodeInfo
}
...
...
pkg/scheduler/internal/queue/scheduling_queue.go
View file @
67f9528e
This diff is collapsed.
Click to expand it.
pkg/scheduler/internal/queue/scheduling_queue_test.go
View file @
67f9528e
This diff is collapsed.
Click to expand it.
pkg/scheduler/scheduler.go
View file @
67f9528e
...
...
@@ -328,11 +328,19 @@ func (sched *Scheduler) preempt(preemptor *v1.Pod, scheduleErr error) (string, e
var
nodeName
=
""
if
node
!=
nil
{
nodeName
=
node
.
Name
// Update the scheduling queue with the nominated pod information. Without
// this, there would be a race condition between the next scheduling cycle
// and the time the scheduler receives a Pod Update for the nominated pod.
sched
.
config
.
SchedulingQueue
.
UpdateNominatedPodForNode
(
preemptor
,
nodeName
)
// Make a call to update nominated node name of the pod on the API server.
err
=
sched
.
config
.
PodPreemptor
.
SetNominatedNodeName
(
preemptor
,
nodeName
)
if
err
!=
nil
{
klog
.
Errorf
(
"Error in preemption process. Cannot update pod %v/%v annotations: %v"
,
preemptor
.
Namespace
,
preemptor
.
Name
,
err
)
sched
.
config
.
SchedulingQueue
.
DeleteNominatedPodIfExists
(
preemptor
)
return
""
,
err
}
for
_
,
victim
:=
range
victims
{
if
err
:=
sched
.
config
.
PodPreemptor
.
DeletePod
(
victim
);
err
!=
nil
{
klog
.
Errorf
(
"Error preempting pod %v/%v: %v"
,
victim
.
Namespace
,
victim
.
Name
,
err
)
...
...
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