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
bdf22e31
Commit
bdf22e31
authored
Jul 07, 2015
by
David Oppenheimer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Increase zero-limit pod RAM for spreading to 200 MB to match cluster
addon pods and represent less trivial fraction of typical machine RAM (e.g. n1-standard-1).
parent
530bff31
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
10 deletions
+25
-10
priorities.go
plugin/pkg/scheduler/algorithm/priorities/priorities.go
+4
-3
priorities_test.go
plugin/pkg/scheduler/algorithm/priorities/priorities_test.go
+21
-7
No files found.
plugin/pkg/scheduler/algorithm/priorities/priorities.go
View file @
bdf22e31
...
...
@@ -46,9 +46,10 @@ func calculateScore(requested int64, capacity int64, node string) int {
// of computing priority only. This ensures that when scheduling zero-limit pods, such
// pods will not all be scheduled to the machine with the smallest in-use limit,
// and that when scheduling regular pods, such pods will not see zero-limit pods as
// consuming no resources whatsoever.
const
defaultMilliCpuLimit
int64
=
100
// 0.1 core
const
defaultMemoryLimit
int64
=
60
*
1024
*
1024
// 60 MB
// consuming no resources whatsoever. We chose these values to be similar to the
// resources that we give to cluster addon pods (#10653). But they are pretty arbitrary.
const
defaultMilliCpuLimit
int64
=
100
// 0.1 core
const
defaultMemoryLimit
int64
=
200
*
1024
*
1024
// 200 MB
// TODO: Consider setting default as a fixed fraction of machine capacity (take "capacity api.ResourceList"
// as an additional argument here) rather than using constants
...
...
plugin/pkg/scheduler/algorithm/priorities/priorities_test.go
View file @
bdf22e31
...
...
@@ -91,12 +91,11 @@ func TestZeroLimit(t *testing.T) {
nodes
[]
api
.
Node
test
string
}{
// The point of these tests is to show you get the same priority for a zero-limit pod
// The point of these
next two
tests is to show you get the same priority for a zero-limit pod
// as for a pod with the defaults limits, both when the zero-limit pod is already on the machine
// and when the zero-limit pod is the one being scheduled.
{
pod
:
&
api
.
Pod
{
Spec
:
noResources
},
// match current f1-micro on GCE
pod
:
&
api
.
Pod
{
Spec
:
noResources
},
nodes
:
[]
api
.
Node
{
makeMinion
(
"machine1"
,
1000
,
defaultMemoryLimit
*
10
),
makeMinion
(
"machine2"
,
1000
,
defaultMemoryLimit
*
10
)},
test
:
"test priority of zero-limit pod with machine with zero-limit pod"
,
pods
:
[]
*
api
.
Pod
{
...
...
@@ -105,8 +104,7 @@ func TestZeroLimit(t *testing.T) {
},
},
{
pod
:
&
api
.
Pod
{
Spec
:
small
},
// match current f1-micro on GCE
pod
:
&
api
.
Pod
{
Spec
:
small
},
nodes
:
[]
api
.
Node
{
makeMinion
(
"machine1"
,
1000
,
defaultMemoryLimit
*
10
),
makeMinion
(
"machine2"
,
1000
,
defaultMemoryLimit
*
10
)},
test
:
"test priority of nonzero-limit pod with machine with zero-limit pod"
,
pods
:
[]
*
api
.
Pod
{
...
...
@@ -114,6 +112,16 @@ func TestZeroLimit(t *testing.T) {
{
Spec
:
large2
},
{
Spec
:
small2
},
},
},
// The point of this test is to verify that we're not just getting the same score no matter what we schedule.
{
pod
:
&
api
.
Pod
{
Spec
:
large
},
nodes
:
[]
api
.
Node
{
makeMinion
(
"machine1"
,
1000
,
defaultMemoryLimit
*
10
),
makeMinion
(
"machine2"
,
1000
,
defaultMemoryLimit
*
10
)},
test
:
"test priority of larger pod with machine with zero-limit pod"
,
pods
:
[]
*
api
.
Pod
{
{
Spec
:
large1
},
{
Spec
:
noResources1
},
{
Spec
:
large2
},
{
Spec
:
small2
},
},
},
}
const
expectedPriority
int
=
25
...
...
@@ -130,8 +138,14 @@ func TestZeroLimit(t *testing.T) {
t
.
Errorf
(
"unexpected error: %v"
,
err
)
}
for
_
,
hp
:=
range
list
{
if
hp
.
Score
!=
expectedPriority
{
t
.
Errorf
(
"%s: expected 25 for all priorities, got list %#v"
,
list
)
if
test
.
test
==
"test priority of larger pod with machine with zero-limit pod"
{
if
hp
.
Score
==
expectedPriority
{
t
.
Error
(
"%s: expected non-%d for all priorities, got list %#v"
,
expectedPriority
,
list
)
}
}
else
{
if
hp
.
Score
!=
expectedPriority
{
t
.
Errorf
(
"%s: expected %d for all priorities, got list %#v"
,
expectedPriority
,
list
)
}
}
}
}
...
...
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