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
997186d1
Commit
997186d1
authored
Sep 17, 2015
by
Ewa Socala
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CPU & Memory Limit added to RCConfig in autoscaling_utils.go
parent
e3ecb748
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
19 deletions
+21
-19
autoscaling_utils.go
test/e2e/autoscaling_utils.go
+7
-4
horizontal_pod_autoscaling.go
test/e2e/horizontal_pod_autoscaling.go
+14
-15
No files found.
test/e2e/autoscaling_utils.go
View file @
997186d1
...
...
@@ -60,9 +60,11 @@ type ResourceConsumer struct {
NewResourceConsumer creates new ResourceConsumer
initCPU argument is in millicores
initMemory argument is in megabytes
memLimit argument is in megabytes, memLimit is a maximum amount of memory that can be consumed by a single pod
cpuLimit argument is in millicores, cpuLimit is a maximum amount of cpu that can be consumed by a single pod
*/
func
NewResourceConsumer
(
name
string
,
replicas
,
initCPU
,
initMemory
int
,
framework
*
Framework
)
*
ResourceConsumer
{
runServiceAndRCForResourceConsumer
(
framework
.
Client
,
framework
.
Namespace
.
Name
,
name
,
replicas
)
func
NewResourceConsumer
(
name
string
,
replicas
,
initCPU
,
initMemory
int
,
cpuLimit
,
memLimit
int64
,
framework
*
Framework
)
*
ResourceConsumer
{
runServiceAndRCForResourceConsumer
(
framework
.
Client
,
framework
.
Namespace
.
Name
,
name
,
replicas
,
cpuLimit
,
memLimit
)
rc
:=
&
ResourceConsumer
{
name
:
name
,
framework
:
framework
,
...
...
@@ -204,7 +206,7 @@ func (rc *ResourceConsumer) CleanUp() {
expectNoError
(
rc
.
framework
.
Client
.
Experimental
()
.
HorizontalPodAutoscalers
(
rc
.
framework
.
Namespace
.
Name
)
.
Delete
(
rc
.
name
,
api
.
NewDeleteOptions
(
0
)))
}
func
runServiceAndRCForResourceConsumer
(
c
*
client
.
Client
,
ns
,
name
string
,
replicas
int
)
{
func
runServiceAndRCForResourceConsumer
(
c
*
client
.
Client
,
ns
,
name
string
,
replicas
int
,
cpuLimitMillis
,
memLimitMb
int64
)
{
_
,
err
:=
c
.
Services
(
ns
)
.
Create
(
&
api
.
Service
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
name
,
...
...
@@ -228,7 +230,8 @@ func runServiceAndRCForResourceConsumer(c *client.Client, ns, name string, repli
Namespace
:
ns
,
Timeout
:
timeoutRC
,
Replicas
:
replicas
,
CpuLimit
:
cpuLimitMillis
,
MemLimit
:
memLimitMb
*
1024
*
1024
,
// MemLimit is in bytes
}
expectNoError
(
RunRC
(
config
))
}
test/e2e/horizontal_pod_autoscaling.go
View file @
997186d1
...
...
@@ -42,28 +42,28 @@ var _ = Describe("Horizontal pod autoscaling", func() {
// CPU tests
It
(
"[Skipped][Horizontal pod autoscaling Suite] should scale from 1 pod to 3 pods (scale resource: CPU)"
,
func
()
{
rc
=
NewResourceConsumer
(
"rc"
,
1
,
700
,
0
,
f
)
rc
=
NewResourceConsumer
(
"rc"
,
1
,
700
,
0
,
800
,
100
,
f
)
createCPUHorizontalPodAutoscaler
(
rc
,
"0.3"
)
rc
.
WaitForReplicas
(
3
)
rc
.
CleanUp
()
})
It
(
"[Skipped][Horizontal pod autoscaling Suite] should scale from 3 pods to 1 pod (scale resource: CPU)"
,
func
()
{
rc
=
NewResourceConsumer
(
"rc"
,
3
,
0
,
0
,
f
)
rc
=
NewResourceConsumer
(
"rc"
,
3
,
0
,
0
,
100
,
100
,
f
)
createCPUHorizontalPodAutoscaler
(
rc
,
"0.7"
)
rc
.
WaitForReplicas
(
1
)
rc
.
CleanUp
()
})
It
(
"[Skipped][Horizontal pod autoscaling Suite] should scale from 1 pod to maximum 5 pods (scale resource: CPU)"
,
func
()
{
rc
=
NewResourceConsumer
(
"rc"
,
1
,
700
,
0
,
f
)
rc
=
NewResourceConsumer
(
"rc"
,
1
,
700
,
0
,
800
,
100
,
f
)
createCPUHorizontalPodAutoscaler
(
rc
,
"0.1"
)
rc
.
WaitForReplicas
(
5
)
rc
.
CleanUp
()
})
It
(
"[Skipped][Horizontal pod autoscaling Suite] should scale from 1 pod to 3 pods and from 3 to 1 (scale resource: CPU)"
,
func
()
{
rc
=
NewResourceConsumer
(
"rc"
,
1
,
700
,
0
,
f
)
rc
=
NewResourceConsumer
(
"rc"
,
1
,
700
,
0
,
800
,
100
,
f
)
createCPUHorizontalPodAutoscaler
(
rc
,
"0.3"
)
rc
.
WaitForReplicas
(
3
)
rc
.
ConsumeCPU
(
300
)
...
...
@@ -72,7 +72,7 @@ var _ = Describe("Horizontal pod autoscaling", func() {
})
It
(
"[Skipped][Horizontal pod autoscaling Suite] should scale from 1 pod to 3 pods and from 3 to 5 (scale resource: CPU)"
,
func
()
{
rc
=
NewResourceConsumer
(
"rc"
,
1
,
300
,
0
,
f
)
rc
=
NewResourceConsumer
(
"rc"
,
1
,
300
,
0
,
400
,
100
,
f
)
createCPUHorizontalPodAutoscaler
(
rc
,
"0.1"
)
rc
.
WaitForReplicas
(
3
)
rc
.
ConsumeCPU
(
700
)
...
...
@@ -81,7 +81,7 @@ var _ = Describe("Horizontal pod autoscaling", func() {
})
It
(
"[Skipped][Horizontal pod autoscaling Suite] should scale from 3 pods to 1 pod and from 1 to 3 (scale resource: CPU)"
,
func
()
{
rc
=
NewResourceConsumer
(
"rc"
,
3
,
0
,
0
,
f
)
rc
=
NewResourceConsumer
(
"rc"
,
3
,
0
,
0
,
800
,
100
,
f
)
createCPUHorizontalPodAutoscaler
(
rc
,
"0.3"
)
rc
.
WaitForReplicas
(
1
)
rc
.
ConsumeCPU
(
700
)
...
...
@@ -90,7 +90,7 @@ var _ = Describe("Horizontal pod autoscaling", func() {
})
It
(
"[Skipped][Horizontal pod autoscaling Suite] should scale from 5 pods to 3 pods and from 3 to 1 (scale resource: CPU)"
,
func
()
{
rc
=
NewResourceConsumer
(
"rc"
,
5
,
700
,
0
,
f
)
rc
=
NewResourceConsumer
(
"rc"
,
5
,
700
,
0
,
200
,
100
,
f
)
createCPUHorizontalPodAutoscaler
(
rc
,
"0.3"
)
rc
.
WaitForReplicas
(
3
)
rc
.
ConsumeCPU
(
100
)
...
...
@@ -100,28 +100,28 @@ var _ = Describe("Horizontal pod autoscaling", func() {
// Memory tests
It
(
"[Skipped][Horizontal pod autoscaling Suite] should scale from 1 pod to 3 pods (scale resource: Memory)"
,
func
()
{
rc
=
NewResourceConsumer
(
"rc"
,
1
,
0
,
800
,
f
)
rc
=
NewResourceConsumer
(
"rc"
,
1
,
0
,
800
,
100
,
900
,
f
)
createMemoryHorizontalPodAutoscaler
(
rc
,
"300"
)
rc
.
WaitForReplicas
(
3
)
rc
.
CleanUp
()
})
It
(
"[Skipped][Horizontal pod autoscaling Suite] should scale from 3 pods to 1 pod (scale resource: Memory)"
,
func
()
{
rc
=
NewResourceConsumer
(
"rc"
,
3
,
0
,
0
,
f
)
rc
=
NewResourceConsumer
(
"rc"
,
3
,
0
,
0
,
100
,
100
,
f
)
createMemoryHorizontalPodAutoscaler
(
rc
,
"700"
)
rc
.
WaitForReplicas
(
1
)
rc
.
CleanUp
()
})
It
(
"[Skipped][Horizontal pod autoscaling Suite] should scale from 1 pod to maximum 5 pods (scale resource: Memory)"
,
func
()
{
rc
=
NewResourceConsumer
(
"rc"
,
1
,
0
,
700
,
f
)
rc
=
NewResourceConsumer
(
"rc"
,
1
,
0
,
700
,
100
,
800
,
f
)
createMemoryHorizontalPodAutoscaler
(
rc
,
"100"
)
rc
.
WaitForReplicas
(
5
)
rc
.
CleanUp
()
})
It
(
"[Skipped][Horizontal pod autoscaling Suite] should scale from 1 pod to 3 pods and from 3 to 1 (scale resource: Memory)"
,
func
()
{
rc
=
NewResourceConsumer
(
"rc"
,
1
,
0
,
700
,
f
)
rc
=
NewResourceConsumer
(
"rc"
,
1
,
0
,
700
,
100
,
800
,
f
)
createMemoryHorizontalPodAutoscaler
(
rc
,
"300"
)
rc
.
WaitForReplicas
(
3
)
rc
.
ConsumeMem
(
100
)
...
...
@@ -130,7 +130,7 @@ var _ = Describe("Horizontal pod autoscaling", func() {
})
It
(
"[Skipped][Horizontal pod autoscaling Suite] should scale from 1 pod to 3 pods and from 3 to 5 (scale resource: Memory)"
,
func
()
{
rc
=
NewResourceConsumer
(
"rc"
,
1
,
0
,
500
,
f
)
rc
=
NewResourceConsumer
(
"rc"
,
1
,
0
,
500
,
100
,
1100
,
f
)
createMemoryHorizontalPodAutoscaler
(
rc
,
"200"
)
rc
.
WaitForReplicas
(
3
)
rc
.
ConsumeMem
(
1000
)
...
...
@@ -139,16 +139,15 @@ var _ = Describe("Horizontal pod autoscaling", func() {
})
It
(
"[Skipped][Horizontal pod autoscaling Suite] should scale from 3 pods to 1 pod and from 1 to 3 (scale resource: Memory)"
,
func
()
{
rc
=
NewResourceConsumer
(
"rc"
,
3
,
0
,
0
,
f
)
rc
=
NewResourceConsumer
(
"rc"
,
3
,
0
,
0
,
100
,
800
,
f
)
createMemoryHorizontalPodAutoscaler
(
rc
,
"300"
)
rc
.
WaitForReplicas
(
1
)
rc
.
ConsumeMem
(
700
)
rc
.
WaitForReplicas
(
3
)
rc
.
CleanUp
()
})
It
(
"[Skipped][Horizontal pod autoscaling Suite] should scale from 5 pods to 3 pods and from 3 to 1 (scale resource: Memory)"
,
func
()
{
rc
=
NewResourceConsumer
(
"rc"
,
5
,
0
,
700
,
f
)
rc
=
NewResourceConsumer
(
"rc"
,
5
,
0
,
700
,
100
,
800
,
f
)
createMemoryHorizontalPodAutoscaler
(
rc
,
"300"
)
rc
.
WaitForReplicas
(
3
)
rc
.
ConsumeMem
(
100
)
...
...
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