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
e718cf5d
Commit
e718cf5d
authored
Jul 07, 2015
by
Yu-Ju Hong
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10857 from davidopp/somebranch
Increase zero-limit pod RAM for spreading to 200 MB to match cluster
parents
daafc5be
bdf22e31
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 @
e718cf5d
...
@@ -46,9 +46,10 @@ func calculateScore(requested int64, capacity int64, node string) int {
...
@@ -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
// 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,
// 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
// and that when scheduling regular pods, such pods will not see zero-limit pods as
// consuming no resources whatsoever.
// consuming no resources whatsoever. We chose these values to be similar to the
const
defaultMilliCpuLimit
int64
=
100
// 0.1 core
// resources that we give to cluster addon pods (#10653). But they are pretty arbitrary.
const
defaultMemoryLimit
int64
=
60
*
1024
*
1024
// 60 MB
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"
// 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
...
...
plugin/pkg/scheduler/algorithm/priorities/priorities_test.go
View file @
e718cf5d
...
@@ -91,12 +91,11 @@ func TestZeroLimit(t *testing.T) {
...
@@ -91,12 +91,11 @@ func TestZeroLimit(t *testing.T) {
nodes
[]
api
.
Node
nodes
[]
api
.
Node
test
string
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
// 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.
// and when the zero-limit pod is the one being scheduled.
{
{
pod
:
&
api
.
Pod
{
Spec
:
noResources
},
pod
:
&
api
.
Pod
{
Spec
:
noResources
},
// match current f1-micro on GCE
nodes
:
[]
api
.
Node
{
makeMinion
(
"machine1"
,
1000
,
defaultMemoryLimit
*
10
),
makeMinion
(
"machine2"
,
1000
,
defaultMemoryLimit
*
10
)},
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"
,
test
:
"test priority of zero-limit pod with machine with zero-limit pod"
,
pods
:
[]
*
api
.
Pod
{
pods
:
[]
*
api
.
Pod
{
...
@@ -105,8 +104,7 @@ func TestZeroLimit(t *testing.T) {
...
@@ -105,8 +104,7 @@ func TestZeroLimit(t *testing.T) {
},
},
},
},
{
{
pod
:
&
api
.
Pod
{
Spec
:
small
},
pod
:
&
api
.
Pod
{
Spec
:
small
},
// match current f1-micro on GCE
nodes
:
[]
api
.
Node
{
makeMinion
(
"machine1"
,
1000
,
defaultMemoryLimit
*
10
),
makeMinion
(
"machine2"
,
1000
,
defaultMemoryLimit
*
10
)},
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"
,
test
:
"test priority of nonzero-limit pod with machine with zero-limit pod"
,
pods
:
[]
*
api
.
Pod
{
pods
:
[]
*
api
.
Pod
{
...
@@ -114,6 +112,16 @@ func TestZeroLimit(t *testing.T) {
...
@@ -114,6 +112,16 @@ func TestZeroLimit(t *testing.T) {
{
Spec
:
large2
},
{
Spec
:
small2
},
{
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
const
expectedPriority
int
=
25
...
@@ -130,8 +138,14 @@ func TestZeroLimit(t *testing.T) {
...
@@ -130,8 +138,14 @@ func TestZeroLimit(t *testing.T) {
t
.
Errorf
(
"unexpected error: %v"
,
err
)
t
.
Errorf
(
"unexpected error: %v"
,
err
)
}
}
for
_
,
hp
:=
range
list
{
for
_
,
hp
:=
range
list
{
if
hp
.
Score
!=
expectedPriority
{
if
test
.
test
==
"test priority of larger pod with machine with zero-limit pod"
{
t
.
Errorf
(
"%s: expected 25 for all priorities, got list %#v"
,
list
)
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