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
abb5e6e7
Commit
abb5e6e7
authored
Jun 02, 2017
by
Andrzej Wasylkowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made tests that create Horizontal Pod Autoscaler delete it after they are done.
parent
c13d8917
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
5 deletions
+15
-5
horizontal_pod_autoscaling.go
test/e2e/autoscaling/horizontal_pod_autoscaling.go
+2
-1
autoscaling_utils.go
test/e2e/common/autoscaling_utils.go
+7
-2
BUILD
test/e2e/upgrades/BUILD
+1
-0
horizontal_pod_autoscalers.go
test/e2e/upgrades/horizontal_pod_autoscalers.go
+5
-2
No files found.
test/e2e/autoscaling/horizontal_pod_autoscaling.go
View file @
abb5e6e7
...
...
@@ -116,7 +116,8 @@ type HPAScaleTest struct {
func
(
scaleTest
*
HPAScaleTest
)
run
(
name
,
kind
string
,
rc
*
common
.
ResourceConsumer
,
f
*
framework
.
Framework
)
{
rc
=
common
.
NewDynamicResourceConsumer
(
name
,
kind
,
int
(
scaleTest
.
initPods
),
int
(
scaleTest
.
totalInitialCPUUsage
),
0
,
0
,
scaleTest
.
perPodCPURequest
,
200
,
f
)
defer
rc
.
CleanUp
()
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
)
rc
.
WaitForReplicas
(
int
(
scaleTest
.
firstScale
))
if
scaleTest
.
firstScaleStasis
>
0
{
rc
.
EnsureDesiredReplicas
(
int
(
scaleTest
.
firstScale
),
scaleTest
.
firstScaleStasis
)
...
...
test/e2e/common/autoscaling_utils.go
View file @
abb5e6e7
...
...
@@ -475,7 +475,7 @@ func runServiceAndWorkloadForResourceConsumer(c clientset.Interface, internalCli
c
,
ns
,
controllerName
,
1
,
startServiceInterval
,
startServiceTimeout
))
}
func
CreateCPUHorizontalPodAutoscaler
(
rc
*
ResourceConsumer
,
cpu
,
minReplicas
,
maxRepl
int32
)
{
func
CreateCPUHorizontalPodAutoscaler
(
rc
*
ResourceConsumer
,
cpu
,
minReplicas
,
maxRepl
int32
)
*
autoscalingv1
.
HorizontalPodAutoscaler
{
hpa
:=
&
autoscalingv1
.
HorizontalPodAutoscaler
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
rc
.
name
,
...
...
@@ -491,6 +491,11 @@ func CreateCPUHorizontalPodAutoscaler(rc *ResourceConsumer, cpu, minReplicas, ma
TargetCPUUtilizationPercentage
:
&
cpu
,
},
}
_
,
errHPA
:=
rc
.
framework
.
ClientSet
.
Autoscaling
()
.
HorizontalPodAutoscalers
(
rc
.
framework
.
Namespace
.
Name
)
.
Create
(
hpa
)
hpa
,
errHPA
:=
rc
.
framework
.
ClientSet
.
Autoscaling
()
.
HorizontalPodAutoscalers
(
rc
.
framework
.
Namespace
.
Name
)
.
Create
(
hpa
)
framework
.
ExpectNoError
(
errHPA
)
return
hpa
}
func
DeleteHorizontalPodAutoscaler
(
rc
*
ResourceConsumer
,
autoscalerName
string
)
{
rc
.
framework
.
ClientSet
.
Autoscaling
()
.
HorizontalPodAutoscalers
(
rc
.
framework
.
Namespace
.
Name
)
.
Delete
(
autoscalerName
,
nil
)
}
test/e2e/upgrades/BUILD
View file @
abb5e6e7
...
...
@@ -29,6 +29,7 @@ go_library(
"//pkg/api/v1:go_default_library",
"//pkg/api/v1/helper:go_default_library",
"//pkg/apis/apps/v1beta1:go_default_library",
"//pkg/apis/autoscaling/v1:go_default_library",
"//pkg/apis/batch/v1:go_default_library",
"//pkg/apis/extensions/v1beta1:go_default_library",
"//pkg/controller:go_default_library",
...
...
test/e2e/upgrades/horizontal_pod_autoscalers.go
View file @
abb5e6e7
...
...
@@ -19,6 +19,7 @@ package upgrades
import
(
"fmt"
autoscalingv1
"k8s.io/kubernetes/pkg/apis/autoscaling/v1"
"k8s.io/kubernetes/test/e2e/common"
"k8s.io/kubernetes/test/e2e/framework"
...
...
@@ -27,7 +28,8 @@ import (
// HPAUpgradeTest tests that HPA rescales target resource correctly before and after a cluster upgrade.
type
HPAUpgradeTest
struct
{
rc
*
common
.
ResourceConsumer
rc
*
common
.
ResourceConsumer
hpa
*
autoscalingv1
.
HorizontalPodAutoscaler
}
func
(
HPAUpgradeTest
)
Name
()
string
{
return
"hpa-upgrade"
}
...
...
@@ -44,7 +46,7 @@ func (t *HPAUpgradeTest) Setup(f *framework.Framework) {
500
,
/* cpuLimit */
200
,
/* memLimit */
f
)
common
.
CreateCPUHorizontalPodAutoscaler
(
t
.
hpa
=
common
.
CreateCPUHorizontalPodAutoscaler
(
t
.
rc
,
20
,
/* targetCPUUtilizationPercent */
1
,
/* minPods */
...
...
@@ -65,6 +67,7 @@ func (t *HPAUpgradeTest) Test(f *framework.Framework, done <-chan struct{}, upgr
// Teardown cleans up any remaining resources.
func
(
t
*
HPAUpgradeTest
)
Teardown
(
f
*
framework
.
Framework
)
{
// rely on the namespace deletion to clean up everything
common
.
DeleteHorizontalPodAutoscaler
(
t
.
rc
,
t
.
hpa
.
Name
)
t
.
rc
.
CleanUp
()
}
...
...
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