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
396d8b11
Commit
396d8b11
authored
Jul 16, 2017
by
Kubernetes Submit Queue
Committed by
GitHub
Jul 16, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #48280 from MaciekPytel/ca_scale_to_0_e2e_2
Automatic merge from submit-queue (batch tested with PRs 46091, 48280) Added scale-down-to-0 e2e for cluster autoscaler
parents
8ce63785
f67d143d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
0 deletions
+47
-0
BUILD
test/e2e/autoscaling/BUILD
+1
-0
cluster_size_autoscaling.go
test/e2e/autoscaling/cluster_size_autoscaling.go
+46
-0
No files found.
test/e2e/autoscaling/BUILD
View file @
396d8b11
...
...
@@ -17,6 +17,7 @@ go_library(
],
tags = ["automanaged"],
deps = [
"//pkg/api:go_default_library",
"//pkg/client/clientset_generated/clientset:go_default_library",
"//test/e2e/common:go_default_library",
"//test/e2e/framework:go_default_library",
...
...
test/e2e/autoscaling/cluster_size_autoscaling.go
View file @
396d8b11
...
...
@@ -39,6 +39,7 @@ import (
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/uuid"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
"k8s.io/kubernetes/test/e2e/framework"
"k8s.io/kubernetes/test/e2e/scheduling"
...
...
@@ -605,6 +606,51 @@ var _ = framework.KubeDescribe("Cluster size autoscaling [Slow]", func() {
framework
.
ExpectNoError
(
waitForAllCaPodsReadyInNamespace
(
f
,
c
))
})
It
(
"Should be able to scale a node group down to 0[Feature:ClusterSizeAutoscalingScaleDown]"
,
func
()
{
framework
.
SkipUnlessAtLeast
(
len
(
originalSizes
),
2
,
"At least 2 node groups are needed for scale-to-0 tests"
)
By
(
"Find smallest node group and manually scale it to a single node"
)
minMig
:=
""
minSize
:=
nodeCount
for
mig
,
size
:=
range
originalSizes
{
if
size
<=
minSize
{
minMig
=
mig
minSize
=
size
}
}
err
:=
framework
.
ResizeGroup
(
minMig
,
int32
(
1
))
framework
.
ExpectNoError
(
err
)
framework
.
ExpectNoError
(
framework
.
WaitForClusterSize
(
c
,
nodeCount
-
minSize
+
1
,
resizeTimeout
))
By
(
"Make the single node unschedulable"
)
allNodes
,
err
:=
f
.
ClientSet
.
Core
()
.
Nodes
()
.
List
(
metav1
.
ListOptions
{
FieldSelector
:
fields
.
Set
{
"spec.unschedulable"
:
"false"
,
}
.
AsSelector
()
.
String
()})
framework
.
ExpectNoError
(
err
)
ngNodes
,
err
:=
framework
.
GetGroupNodes
(
minMig
)
framework
.
ExpectNoError
(
err
)
By
(
fmt
.
Sprintf
(
"Target nodes for scale-down: %s"
,
ngNodes
))
Expect
(
len
(
ngNodes
)
==
1
)
.
To
(
BeTrue
())
node
,
err
:=
f
.
ClientSet
.
Core
()
.
Nodes
()
.
Get
(
ngNodes
[
0
],
metav1
.
GetOptions
{})
framework
.
ExpectNoError
(
err
)
makeNodeUnschedulable
(
f
.
ClientSet
,
node
)
By
(
"Manually drain the single node"
)
podOpts
:=
metav1
.
ListOptions
{
FieldSelector
:
fields
.
OneTermEqualSelector
(
api
.
PodHostField
,
node
.
Name
)
.
String
()}
pods
,
err
:=
c
.
Core
()
.
Pods
(
metav1
.
NamespaceAll
)
.
List
(
podOpts
)
framework
.
ExpectNoError
(
err
)
for
_
,
pod
:=
range
pods
.
Items
{
err
=
f
.
ClientSet
.
Core
()
.
Pods
(
pod
.
Namespace
)
.
Delete
(
pod
.
Name
,
metav1
.
NewDeleteOptions
(
0
))
framework
.
ExpectNoError
(
err
)
}
By
(
"The node should be removed"
)
framework
.
ExpectNoError
(
WaitForClusterSizeFunc
(
f
.
ClientSet
,
func
(
size
int
)
bool
{
return
size
<
len
(
allNodes
.
Items
)
},
scaleDownTimeout
))
minSize
,
err
=
framework
.
GroupSize
(
minMig
)
framework
.
ExpectNoError
(
err
)
Expect
(
minSize
)
.
Should
(
Equal
(
0
))
})
It
(
"Shouldn't perform scale up operation and should list unhealthy status if most of the cluster is broken[Feature:ClusterSizeAutoscalingScaleUp]"
,
func
()
{
clusterSize
:=
nodeCount
for
clusterSize
<
unhealthyClusterThreshold
+
1
{
...
...
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