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
1ee66674
Commit
1ee66674
authored
Apr 12, 2017
by
Marcin Wielgus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cluster autoscaler broken nodes test fix
parent
3ef2cf8a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
12 deletions
+18
-12
cluster_size_autoscaling.go
test/e2e/autoscaling/cluster_size_autoscaling.go
+18
-12
No files found.
test/e2e/autoscaling/cluster_size_autoscaling.go
View file @
1ee66674
...
...
@@ -147,22 +147,22 @@ var _ = framework.KubeDescribe("Cluster size autoscaling [Slow]", func() {
func
(
size
int
)
bool
{
return
size
<=
nodeCount
},
time
.
Second
))
})
simpleScaleUpTest
:=
func
()
{
simpleScaleUpTest
:=
func
(
unready
int
)
{
ReserveMemory
(
f
,
"memory-reservation"
,
100
,
nodeCount
*
memCapacityMb
,
false
,
1
*
time
.
Second
)
defer
framework
.
DeleteRCAndPods
(
f
.
ClientSet
,
f
.
InternalClientset
,
f
.
Namespace
.
Name
,
"memory-reservation"
)
// Verify, that cluster size is increased
framework
.
ExpectNoError
(
WaitForClusterSizeFunc
(
f
.
ClientSet
,
func
(
size
int
)
bool
{
return
size
>=
nodeCount
+
1
},
scaleUpTimeout
))
framework
.
ExpectNoError
(
WaitForClusterSizeFunc
WithUnready
(
f
.
ClientSet
,
func
(
size
int
)
bool
{
return
size
>=
nodeCount
+
1
},
scaleUpTimeout
,
unready
))
framework
.
ExpectNoError
(
waitForAllCaPodsReadyInNamespace
(
f
,
c
))
}
It
(
"should increase cluster size if pending pods are small [Feature:ClusterSizeAutoscalingScaleUp]"
,
simpleScaleUpTest
)
func
()
{
simpleScaleUpTest
(
0
)
}
)
It
(
"should increase cluster size if pending pods are small and one node is broken [Feature:ClusterSizeAutoscalingScaleUp]"
,
func
()
{
framework
.
TestUnderTemporaryNetworkFailure
(
c
,
"default"
,
getAnyNode
(
c
),
simpleScaleUpTest
)
framework
.
TestUnderTemporaryNetworkFailure
(
c
,
"default"
,
getAnyNode
(
c
),
func
()
{
simpleScaleUpTest
(
1
)
}
)
})
It
(
"shouldn't trigger additional scale-ups during processing scale-up [Feature:ClusterSizeAutoscalingScaleUp]"
,
func
()
{
...
...
@@ -342,7 +342,7 @@ var _ = framework.KubeDescribe("Cluster size autoscaling [Slow]", func() {
framework
.
ExpectNoError
(
framework
.
WaitForClusterSize
(
c
,
nodeCount
+
2
,
scaleUpTimeout
+
5
*
time
.
Minute
))
})
simpleScaleDownTest
:=
func
()
{
simpleScaleDownTest
:=
func
(
unready
int
)
{
By
(
"Manually increase cluster size"
)
increasedSize
:=
0
newSizes
:=
make
(
map
[
string
]
int
)
...
...
@@ -352,18 +352,19 @@ var _ = framework.KubeDescribe("Cluster size autoscaling [Slow]", func() {
}
setMigSizes
(
newSizes
)
framework
.
ExpectNoError
(
WaitForClusterSizeFunc
(
f
.
ClientSet
,
func
(
size
int
)
bool
{
return
size
>=
increasedSize
},
scaleUpTimeout
))
func
(
size
int
)
bool
{
return
size
>=
increasedSize
},
scaleUpTimeout
)
,
unready
)
By
(
"Some node should be removed"
)
framework
.
ExpectNoError
(
WaitForClusterSizeFunc
(
f
.
ClientSet
,
func
(
size
int
)
bool
{
return
size
<
increasedSize
},
scaleDownTimeout
))
func
(
size
int
)
bool
{
return
size
<
increasedSize
},
scaleDownTimeout
)
,
unready
)
}
It
(
"should correctly scale down after a node is not needed [Feature:ClusterSizeAutoscalingScaleDown]"
,
simpleScaleDownTest
)
It
(
"should correctly scale down after a node is not needed [Feature:ClusterSizeAutoscalingScaleDown]"
,
func
()
{
simpleScaleDownTest
(
0
)
})
It
(
"should
increase cluster size if pending pods are small and one node is broken [Feature:ClusterSizeAutoscalingScaleUp
]"
,
It
(
"should
correctly scale down after a node is not needed and one node is broken [Feature:ClusterSizeAutoscalingScaleDown
]"
,
func
()
{
framework
.
TestUnderTemporaryNetworkFailure
(
c
,
"default"
,
getAnyNode
(
c
),
simpleScaleDownTest
)
framework
.
TestUnderTemporaryNetworkFailure
(
c
,
"default"
,
getAnyNode
(
c
),
func
()
{
simpleScaleDownTest
(
1
)
}
)
})
It
(
"should correctly scale down after a node is not needed when there is non autoscaled pool[Feature:ClusterSizeAutoscalingScaleDown]"
,
func
()
{
...
...
@@ -697,6 +698,11 @@ func ReserveMemory(f *framework.Framework, id string, replicas, megabytes int, e
// WaitForClusterSize waits until the cluster size matches the given function.
func
WaitForClusterSizeFunc
(
c
clientset
.
Interface
,
sizeFunc
func
(
int
)
bool
,
timeout
time
.
Duration
)
error
{
return
WaitForClusterSizeFuncWithUnready
(
c
,
sizeFunc
,
timeout
,
0
)
}
// WaitForClusterSizeWithUnready waits until the cluster size matches the given function and assumes some unready nodes.
func
WaitForClusterSizeFuncWithUnready
(
c
clientset
.
Interface
,
sizeFunc
func
(
int
)
bool
,
timeout
time
.
Duration
,
expectedUnready
int
)
error
{
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
timeout
;
time
.
Sleep
(
20
*
time
.
Second
)
{
nodes
,
err
:=
c
.
Core
()
.
Nodes
()
.
List
(
metav1
.
ListOptions
{
FieldSelector
:
fields
.
Set
{
"spec.unschedulable"
:
"false"
,
...
...
@@ -713,7 +719,7 @@ func WaitForClusterSizeFunc(c clientset.Interface, sizeFunc func(int) bool, time
})
numReady
:=
len
(
nodes
.
Items
)
if
numNodes
==
numReady
&&
sizeFunc
(
numReady
)
{
if
numNodes
==
numReady
+
expectedUnready
&&
sizeFunc
(
numNodes
)
{
glog
.
Infof
(
"Cluster has reached the desired size"
)
return
nil
}
...
...
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