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
29a32307
Commit
29a32307
authored
Aug 07, 2018
by
Maciej Pytel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow setting tolerations in test framework
parent
6bea053e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
+13
-5
cluster_size_autoscaling.go
test/e2e/autoscaling/cluster_size_autoscaling.go
+6
-5
runners.go
test/utils/runners.go
+7
-0
No files found.
test/e2e/autoscaling/cluster_size_autoscaling.go
View file @
29a32307
...
...
@@ -1277,7 +1277,7 @@ func doPut(url, content string) (string, error) {
return
strBody
,
nil
}
func
reserveMemory
(
f
*
framework
.
Framework
,
id
string
,
replicas
,
megabytes
int
,
expectRunning
bool
,
timeout
time
.
Duration
,
selector
map
[
string
]
string
,
priorityClassName
string
)
func
()
error
{
func
reserveMemory
(
f
*
framework
.
Framework
,
id
string
,
replicas
,
megabytes
int
,
expectRunning
bool
,
timeout
time
.
Duration
,
selector
map
[
string
]
string
,
tolerations
[]
v1
.
Toleration
,
priorityClassName
string
)
func
()
error
{
By
(
fmt
.
Sprintf
(
"Running RC which reserves %v MB of memory"
,
megabytes
))
request
:=
int64
(
1024
*
1024
*
megabytes
/
replicas
)
config
:=
&
testutils
.
RCConfig
{
...
...
@@ -1290,6 +1290,7 @@ func reserveMemory(f *framework.Framework, id string, replicas, megabytes int, e
Replicas
:
replicas
,
MemRequest
:
request
,
NodeSelector
:
selector
,
Tolerations
:
tolerations
,
PriorityClassName
:
priorityClassName
,
}
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
rcCreationRetryTimeout
;
time
.
Sleep
(
rcCreationRetryDelay
)
{
...
...
@@ -1312,19 +1313,19 @@ func reserveMemory(f *framework.Framework, id string, replicas, megabytes int, e
// ReserveMemoryWithPriority creates a replication controller with pods with priority that, in summation,
// request the specified amount of memory.
func
ReserveMemoryWithPriority
(
f
*
framework
.
Framework
,
id
string
,
replicas
,
megabytes
int
,
expectRunning
bool
,
timeout
time
.
Duration
,
priorityClassName
string
)
func
()
error
{
return
reserveMemory
(
f
,
id
,
replicas
,
megabytes
,
expectRunning
,
timeout
,
nil
,
priorityClassName
)
return
reserveMemory
(
f
,
id
,
replicas
,
megabytes
,
expectRunning
,
timeout
,
nil
,
nil
,
priorityClassName
)
}
// ReserveMemoryWithSelector creates a replication controller with pods with node selector that, in summation,
// request the specified amount of memory.
func
ReserveMemoryWithSelector
(
f
*
framework
.
Framework
,
id
string
,
replicas
,
megabytes
int
,
expectRunning
bool
,
timeout
time
.
Duration
,
selector
map
[
string
]
string
)
func
()
error
{
return
reserveMemory
(
f
,
id
,
replicas
,
megabytes
,
expectRunning
,
timeout
,
selector
,
""
)
func
ReserveMemoryWithSelector
AndTolerations
(
f
*
framework
.
Framework
,
id
string
,
replicas
,
megabytes
int
,
expectRunning
bool
,
timeout
time
.
Duration
,
selector
map
[
string
]
string
,
tolerations
[]
v1
.
Toleration
)
func
()
error
{
return
reserveMemory
(
f
,
id
,
replicas
,
megabytes
,
expectRunning
,
timeout
,
selector
,
tolerations
,
""
)
}
// ReserveMemory creates a replication controller with pods that, in summation,
// request the specified amount of memory.
func
ReserveMemory
(
f
*
framework
.
Framework
,
id
string
,
replicas
,
megabytes
int
,
expectRunning
bool
,
timeout
time
.
Duration
)
func
()
error
{
return
reserveMemory
(
f
,
id
,
replicas
,
megabytes
,
expectRunning
,
timeout
,
nil
,
""
)
return
reserveMemory
(
f
,
id
,
replicas
,
megabytes
,
expectRunning
,
timeout
,
nil
,
nil
,
""
)
}
// WaitForClusterSizeFunc waits until the cluster size matches the given function.
...
...
test/utils/runners.go
View file @
29a32307
...
...
@@ -139,6 +139,9 @@ type RCConfig struct {
// Node selector for pods in the RC.
NodeSelector
map
[
string
]
string
// Tolerations for pods in the RC.
Tolerations
[]
v1
.
Toleration
// Ports to declare in the container (map of name to containerPort).
Ports
map
[
string
]
int
// Ports to declare in the container as host and container ports.
...
...
@@ -563,6 +566,7 @@ func (config *RCConfig) create() error {
},
DNSPolicy
:
*
config
.
DNSPolicy
,
NodeSelector
:
config
.
NodeSelector
,
Tolerations
:
config
.
Tolerations
,
TerminationGracePeriodSeconds
:
&
one
,
PriorityClassName
:
config
.
PriorityClassName
,
},
...
...
@@ -604,6 +608,9 @@ func (config *RCConfig) applyTo(template *v1.PodTemplateSpec) {
template
.
Spec
.
NodeSelector
[
k
]
=
v
}
}
if
config
.
Tolerations
!=
nil
{
template
.
Spec
.
Tolerations
=
append
([]
v1
.
Toleration
{},
config
.
Tolerations
...
)
}
if
config
.
Ports
!=
nil
{
for
k
,
v
:=
range
config
.
Ports
{
c
:=
&
template
.
Spec
.
Containers
[
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