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
9fbccb4f
Commit
9fbccb4f
authored
Jul 05, 2015
by
David Oppenheimer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Respond to review comments.
parent
4ea8b8a6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
priorities.go
plugin/pkg/scheduler/algorithm/priorities/priorities.go
+6
-6
service_spreading.go
...n/pkg/scheduler/algorithm/priorities/service_spreading.go
+1
-1
No files found.
plugin/pkg/scheduler/algorithm/priorities/priorities.go
View file @
9fbccb4f
...
@@ -34,7 +34,7 @@ func calculateScore(requested int64, capacity int64, node string) int {
...
@@ -34,7 +34,7 @@ func calculateScore(requested int64, capacity int64, node string) int {
return
0
return
0
}
}
if
requested
>
capacity
{
if
requested
>
capacity
{
glog
.
Infof
(
"Combined requested resources %d from existing pods exceeds capacity %d on
minion:
%s"
,
glog
.
Infof
(
"Combined requested resources %d from existing pods exceeds capacity %d on
node
%s"
,
requested
,
capacity
,
node
)
requested
,
capacity
,
node
)
return
0
return
0
}
}
...
@@ -52,7 +52,7 @@ const defaultMemoryLimit int64 = 60 * 1024 * 1024 // 60 MB
...
@@ -52,7 +52,7 @@ const defaultMemoryLimit int64 = 60 * 1024 * 1024 // 60 MB
// TODO: Consider setting default as a fixed fraction of machine capacity (take "capacity api.ResourceList"
// TODO: Consider setting default as a fixed fraction of machine capacity (take "capacity api.ResourceList"
// as an additional argument here) rather than using constants
// as an additional argument here) rather than using constants
func
to
NonzeroLimits
(
limits
*
api
.
ResourceList
)
(
int64
,
int64
)
{
func
get
NonzeroLimits
(
limits
*
api
.
ResourceList
)
(
int64
,
int64
)
{
var
out_millicpu
,
out_memory
int64
var
out_millicpu
,
out_memory
int64
// Override if un-set, but not if explicitly set to zero
// Override if un-set, but not if explicitly set to zero
if
(
*
limits
.
Cpu
()
==
resource
.
Quantity
{})
{
if
(
*
limits
.
Cpu
()
==
resource
.
Quantity
{})
{
...
@@ -79,7 +79,7 @@ func calculateResourceOccupancy(pod *api.Pod, node api.Node, pods []*api.Pod) al
...
@@ -79,7 +79,7 @@ func calculateResourceOccupancy(pod *api.Pod, node api.Node, pods []*api.Pod) al
for
_
,
existingPod
:=
range
pods
{
for
_
,
existingPod
:=
range
pods
{
for
_
,
container
:=
range
existingPod
.
Spec
.
Containers
{
for
_
,
container
:=
range
existingPod
.
Spec
.
Containers
{
cpu
,
memory
:=
to
NonzeroLimits
(
&
container
.
Resources
.
Limits
)
cpu
,
memory
:=
get
NonzeroLimits
(
&
container
.
Resources
.
Limits
)
totalMilliCPU
+=
cpu
totalMilliCPU
+=
cpu
totalMemory
+=
memory
totalMemory
+=
memory
}
}
...
@@ -87,7 +87,7 @@ func calculateResourceOccupancy(pod *api.Pod, node api.Node, pods []*api.Pod) al
...
@@ -87,7 +87,7 @@ func calculateResourceOccupancy(pod *api.Pod, node api.Node, pods []*api.Pod) al
// Add the resources requested by the current pod being scheduled.
// Add the resources requested by the current pod being scheduled.
// This also helps differentiate between differently sized, but empty, minions.
// This also helps differentiate between differently sized, but empty, minions.
for
_
,
container
:=
range
pod
.
Spec
.
Containers
{
for
_
,
container
:=
range
pod
.
Spec
.
Containers
{
cpu
,
memory
:=
to
NonzeroLimits
(
&
container
.
Resources
.
Limits
)
cpu
,
memory
:=
get
NonzeroLimits
(
&
container
.
Resources
.
Limits
)
totalMilliCPU
+=
cpu
totalMilliCPU
+=
cpu
totalMemory
+=
memory
totalMemory
+=
memory
}
}
...
@@ -195,7 +195,7 @@ func calculateBalancedResourceAllocation(pod *api.Pod, node api.Node, pods []*ap
...
@@ -195,7 +195,7 @@ func calculateBalancedResourceAllocation(pod *api.Pod, node api.Node, pods []*ap
score
:=
int
(
0
)
score
:=
int
(
0
)
for
_
,
existingPod
:=
range
pods
{
for
_
,
existingPod
:=
range
pods
{
for
_
,
container
:=
range
existingPod
.
Spec
.
Containers
{
for
_
,
container
:=
range
existingPod
.
Spec
.
Containers
{
cpu
,
memory
:=
to
NonzeroLimits
(
&
container
.
Resources
.
Limits
)
cpu
,
memory
:=
get
NonzeroLimits
(
&
container
.
Resources
.
Limits
)
totalMilliCPU
+=
cpu
totalMilliCPU
+=
cpu
totalMemory
+=
memory
totalMemory
+=
memory
}
}
...
@@ -203,7 +203,7 @@ func calculateBalancedResourceAllocation(pod *api.Pod, node api.Node, pods []*ap
...
@@ -203,7 +203,7 @@ func calculateBalancedResourceAllocation(pod *api.Pod, node api.Node, pods []*ap
// Add the resources requested by the current pod being scheduled.
// Add the resources requested by the current pod being scheduled.
// This also helps differentiate between differently sized, but empty, minions.
// This also helps differentiate between differently sized, but empty, minions.
for
_
,
container
:=
range
pod
.
Spec
.
Containers
{
for
_
,
container
:=
range
pod
.
Spec
.
Containers
{
cpu
,
memory
:=
to
NonzeroLimits
(
&
container
.
Resources
.
Limits
)
cpu
,
memory
:=
get
NonzeroLimits
(
&
container
.
Resources
.
Limits
)
totalMilliCPU
+=
cpu
totalMilliCPU
+=
cpu
totalMemory
+=
memory
totalMemory
+=
memory
}
}
...
...
plugin/pkg/scheduler/algorithm/priorities/service_spreading.go
View file @
9fbccb4f
...
@@ -84,7 +84,7 @@ func (s *ServiceSpread) CalculateSpreadPriority(pod *api.Pod, podLister algorith
...
@@ -84,7 +84,7 @@ func (s *ServiceSpread) CalculateSpreadPriority(pod *api.Pod, podLister algorith
}
}
result
=
append
(
result
,
algorithm
.
HostPriority
{
Host
:
minion
.
Name
,
Score
:
int
(
fScore
)})
result
=
append
(
result
,
algorithm
.
HostPriority
{
Host
:
minion
.
Name
,
Score
:
int
(
fScore
)})
glog
.
V
(
10
)
.
Infof
(
glog
.
V
(
10
)
.
Infof
(
"%v -> %v: ServiceSpreadPriority, Sore: (%d)"
,
pod
.
Name
,
minion
.
Name
,
int
(
fScore
),
"%v -> %v: ServiceSpreadPriority, S
c
ore: (%d)"
,
pod
.
Name
,
minion
.
Name
,
int
(
fScore
),
)
)
}
}
return
result
,
nil
return
result
,
nil
...
...
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