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
e3f4e1e3
Commit
e3f4e1e3
authored
Jan 14, 2019
by
Bobby (Babak) Salamat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not snapshot scheduler cache before starting preemption
parent
a2daf66a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
generic_scheduler.go
pkg/scheduler/core/generic_scheduler.go
+9
-6
No files found.
pkg/scheduler/core/generic_scheduler.go
View file @
e3f4e1e3
...
@@ -272,6 +272,13 @@ func (g *genericScheduler) selectHost(priorityList schedulerapi.HostPriorityList
...
@@ -272,6 +272,13 @@ func (g *genericScheduler) selectHost(priorityList schedulerapi.HostPriorityList
// returns 1) the node, 2) the list of preempted pods if such a node is found,
// returns 1) the node, 2) the list of preempted pods if such a node is found,
// 3) A list of pods whose nominated node name should be cleared, and 4) any
// 3) A list of pods whose nominated node name should be cleared, and 4) any
// possible error.
// possible error.
// Preempt does not update its snapshot. It uses the same snapshot used in the
// scheduling cycle. This is to avoid a scenario where preempt finds feasible
// nodes without preempting any pod. When there are many pending pods in the
// scheduling queue a nominated pod will go back to the queue and behind
// other pods with the same priority. The nominated pod prevents other pods from
// using the nominated resources and the nominated pod could take a long time
// before it is retried after many other pending pods.
func
(
g
*
genericScheduler
)
Preempt
(
pod
*
v1
.
Pod
,
nodeLister
algorithm
.
NodeLister
,
scheduleErr
error
)
(
*
v1
.
Node
,
[]
*
v1
.
Pod
,
[]
*
v1
.
Pod
,
error
)
{
func
(
g
*
genericScheduler
)
Preempt
(
pod
*
v1
.
Pod
,
nodeLister
algorithm
.
NodeLister
,
scheduleErr
error
)
(
*
v1
.
Node
,
[]
*
v1
.
Pod
,
[]
*
v1
.
Pod
,
error
)
{
// Scheduler may return various types of errors. Consider preemption only if
// Scheduler may return various types of errors. Consider preemption only if
// the error is of type FitError.
// the error is of type FitError.
...
@@ -279,10 +286,6 @@ func (g *genericScheduler) Preempt(pod *v1.Pod, nodeLister algorithm.NodeLister,
...
@@ -279,10 +286,6 @@ func (g *genericScheduler) Preempt(pod *v1.Pod, nodeLister algorithm.NodeLister,
if
!
ok
||
fitError
==
nil
{
if
!
ok
||
fitError
==
nil
{
return
nil
,
nil
,
nil
,
nil
return
nil
,
nil
,
nil
,
nil
}
}
err
:=
g
.
snapshot
()
if
err
!=
nil
{
return
nil
,
nil
,
nil
,
err
}
if
!
podEligibleToPreemptOthers
(
pod
,
g
.
cachedNodeInfoMap
)
{
if
!
podEligibleToPreemptOthers
(
pod
,
g
.
cachedNodeInfoMap
)
{
klog
.
V
(
5
)
.
Infof
(
"Pod %v/%v is not eligible for more preemption."
,
pod
.
Namespace
,
pod
.
Name
)
klog
.
V
(
5
)
.
Infof
(
"Pod %v/%v is not eligible for more preemption."
,
pod
.
Namespace
,
pod
.
Name
)
return
nil
,
nil
,
nil
,
nil
return
nil
,
nil
,
nil
,
nil
...
@@ -1073,7 +1076,7 @@ func nodesWherePreemptionMightHelp(nodes []*v1.Node, failedPredicatesMap FailedP
...
@@ -1073,7 +1076,7 @@ func nodesWherePreemptionMightHelp(nodes []*v1.Node, failedPredicatesMap FailedP
potentialNodes
:=
[]
*
v1
.
Node
{}
potentialNodes
:=
[]
*
v1
.
Node
{}
for
_
,
node
:=
range
nodes
{
for
_
,
node
:=
range
nodes
{
unresolvableReasonExist
:=
false
unresolvableReasonExist
:=
false
failedPredicates
,
found
:=
failedPredicatesMap
[
node
.
Name
]
failedPredicates
,
_
:=
failedPredicatesMap
[
node
.
Name
]
// If we assume that scheduler looks at all nodes and populates the failedPredicateMap
// If we assume that scheduler looks at all nodes and populates the failedPredicateMap
// (which is the case today), the !found case should never happen, but we'd prefer
// (which is the case today), the !found case should never happen, but we'd prefer
// to rely less on such assumptions in the code when checking does not impose
// to rely less on such assumptions in the code when checking does not impose
...
@@ -1104,7 +1107,7 @@ func nodesWherePreemptionMightHelp(nodes []*v1.Node, failedPredicatesMap FailedP
...
@@ -1104,7 +1107,7 @@ func nodesWherePreemptionMightHelp(nodes []*v1.Node, failedPredicatesMap FailedP
break
break
}
}
}
}
if
!
found
||
!
unresolvableReasonExist
{
if
!
unresolvableReasonExist
{
klog
.
V
(
3
)
.
Infof
(
"Node %v is a potential node for preemption."
,
node
.
Name
)
klog
.
V
(
3
)
.
Infof
(
"Node %v is a potential node for preemption."
,
node
.
Name
)
potentialNodes
=
append
(
potentialNodes
,
node
)
potentialNodes
=
append
(
potentialNodes
,
node
)
}
}
...
...
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