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
198e0f7e
Unverified
Commit
198e0f7e
authored
Dec 07, 2018
by
Kubernetes Prow Robot
Committed by
GitHub
Dec 07, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #71824 from bsalamat/automated-cherry-pick-of-#71722-upstream-release-1.13
Automated cherry pick of #71722 upstream release 1.13
parents
ad728da0
612b3c9b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
23 deletions
+25
-23
generic_scheduler.go
pkg/scheduler/core/generic_scheduler.go
+25
-23
No files found.
pkg/scheduler/core/generic_scheduler.go
View file @
198e0f7e
...
@@ -655,24 +655,26 @@ func PrioritizeNodes(
...
@@ -655,24 +655,26 @@ func PrioritizeNodes(
// DEPRECATED: we can remove this when all priorityConfigs implement the
// DEPRECATED: we can remove this when all priorityConfigs implement the
// Map-Reduce pattern.
// Map-Reduce pattern.
workqueue
.
ParallelizeUntil
(
context
.
TODO
(),
16
,
len
(
priorityConfigs
),
func
(
i
int
)
{
for
i
:=
range
priorityConfigs
{
priorityConfig
:=
priorityConfigs
[
i
]
if
priorityConfigs
[
i
]
.
Function
!=
nil
{
if
priorityConfig
.
Function
==
nil
{
wg
.
Add
(
1
)
results
[
i
]
=
make
(
schedulerapi
.
HostPriorityList
,
len
(
nodes
))
go
func
(
index
int
)
{
return
defer
wg
.
Done
()
}
var
err
error
var
err
error
results
[
i
],
err
=
priorityConfig
.
Function
(
pod
,
nodeNameToInfo
,
nodes
)
results
[
index
],
err
=
priorityConfigs
[
index
]
.
Function
(
pod
,
nodeNameToInfo
,
nodes
)
if
err
!=
nil
{
if
err
!=
nil
{
appendError
(
err
)
appendError
(
err
)
}
}
})
}(
i
)
}
else
{
results
[
i
]
=
make
(
schedulerapi
.
HostPriorityList
,
len
(
nodes
))
}
}
workqueue
.
ParallelizeUntil
(
context
.
TODO
(),
16
,
len
(
nodes
),
func
(
index
int
)
{
workqueue
.
ParallelizeUntil
(
context
.
TODO
(),
16
,
len
(
nodes
),
func
(
index
int
)
{
nodeInfo
:=
nodeNameToInfo
[
nodes
[
index
]
.
Name
]
nodeInfo
:=
nodeNameToInfo
[
nodes
[
index
]
.
Name
]
for
i
,
priorityConfig
:=
range
priorityConfigs
{
for
i
:=
range
priorityConfigs
{
if
priorityConfig
.
Function
!=
nil
{
if
priorityConfig
s
[
i
]
.
Function
!=
nil
{
continue
continue
}
}
...
@@ -685,22 +687,22 @@ func PrioritizeNodes(
...
@@ -685,22 +687,22 @@ func PrioritizeNodes(
}
}
})
})
for
i
,
priorityConfig
:=
range
priorityConfigs
{
for
i
:=
range
priorityConfigs
{
if
priorityConfig
.
Reduce
==
nil
{
if
priorityConfig
s
[
i
]
.
Reduce
==
nil
{
continue
continue
}
}
wg
.
Add
(
1
)
wg
.
Add
(
1
)
go
func
(
index
int
,
config
algorithm
.
PriorityConfig
)
{
go
func
(
index
int
)
{
defer
wg
.
Done
()
defer
wg
.
Done
()
if
err
:=
config
.
Reduce
(
pod
,
meta
,
nodeNameToInfo
,
results
[
index
]);
err
!=
nil
{
if
err
:=
priorityConfigs
[
index
]
.
Reduce
(
pod
,
meta
,
nodeNameToInfo
,
results
[
index
]);
err
!=
nil
{
appendError
(
err
)
appendError
(
err
)
}
}
if
klog
.
V
(
10
)
{
if
klog
.
V
(
10
)
{
for
_
,
hostPriority
:=
range
results
[
index
]
{
for
_
,
hostPriority
:=
range
results
[
index
]
{
klog
.
Infof
(
"%v -> %v: %v, Score: (%d)"
,
util
.
GetPodFullName
(
pod
),
hostPriority
.
Host
,
config
.
Name
,
hostPriority
.
Score
)
klog
.
Infof
(
"%v -> %v: %v, Score: (%d)"
,
util
.
GetPodFullName
(
pod
),
hostPriority
.
Host
,
priorityConfigs
[
index
]
.
Name
,
hostPriority
.
Score
)
}
}
}
}
}(
i
,
priorityConfig
)
}(
i
)
}
}
// Wait for all computations to be finished.
// Wait for all computations to be finished.
wg
.
Wait
()
wg
.
Wait
()
...
@@ -720,14 +722,14 @@ func PrioritizeNodes(
...
@@ -720,14 +722,14 @@ func PrioritizeNodes(
if
len
(
extenders
)
!=
0
&&
nodes
!=
nil
{
if
len
(
extenders
)
!=
0
&&
nodes
!=
nil
{
combinedScores
:=
make
(
map
[
string
]
int
,
len
(
nodeNameToInfo
))
combinedScores
:=
make
(
map
[
string
]
int
,
len
(
nodeNameToInfo
))
for
_
,
extender
:=
range
extenders
{
for
i
:=
range
extenders
{
if
!
extender
.
IsInterested
(
pod
)
{
if
!
extender
s
[
i
]
.
IsInterested
(
pod
)
{
continue
continue
}
}
wg
.
Add
(
1
)
wg
.
Add
(
1
)
go
func
(
ext
algorithm
.
SchedulerExtender
)
{
go
func
(
ext
Index
int
)
{
defer
wg
.
Done
()
defer
wg
.
Done
()
prioritizedList
,
weight
,
err
:=
ext
.
Prioritize
(
pod
,
nodes
)
prioritizedList
,
weight
,
err
:=
ext
enders
[
extIndex
]
.
Prioritize
(
pod
,
nodes
)
if
err
!=
nil
{
if
err
!=
nil
{
// Prioritization errors from extender can be ignored, let k8s/other extenders determine the priorities
// Prioritization errors from extender can be ignored, let k8s/other extenders determine the priorities
return
return
...
@@ -736,12 +738,12 @@ func PrioritizeNodes(
...
@@ -736,12 +738,12 @@ func PrioritizeNodes(
for
i
:=
range
*
prioritizedList
{
for
i
:=
range
*
prioritizedList
{
host
,
score
:=
(
*
prioritizedList
)[
i
]
.
Host
,
(
*
prioritizedList
)[
i
]
.
Score
host
,
score
:=
(
*
prioritizedList
)[
i
]
.
Host
,
(
*
prioritizedList
)[
i
]
.
Score
if
klog
.
V
(
10
)
{
if
klog
.
V
(
10
)
{
klog
.
Infof
(
"%v -> %v: %v, Score: (%d)"
,
util
.
GetPodFullName
(
pod
),
host
,
ext
.
Name
(),
score
)
klog
.
Infof
(
"%v -> %v: %v, Score: (%d)"
,
util
.
GetPodFullName
(
pod
),
host
,
ext
enders
[
extIndex
]
.
Name
(),
score
)
}
}
combinedScores
[
host
]
+=
score
*
weight
combinedScores
[
host
]
+=
score
*
weight
}
}
mu
.
Unlock
()
mu
.
Unlock
()
}(
extender
)
}(
i
)
}
}
// wait for all go routines to finish
// wait for all go routines to finish
wg
.
Wait
()
wg
.
Wait
()
...
...
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