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
39715532
Commit
39715532
authored
Oct 26, 2016
by
gmarek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Scheduler Reduce function can use nodeNameToNodeInfo map
parent
7a49b0eb
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
5 additions
and
5 deletions
+5
-5
node_affinity.go
plugin/pkg/scheduler/algorithm/priorities/node_affinity.go
+1
-1
taint_toleration.go
...in/pkg/scheduler/algorithm/priorities/taint_toleration.go
+1
-1
test_util.go
plugin/pkg/scheduler/algorithm/priorities/test_util.go
+1
-1
types.go
plugin/pkg/scheduler/algorithm/types.go
+1
-1
generic_scheduler.go
plugin/pkg/scheduler/generic_scheduler.go
+1
-1
No files found.
plugin/pkg/scheduler/algorithm/priorities/node_affinity.go
View file @
39715532
...
@@ -78,7 +78,7 @@ func CalculateNodeAffinityPriorityMap(pod *api.Pod, meta interface{}, nodeInfo *
...
@@ -78,7 +78,7 @@ func CalculateNodeAffinityPriorityMap(pod *api.Pod, meta interface{}, nodeInfo *
},
nil
},
nil
}
}
func
CalculateNodeAffinityPriorityReduce
(
pod
*
api
.
Pod
,
meta
interface
{},
result
schedulerapi
.
HostPriorityList
)
error
{
func
CalculateNodeAffinityPriorityReduce
(
pod
*
api
.
Pod
,
meta
interface
{},
nodeNameToInfo
map
[
string
]
*
schedulercache
.
NodeInfo
,
result
schedulerapi
.
HostPriorityList
)
error
{
var
maxCount
int
var
maxCount
int
for
i
:=
range
result
{
for
i
:=
range
result
{
if
result
[
i
]
.
Score
>
maxCount
{
if
result
[
i
]
.
Score
>
maxCount
{
...
...
plugin/pkg/scheduler/algorithm/priorities/taint_toleration.go
View file @
39715532
...
@@ -88,7 +88,7 @@ func ComputeTaintTolerationPriorityMap(pod *api.Pod, meta interface{}, nodeInfo
...
@@ -88,7 +88,7 @@ func ComputeTaintTolerationPriorityMap(pod *api.Pod, meta interface{}, nodeInfo
},
nil
},
nil
}
}
func
ComputeTaintTolerationPriorityReduce
(
pod
*
api
.
Pod
,
meta
interface
{},
result
schedulerapi
.
HostPriorityList
)
error
{
func
ComputeTaintTolerationPriorityReduce
(
pod
*
api
.
Pod
,
meta
interface
{},
nodeNameToInfo
map
[
string
]
*
schedulercache
.
NodeInfo
,
result
schedulerapi
.
HostPriorityList
)
error
{
var
maxCount
int
var
maxCount
int
for
i
:=
range
result
{
for
i
:=
range
result
{
if
result
[
i
]
.
Score
>
maxCount
{
if
result
[
i
]
.
Score
>
maxCount
{
...
...
plugin/pkg/scheduler/algorithm/priorities/test_util.go
View file @
39715532
...
@@ -51,7 +51,7 @@ func priorityFunction(mapFn algorithm.PriorityMapFunction, reduceFn algorithm.Pr
...
@@ -51,7 +51,7 @@ func priorityFunction(mapFn algorithm.PriorityMapFunction, reduceFn algorithm.Pr
result
=
append
(
result
,
hostResult
)
result
=
append
(
result
,
hostResult
)
}
}
if
reduceFn
!=
nil
{
if
reduceFn
!=
nil
{
if
err
:=
reduceFn
(
pod
,
nil
,
result
);
err
!=
nil
{
if
err
:=
reduceFn
(
pod
,
nil
,
nodeNameToInfo
,
result
);
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
}
}
...
...
plugin/pkg/scheduler/algorithm/types.go
View file @
39715532
...
@@ -36,7 +36,7 @@ type PriorityMapFunction func(pod *api.Pod, meta interface{}, nodeInfo *schedule
...
@@ -36,7 +36,7 @@ type PriorityMapFunction func(pod *api.Pod, meta interface{}, nodeInfo *schedule
// final scores for all nodes.
// final scores for all nodes.
// TODO: Figure out the exact API of this method.
// TODO: Figure out the exact API of this method.
// TODO: Change interface{} to a specific type.
// TODO: Change interface{} to a specific type.
type
PriorityReduceFunction
func
(
pod
*
api
.
Pod
,
meta
interface
{},
result
schedulerapi
.
HostPriorityList
)
error
type
PriorityReduceFunction
func
(
pod
*
api
.
Pod
,
meta
interface
{},
nodeNameToInfo
map
[
string
]
*
schedulercache
.
NodeInfo
,
result
schedulerapi
.
HostPriorityList
)
error
// MetdataProducer is a function that computes metadata for a given pod.
// MetdataProducer is a function that computes metadata for a given pod.
type
MetadataProducer
func
(
pod
*
api
.
Pod
,
nodeNameToInfo
map
[
string
]
*
schedulercache
.
NodeInfo
)
interface
{}
type
MetadataProducer
func
(
pod
*
api
.
Pod
,
nodeNameToInfo
map
[
string
]
*
schedulercache
.
NodeInfo
)
interface
{}
...
...
plugin/pkg/scheduler/generic_scheduler.go
View file @
39715532
...
@@ -315,7 +315,7 @@ func PrioritizeNodes(
...
@@ -315,7 +315,7 @@ func PrioritizeNodes(
wg
.
Add
(
1
)
wg
.
Add
(
1
)
go
func
(
index
int
,
config
algorithm
.
PriorityConfig
)
{
go
func
(
index
int
,
config
algorithm
.
PriorityConfig
)
{
defer
wg
.
Done
()
defer
wg
.
Done
()
if
err
:=
config
.
Reduce
(
pod
,
meta
,
results
[
index
]);
err
!=
nil
{
if
err
:=
config
.
Reduce
(
pod
,
meta
,
nodeNameToInfo
,
results
[
index
]);
err
!=
nil
{
appendError
(
err
)
appendError
(
err
)
}
}
}(
i
,
priorityConfig
)
}(
i
,
priorityConfig
)
...
...
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