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
29195faa
Unverified
Commit
29195faa
authored
May 16, 2019
by
Wei Huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
supplemental logic to ensure nominatedPodMap.update() is still stateless
parent
115fe94b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
8 deletions
+13
-8
scheduling_queue.go
pkg/scheduler/internal/queue/scheduling_queue.go
+13
-8
No files found.
pkg/scheduler/internal/queue/scheduling_queue.go
View file @
29195faa
...
@@ -774,17 +774,22 @@ func (npm *nominatedPodMap) delete(p *v1.Pod) {
...
@@ -774,17 +774,22 @@ func (npm *nominatedPodMap) delete(p *v1.Pod) {
func
(
npm
*
nominatedPodMap
)
update
(
oldPod
,
newPod
*
v1
.
Pod
)
{
func
(
npm
*
nominatedPodMap
)
update
(
oldPod
,
newPod
*
v1
.
Pod
)
{
// In some cases, an Update event with no "NominatedNode" present is received right
// In some cases, an Update event with no "NominatedNode" present is received right
// after a node("NominatedNode") is reserved for this pod in memory.
// 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
// In this case, we need to keep reserving the NominatedNode when updating the pod pointer.
// the newPod doesn't carry Status.NominatedNodeName.
nodeName
:=
""
// In this case, during this time other low-priority pods have chances to take space which
// We won't fall into below `if` block if the Update event represents:
// was reserved for the nominatedPod.
// (1) NominatedNode info is added
if
len
(
oldPod
.
Status
.
NominatedNodeName
)
==
0
&&
len
(
newPod
.
Status
.
NominatedNodeName
)
==
0
{
// (2) NominatedNode info is updated
return
// (3) NominatedNode info is removed
if
NominatedNodeName
(
oldPod
)
==
""
&&
NominatedNodeName
(
newPod
)
==
""
{
if
nnn
,
ok
:=
npm
.
nominatedPodToNode
[
oldPod
.
UID
];
ok
{
// This is the only case we should continue reserving the NominatedNode
nodeName
=
nnn
}
}
}
// We update
once the nominatedNodeName gets changed
, to ensure
// We update
irrespective of the nominatedNodeName changed or not
, to ensure
// that pod pointer is updated.
// that pod pointer is updated.
npm
.
delete
(
oldPod
)
npm
.
delete
(
oldPod
)
npm
.
add
(
newPod
,
""
)
npm
.
add
(
newPod
,
nodeName
)
}
}
func
(
npm
*
nominatedPodMap
)
podsForNode
(
nodeName
string
)
[]
*
v1
.
Pod
{
func
(
npm
*
nominatedPodMap
)
podsForNode
(
nodeName
string
)
[]
*
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