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
31538db1
Commit
31538db1
authored
Jul 07, 2016
by
Wojciech Tyczynski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid growing slices
parent
6c77c01f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
6 deletions
+6
-6
priorities.go
plugin/pkg/scheduler/algorithm/priorities/priorities.go
+4
-4
selector_spreading.go
.../pkg/scheduler/algorithm/priorities/selector_spreading.go
+1
-1
taint_toleration.go
...in/pkg/scheduler/algorithm/priorities/taint_toleration.go
+1
-1
No files found.
plugin/pkg/scheduler/algorithm/priorities/priorities.go
View file @
31538db1
...
@@ -85,7 +85,7 @@ func LeastRequestedPriority(pod *api.Pod, nodeNameToInfo map[string]*schedulerca
...
@@ -85,7 +85,7 @@ func LeastRequestedPriority(pod *api.Pod, nodeNameToInfo map[string]*schedulerca
return
schedulerapi
.
HostPriorityList
{},
err
return
schedulerapi
.
HostPriorityList
{},
err
}
}
list
:=
schedulerapi
.
HostPriorityList
{}
list
:=
make
(
schedulerapi
.
HostPriorityList
,
0
,
len
(
nodes
.
Items
))
for
i
:=
range
nodes
.
Items
{
for
i
:=
range
nodes
.
Items
{
node
:=
&
nodes
.
Items
[
i
]
node
:=
&
nodes
.
Items
[
i
]
list
=
append
(
list
,
calculateResourceOccupancy
(
pod
,
node
,
nodeNameToInfo
[
node
.
Name
]))
list
=
append
(
list
,
calculateResourceOccupancy
(
pod
,
node
,
nodeNameToInfo
[
node
.
Name
]))
...
@@ -122,7 +122,7 @@ func (n *NodeLabelPrioritizer) CalculateNodeLabelPriority(pod *api.Pod, nodeName
...
@@ -122,7 +122,7 @@ func (n *NodeLabelPrioritizer) CalculateNodeLabelPriority(pod *api.Pod, nodeName
labeledNodes
[
node
.
Name
]
=
(
exists
&&
n
.
presence
)
||
(
!
exists
&&
!
n
.
presence
)
labeledNodes
[
node
.
Name
]
=
(
exists
&&
n
.
presence
)
||
(
!
exists
&&
!
n
.
presence
)
}
}
result
:=
[]
schedulerapi
.
HostPriority
{}
result
:=
make
(
schedulerapi
.
HostPriorityList
,
0
,
len
(
nodes
.
Items
))
//score int - scale of 0-10
//score int - scale of 0-10
// 0 being the lowest priority and 10 being the highest
// 0 being the lowest priority and 10 being the highest
for
nodeName
,
success
:=
range
labeledNodes
{
for
nodeName
,
success
:=
range
labeledNodes
{
...
@@ -166,7 +166,7 @@ func ImageLocalityPriority(pod *api.Pod, nodeNameToInfo map[string]*schedulercac
...
@@ -166,7 +166,7 @@ func ImageLocalityPriority(pod *api.Pod, nodeNameToInfo map[string]*schedulercac
}
}
}
}
result
:=
[]
schedulerapi
.
HostPriority
{}
result
:=
make
(
schedulerapi
.
HostPriorityList
,
0
,
len
(
nodes
.
Items
))
// score int - scale of 0-10
// score int - scale of 0-10
// 0 being the lowest priority and 10 being the highest.
// 0 being the lowest priority and 10 being the highest.
for
nodeName
,
sumSize
:=
range
sumSizeMap
{
for
nodeName
,
sumSize
:=
range
sumSizeMap
{
...
@@ -221,7 +221,7 @@ func BalancedResourceAllocation(pod *api.Pod, nodeNameToInfo map[string]*schedul
...
@@ -221,7 +221,7 @@ func BalancedResourceAllocation(pod *api.Pod, nodeNameToInfo map[string]*schedul
return
schedulerapi
.
HostPriorityList
{},
err
return
schedulerapi
.
HostPriorityList
{},
err
}
}
list
:=
schedulerapi
.
HostPriorityList
{}
list
:=
make
(
schedulerapi
.
HostPriorityList
,
0
,
len
(
nodes
.
Items
))
for
i
:=
range
nodes
.
Items
{
for
i
:=
range
nodes
.
Items
{
node
:=
&
nodes
.
Items
[
i
]
node
:=
&
nodes
.
Items
[
i
]
list
=
append
(
list
,
calculateBalancedResourceAllocation
(
pod
,
node
,
nodeNameToInfo
[
node
.
Name
]))
list
=
append
(
list
,
calculateBalancedResourceAllocation
(
pod
,
node
,
nodeNameToInfo
[
node
.
Name
]))
...
...
plugin/pkg/scheduler/algorithm/priorities/selector_spreading.go
View file @
31538db1
...
@@ -207,7 +207,7 @@ func (s *SelectorSpread) CalculateSpreadPriority(pod *api.Pod, nodeNameToInfo ma
...
@@ -207,7 +207,7 @@ func (s *SelectorSpread) CalculateSpreadPriority(pod *api.Pod, nodeNameToInfo ma
}
}
}
}
result
:=
[]
schedulerapi
.
HostPriority
{}
result
:=
make
(
schedulerapi
.
HostPriorityList
,
0
,
len
(
nodes
.
Items
))
//score int - scale of 0-maxPriority
//score int - scale of 0-maxPriority
// 0 being the lowest priority and maxPriority being the highest
// 0 being the lowest priority and maxPriority being the highest
for
i
:=
range
nodes
.
Items
{
for
i
:=
range
nodes
.
Items
{
...
...
plugin/pkg/scheduler/algorithm/priorities/taint_toleration.go
View file @
31538db1
...
@@ -100,7 +100,7 @@ func (s *TaintToleration) ComputeTaintTolerationPriority(pod *api.Pod, nodeNameT
...
@@ -100,7 +100,7 @@ func (s *TaintToleration) ComputeTaintTolerationPriority(pod *api.Pod, nodeNameT
// The maximum priority value to give to a node
// The maximum priority value to give to a node
// Priority values range from 0 - maxPriority
// Priority values range from 0 - maxPriority
const
maxPriority
=
10
const
maxPriority
=
10
result
:=
[]
schedulerapi
.
HostPriority
{}
result
:=
make
(
schedulerapi
.
HostPriorityList
,
0
,
len
(
nodes
.
Items
))
for
_
,
node
:=
range
nodes
.
Items
{
for
_
,
node
:=
range
nodes
.
Items
{
fScore
:=
float64
(
maxPriority
)
fScore
:=
float64
(
maxPriority
)
if
maxCount
>
0
{
if
maxCount
>
0
{
...
...
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