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
38f175f1
Commit
38f175f1
authored
Jun 10, 2017
by
Andrzej Wasylkowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made WaitForReplicas take a "how long to wait" parameter instead of it being hardcoded.
parent
1b0f981f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
8 deletions
+10
-8
horizontal_pod_autoscaling.go
test/e2e/autoscaling/horizontal_pod_autoscaling.go
+3
-2
autoscaling_utils.go
test/e2e/common/autoscaling_utils.go
+1
-2
stackdriver_monitoring.go
test/e2e/stackdriver_monitoring.go
+1
-1
horizontal_pod_autoscalers.go
test/e2e/upgrades/horizontal_pod_autoscalers.go
+5
-3
No files found.
test/e2e/autoscaling/horizontal_pod_autoscaling.go
View file @
38f175f1
...
@@ -114,17 +114,18 @@ type HPAScaleTest struct {
...
@@ -114,17 +114,18 @@ type HPAScaleTest struct {
// The second state change (optional) is due to the CPU burst parameter, which HPA again responds to.
// The second state change (optional) is due to the CPU burst parameter, which HPA again responds to.
// TODO The use of 3 states is arbitrary, we could eventually make this test handle "n" states once this test stabilizes.
// TODO The use of 3 states is arbitrary, we could eventually make this test handle "n" states once this test stabilizes.
func
(
scaleTest
*
HPAScaleTest
)
run
(
name
,
kind
string
,
rc
*
common
.
ResourceConsumer
,
f
*
framework
.
Framework
)
{
func
(
scaleTest
*
HPAScaleTest
)
run
(
name
,
kind
string
,
rc
*
common
.
ResourceConsumer
,
f
*
framework
.
Framework
)
{
const
timeToWait
=
15
*
time
.
Minute
rc
=
common
.
NewDynamicResourceConsumer
(
name
,
kind
,
int
(
scaleTest
.
initPods
),
int
(
scaleTest
.
totalInitialCPUUsage
),
0
,
0
,
scaleTest
.
perPodCPURequest
,
200
,
f
)
rc
=
common
.
NewDynamicResourceConsumer
(
name
,
kind
,
int
(
scaleTest
.
initPods
),
int
(
scaleTest
.
totalInitialCPUUsage
),
0
,
0
,
scaleTest
.
perPodCPURequest
,
200
,
f
)
defer
rc
.
CleanUp
()
defer
rc
.
CleanUp
()
hpa
:=
common
.
CreateCPUHorizontalPodAutoscaler
(
rc
,
scaleTest
.
targetCPUUtilizationPercent
,
scaleTest
.
minPods
,
scaleTest
.
maxPods
)
hpa
:=
common
.
CreateCPUHorizontalPodAutoscaler
(
rc
,
scaleTest
.
targetCPUUtilizationPercent
,
scaleTest
.
minPods
,
scaleTest
.
maxPods
)
defer
common
.
DeleteHorizontalPodAutoscaler
(
rc
,
hpa
.
Name
)
defer
common
.
DeleteHorizontalPodAutoscaler
(
rc
,
hpa
.
Name
)
rc
.
WaitForReplicas
(
int
(
scaleTest
.
firstScale
))
rc
.
WaitForReplicas
(
int
(
scaleTest
.
firstScale
)
,
timeToWait
)
if
scaleTest
.
firstScaleStasis
>
0
{
if
scaleTest
.
firstScaleStasis
>
0
{
rc
.
EnsureDesiredReplicas
(
int
(
scaleTest
.
firstScale
),
scaleTest
.
firstScaleStasis
)
rc
.
EnsureDesiredReplicas
(
int
(
scaleTest
.
firstScale
),
scaleTest
.
firstScaleStasis
)
}
}
if
scaleTest
.
cpuBurst
>
0
&&
scaleTest
.
secondScale
>
0
{
if
scaleTest
.
cpuBurst
>
0
&&
scaleTest
.
secondScale
>
0
{
rc
.
ConsumeCPU
(
scaleTest
.
cpuBurst
)
rc
.
ConsumeCPU
(
scaleTest
.
cpuBurst
)
rc
.
WaitForReplicas
(
int
(
scaleTest
.
secondScale
))
rc
.
WaitForReplicas
(
int
(
scaleTest
.
secondScale
)
,
timeToWait
)
}
}
}
}
...
...
test/e2e/common/autoscaling_utils.go
View file @
38f175f1
...
@@ -342,8 +342,7 @@ func (rc *ResourceConsumer) GetReplicas() int {
...
@@ -342,8 +342,7 @@ func (rc *ResourceConsumer) GetReplicas() int {
return
0
return
0
}
}
func
(
rc
*
ResourceConsumer
)
WaitForReplicas
(
desiredReplicas
int
)
{
func
(
rc
*
ResourceConsumer
)
WaitForReplicas
(
desiredReplicas
int
,
duration
time
.
Duration
)
{
duration
:=
15
*
time
.
Minute
interval
:=
20
*
time
.
Second
interval
:=
20
*
time
.
Second
err
:=
wait
.
PollImmediate
(
interval
,
duration
,
func
()
(
bool
,
error
)
{
err
:=
wait
.
PollImmediate
(
interval
,
duration
,
func
()
(
bool
,
error
)
{
replicas
:=
rc
.
GetReplicas
()
replicas
:=
rc
.
GetReplicas
()
...
...
test/e2e/stackdriver_monitoring.go
View file @
38f175f1
...
@@ -89,7 +89,7 @@ func testStackdriverMonitoring(f *framework.Framework, pods, allPodsCPU int, per
...
@@ -89,7 +89,7 @@ func testStackdriverMonitoring(f *framework.Framework, pods, allPodsCPU int, per
rc
:=
common
.
NewDynamicResourceConsumer
(
rcName
,
common
.
KindDeployment
,
pods
,
allPodsCPU
,
memoryUsed
,
0
,
perPodCPU
,
memoryLimit
,
f
)
rc
:=
common
.
NewDynamicResourceConsumer
(
rcName
,
common
.
KindDeployment
,
pods
,
allPodsCPU
,
memoryUsed
,
0
,
perPodCPU
,
memoryLimit
,
f
)
defer
rc
.
CleanUp
()
defer
rc
.
CleanUp
()
rc
.
WaitForReplicas
(
pods
)
rc
.
WaitForReplicas
(
pods
,
15
*
time
.
Minute
)
metricsMap
:=
map
[
string
]
bool
{}
metricsMap
:=
map
[
string
]
bool
{}
pollingFunction
:=
checkForMetrics
(
projectId
,
gcmService
,
time
.
Now
(),
metricsMap
,
allPodsCPU
,
perPodCPU
)
pollingFunction
:=
checkForMetrics
(
projectId
,
gcmService
,
time
.
Now
(),
metricsMap
,
allPodsCPU
,
perPodCPU
)
...
...
test/e2e/upgrades/horizontal_pod_autoscalers.go
View file @
38f175f1
...
@@ -18,6 +18,7 @@ package upgrades
...
@@ -18,6 +18,7 @@ package upgrades
import
(
import
(
"fmt"
"fmt"
"time"
autoscalingv1
"k8s.io/kubernetes/pkg/apis/autoscaling/v1"
autoscalingv1
"k8s.io/kubernetes/pkg/apis/autoscaling/v1"
"k8s.io/kubernetes/test/e2e/common"
"k8s.io/kubernetes/test/e2e/common"
...
@@ -72,22 +73,23 @@ func (t *HPAUpgradeTest) Teardown(f *framework.Framework) {
...
@@ -72,22 +73,23 @@ func (t *HPAUpgradeTest) Teardown(f *framework.Framework) {
}
}
func
(
t
*
HPAUpgradeTest
)
test
()
{
func
(
t
*
HPAUpgradeTest
)
test
()
{
const
timeToWait
=
15
*
time
.
Minute
t
.
rc
.
Resume
()
t
.
rc
.
Resume
()
By
(
fmt
.
Sprintf
(
"HPA scales to 1 replica: consume 10 millicores, target per pod 100 millicores, min pods 1."
))
By
(
fmt
.
Sprintf
(
"HPA scales to 1 replica: consume 10 millicores, target per pod 100 millicores, min pods 1."
))
t
.
rc
.
ConsumeCPU
(
10
)
/* millicores */
t
.
rc
.
ConsumeCPU
(
10
)
/* millicores */
By
(
fmt
.
Sprintf
(
"HPA waits for 1 replica"
))
By
(
fmt
.
Sprintf
(
"HPA waits for 1 replica"
))
t
.
rc
.
WaitForReplicas
(
1
)
t
.
rc
.
WaitForReplicas
(
1
,
timeToWait
)
By
(
fmt
.
Sprintf
(
"HPA scales to 3 replicas: consume 250 millicores, target per pod 100 millicores."
))
By
(
fmt
.
Sprintf
(
"HPA scales to 3 replicas: consume 250 millicores, target per pod 100 millicores."
))
t
.
rc
.
ConsumeCPU
(
250
)
/* millicores */
t
.
rc
.
ConsumeCPU
(
250
)
/* millicores */
By
(
fmt
.
Sprintf
(
"HPA waits for 3 replicas"
))
By
(
fmt
.
Sprintf
(
"HPA waits for 3 replicas"
))
t
.
rc
.
WaitForReplicas
(
3
)
t
.
rc
.
WaitForReplicas
(
3
,
timeToWait
)
By
(
fmt
.
Sprintf
(
"HPA scales to 5 replicas: consume 700 millicores, target per pod 100 millicores, max pods 5."
))
By
(
fmt
.
Sprintf
(
"HPA scales to 5 replicas: consume 700 millicores, target per pod 100 millicores, max pods 5."
))
t
.
rc
.
ConsumeCPU
(
700
)
/* millicores */
t
.
rc
.
ConsumeCPU
(
700
)
/* millicores */
By
(
fmt
.
Sprintf
(
"HPA waits for 5 replicas"
))
By
(
fmt
.
Sprintf
(
"HPA waits for 5 replicas"
))
t
.
rc
.
WaitForReplicas
(
5
)
t
.
rc
.
WaitForReplicas
(
5
,
timeToWait
)
// We need to pause background goroutines as during upgrade master is unavailable and requests issued by them fail.
// We need to pause background goroutines as during upgrade master is unavailable and requests issued by them fail.
t
.
rc
.
Pause
()
t
.
rc
.
Pause
()
...
...
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