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
4d44ab57
Commit
4d44ab57
authored
Sep 24, 2015
by
Jerzy Szczepkowski
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14486 from jszczepkowski/hpa-tune
E2E tests for horizontal pod autoscaler.
parents
70d94fac
c8238c07
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
14 additions
and
18 deletions
+14
-18
config-test.sh
cluster/gce/config-test.sh
+2
-0
controllermanager.go
cmd/kube-controller-manager/app/controllermanager.go
+1
-1
e2e.sh
hack/jenkins/e2e.sh
+2
-0
horizontal.go
pkg/controller/podautoscaler/horizontal.go
+2
-5
metrics_client.go
pkg/controller/podautoscaler/metrics/metrics_client.go
+2
-2
autoscaling_utils.go
test/e2e/autoscaling_utils.go
+2
-0
horizontal_pod_autoscaling.go
test/e2e/horizontal_pod_autoscaling.go
+3
-10
No files found.
cluster/gce/config-test.sh
View file @
4d44ab57
...
@@ -56,6 +56,8 @@ SERVICE_CLUSTER_IP_RANGE="10.0.0.0/16" # formerly PORTAL_NET
...
@@ -56,6 +56,8 @@ SERVICE_CLUSTER_IP_RANGE="10.0.0.0/16" # formerly PORTAL_NET
# none - No cluster monitoring setup
# none - No cluster monitoring setup
# influxdb - Heapster, InfluxDB, and Grafana
# influxdb - Heapster, InfluxDB, and Grafana
# google - Heapster, Google Cloud Monitoring, and Google Cloud Logging
# google - Heapster, Google Cloud Monitoring, and Google Cloud Logging
# googleinfluxdb - Enable influxdb and google (except GCM)
# standalone - Heapster only. Metrics available via Heapster REST API.
ENABLE_CLUSTER_MONITORING
=
"
${
KUBE_ENABLE_CLUSTER_MONITORING
:-
influxdb
}
"
ENABLE_CLUSTER_MONITORING
=
"
${
KUBE_ENABLE_CLUSTER_MONITORING
:-
influxdb
}
"
TEST_CLUSTER_LOG_LEVEL
=
"
${
TEST_CLUSTER_LOG_LEVEL
:-
--v=4
}
"
TEST_CLUSTER_LOG_LEVEL
=
"
${
TEST_CLUSTER_LOG_LEVEL
:-
--v=4
}
"
...
...
cmd/kube-controller-manager/app/controllermanager.go
View file @
4d44ab57
...
@@ -112,7 +112,7 @@ func NewCMServer() *CMServer {
...
@@ -112,7 +112,7 @@ func NewCMServer() *CMServer {
ResourceQuotaSyncPeriod
:
10
*
time
.
Second
,
ResourceQuotaSyncPeriod
:
10
*
time
.
Second
,
NamespaceSyncPeriod
:
5
*
time
.
Minute
,
NamespaceSyncPeriod
:
5
*
time
.
Minute
,
PVClaimBinderSyncPeriod
:
10
*
time
.
Second
,
PVClaimBinderSyncPeriod
:
10
*
time
.
Second
,
HorizontalPodAutoscalerSyncPeriod
:
1
*
time
.
Minute
,
HorizontalPodAutoscalerSyncPeriod
:
30
*
time
.
Second
,
DeploymentControllerSyncPeriod
:
1
*
time
.
Minute
,
DeploymentControllerSyncPeriod
:
1
*
time
.
Minute
,
RegisterRetryCount
:
10
,
RegisterRetryCount
:
10
,
PodEvictionTimeout
:
5
*
time
.
Minute
,
PodEvictionTimeout
:
5
*
time
.
Minute
,
...
...
hack/jenkins/e2e.sh
View file @
4d44ab57
...
@@ -218,6 +218,7 @@ case ${JOB_NAME} in
...
@@ -218,6 +218,7 @@ case ${JOB_NAME} in
:
${
PROJECT
:
=
"k8s-jnks-e2e-gce-autoscaling"
}
:
${
PROJECT
:
=
"k8s-jnks-e2e-gce-autoscaling"
}
# Override GCE default for cluster size autoscaling purposes.
# Override GCE default for cluster size autoscaling purposes.
ENABLE_CLUSTER_MONITORING
=
"googleinfluxdb"
ENABLE_CLUSTER_MONITORING
=
"googleinfluxdb"
ENABLE_HORIZONTAL_POD_AUTOSCALER
=
"true"
;;
;;
# Runs the flaky tests on GCE, sequentially.
# Runs the flaky tests on GCE, sequentially.
...
@@ -522,6 +523,7 @@ fi
...
@@ -522,6 +523,7 @@ fi
# Shared cluster variables
# Shared cluster variables
export
E2E_MIN_STARTUP_PODS
=
${
E2E_MIN_STARTUP_PODS
:-}
export
E2E_MIN_STARTUP_PODS
=
${
E2E_MIN_STARTUP_PODS
:-}
export
KUBE_ENABLE_CLUSTER_MONITORING
=
${
ENABLE_CLUSTER_MONITORING
:-}
export
KUBE_ENABLE_CLUSTER_MONITORING
=
${
ENABLE_CLUSTER_MONITORING
:-}
export
KUBE_ENABLE_HORIZONTAL_POD_AUTOSCALER
=
${
ENABLE_HORIZONTAL_POD_AUTOSCALER
:-}
export
MASTER_SIZE
=
${
MASTER_SIZE
:-}
export
MASTER_SIZE
=
${
MASTER_SIZE
:-}
export
MINION_SIZE
=
${
MINION_SIZE
:-}
export
MINION_SIZE
=
${
MINION_SIZE
:-}
export
NUM_MINIONS
=
${
NUM_MINIONS
:-}
export
NUM_MINIONS
=
${
NUM_MINIONS
:-}
...
...
pkg/controller/podautoscaler/horizontal.go
View file @
4d44ab57
...
@@ -34,9 +34,6 @@ import (
...
@@ -34,9 +34,6 @@ import (
)
)
const
(
const
(
heapsterNamespace
=
"kube-system"
heapsterService
=
"monitoring-heapster"
// Usage shoud exceed the tolerance before we start downscale or upscale the pods.
// Usage shoud exceed the tolerance before we start downscale or upscale the pods.
// TODO: make it a flag or HPA spec element.
// TODO: make it a flag or HPA spec element.
tolerance
=
0.1
tolerance
=
0.1
...
@@ -48,8 +45,8 @@ type HorizontalController struct {
...
@@ -48,8 +45,8 @@ type HorizontalController struct {
eventRecorder
record
.
EventRecorder
eventRecorder
record
.
EventRecorder
}
}
var
downscaleForbiddenWindow
,
_
=
time
.
ParseDuration
(
"20m"
)
var
downscaleForbiddenWindow
=
5
*
time
.
Minute
var
upscaleForbiddenWindow
,
_
=
time
.
ParseDuration
(
"3m"
)
var
upscaleForbiddenWindow
=
3
*
time
.
Minute
func
NewHorizontalController
(
client
client
.
Interface
,
metricsClient
metrics
.
MetricsClient
)
*
HorizontalController
{
func
NewHorizontalController
(
client
client
.
Interface
,
metricsClient
metrics
.
MetricsClient
)
*
HorizontalController
{
broadcaster
:=
record
.
NewBroadcaster
()
broadcaster
:=
record
.
NewBroadcaster
()
...
...
pkg/controller/podautoscaler/metrics/metrics_client.go
View file @
4d44ab57
...
@@ -35,10 +35,10 @@ import (
...
@@ -35,10 +35,10 @@ import (
const
(
const
(
heapsterNamespace
=
"kube-system"
heapsterNamespace
=
"kube-system"
heapsterService
=
"
monitoring-
heapster"
heapsterService
=
"heapster"
)
)
var
heapsterQueryStart
,
_
=
time
.
ParseDuration
(
"-5m"
)
var
heapsterQueryStart
=
-
5
*
time
.
Minute
// An interface for getting metrics for pods.
// An interface for getting metrics for pods.
type
MetricsClient
interface
{
type
MetricsClient
interface
{
...
...
test/e2e/autoscaling_utils.go
View file @
4d44ab57
...
@@ -227,6 +227,8 @@ func (rc *ResourceConsumer) WaitForReplicas(desiredReplicas int) {
...
@@ -227,6 +227,8 @@ func (rc *ResourceConsumer) WaitForReplicas(desiredReplicas int) {
func
(
rc
*
ResourceConsumer
)
CleanUp
()
{
func
(
rc
*
ResourceConsumer
)
CleanUp
()
{
rc
.
stopCPU
<-
0
rc
.
stopCPU
<-
0
rc
.
stopMem
<-
0
rc
.
stopMem
<-
0
// Wait some time to ensure all child goroutines are finished.
time
.
Sleep
(
10
*
time
.
Second
)
expectNoError
(
DeleteRC
(
rc
.
framework
.
Client
,
rc
.
framework
.
Namespace
.
Name
,
rc
.
name
))
expectNoError
(
DeleteRC
(
rc
.
framework
.
Client
,
rc
.
framework
.
Namespace
.
Name
,
rc
.
name
))
expectNoError
(
rc
.
framework
.
Client
.
Services
(
rc
.
framework
.
Namespace
.
Name
)
.
Delete
(
rc
.
name
))
expectNoError
(
rc
.
framework
.
Client
.
Services
(
rc
.
framework
.
Namespace
.
Name
)
.
Delete
(
rc
.
name
))
}
}
...
...
test/e2e/horizontal_pod_autoscaling.go
View file @
4d44ab57
...
@@ -33,15 +33,8 @@ var _ = Describe("Horizontal pod autoscaling", func() {
...
@@ -33,15 +33,8 @@ var _ = Describe("Horizontal pod autoscaling", func() {
var
rc
*
ResourceConsumer
var
rc
*
ResourceConsumer
f
:=
NewFramework
(
"horizontal-pod-autoscaling"
)
f
:=
NewFramework
(
"horizontal-pod-autoscaling"
)
BeforeEach
(
func
()
{
Skip
(
"Skipped Horizontal pod autoscaling test"
)
})
AfterEach
(
func
()
{
})
// CPU tests
// CPU tests
It
(
"[Skipped][
Horizontal pod autoscaling S
uite] should scale from 1 pod to 3 pods (scale resource: CPU)"
,
func
()
{
It
(
"[Skipped][
Autoscaling s
uite] should scale from 1 pod to 3 pods (scale resource: CPU)"
,
func
()
{
rc
=
NewDynamicResourceConsumer
(
"rc"
,
1
,
700
,
0
,
800
,
100
,
f
)
rc
=
NewDynamicResourceConsumer
(
"rc"
,
1
,
700
,
0
,
800
,
100
,
f
)
createCPUHorizontalPodAutoscaler
(
rc
,
"0.3"
)
createCPUHorizontalPodAutoscaler
(
rc
,
"0.3"
)
rc
.
WaitForReplicas
(
3
)
rc
.
WaitForReplicas
(
3
)
...
@@ -72,7 +65,7 @@ var _ = Describe("Horizontal pod autoscaling", func() {
...
@@ -72,7 +65,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
()
{
It
(
"[Skipped][Horizontal pod autoscaling Suite] should scale from 1 pod to 3 pods and from 3 to 5 (scale resource: CPU)"
,
func
()
{
rc
=
NewDynamicResourceConsumer
(
"rc"
,
1
,
30
0
,
0
,
400
,
100
,
f
)
rc
=
NewDynamicResourceConsumer
(
"rc"
,
1
,
25
0
,
0
,
400
,
100
,
f
)
createCPUHorizontalPodAutoscaler
(
rc
,
"0.1"
)
createCPUHorizontalPodAutoscaler
(
rc
,
"0.1"
)
rc
.
WaitForReplicas
(
3
)
rc
.
WaitForReplicas
(
3
)
rc
.
ConsumeCPU
(
700
)
rc
.
ConsumeCPU
(
700
)
...
@@ -146,7 +139,7 @@ var _ = Describe("Horizontal pod autoscaling", func() {
...
@@ -146,7 +139,7 @@ var _ = Describe("Horizontal pod autoscaling", func() {
rc
.
WaitForReplicas
(
3
)
rc
.
WaitForReplicas
(
3
)
rc
.
CleanUp
()
rc
.
CleanUp
()
})
})
It
(
"[Skipped][
Horizontal pod autoscaling S
uite] should scale from 5 pods to 3 pods and from 3 to 1 (scale resource: Memory)"
,
func
()
{
It
(
"[Skipped][
Autoscaling s
uite] should scale from 5 pods to 3 pods and from 3 to 1 (scale resource: Memory)"
,
func
()
{
rc
=
NewDynamicResourceConsumer
(
"rc"
,
5
,
0
,
700
,
100
,
800
,
f
)
rc
=
NewDynamicResourceConsumer
(
"rc"
,
5
,
0
,
700
,
100
,
800
,
f
)
createMemoryHorizontalPodAutoscaler
(
rc
,
"300"
)
createMemoryHorizontalPodAutoscaler
(
rc
,
"300"
)
rc
.
WaitForReplicas
(
3
)
rc
.
WaitForReplicas
(
3
)
...
...
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