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
437e133b
Commit
437e133b
authored
Jul 04, 2016
by
PingWang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimise the process of the CalculateSpreadPriority in selector_spreading.go
Signed-off-by:
PingWang
<
wang.ping5@zte.com.cn
>
parent
54c8c820
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
selector_spreading.go
.../pkg/scheduler/algorithm/priorities/selector_spreading.go
+5
-5
No files found.
plugin/pkg/scheduler/algorithm/priorities/selector_spreading.go
View file @
437e133b
...
...
@@ -62,6 +62,11 @@ func NewSelectorSpreadPriority(podLister algorithm.PodLister, serviceLister algo
// pods which match the same service selectors or RC selectors as the pod being scheduled.
// Where zone information is included on the nodes, it favors nodes in zones with fewer existing matching pods.
func
(
s
*
SelectorSpread
)
CalculateSpreadPriority
(
pod
*
api
.
Pod
,
nodeNameToInfo
map
[
string
]
*
schedulercache
.
NodeInfo
,
nodeLister
algorithm
.
NodeLister
)
(
schedulerapi
.
HostPriorityList
,
error
)
{
nodes
,
err
:=
nodeLister
.
List
()
if
err
!=
nil
{
return
nil
,
err
}
selectors
:=
make
([]
labels
.
Selector
,
0
,
3
)
if
services
,
err
:=
s
.
serviceLister
.
GetPodServices
(
pod
);
err
==
nil
{
for
_
,
service
:=
range
services
{
...
...
@@ -81,11 +86,6 @@ func (s *SelectorSpread) CalculateSpreadPriority(pod *api.Pod, nodeNameToInfo ma
}
}
nodes
,
err
:=
nodeLister
.
List
()
if
err
!=
nil
{
return
nil
,
err
}
// Count similar pods by node
countsByNodeName
:=
make
(
map
[
string
]
float32
,
len
(
nodes
))
countsByZone
:=
make
(
map
[
string
]
float32
,
10
)
...
...
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