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
5359e9ec
Commit
5359e9ec
authored
Jun 13, 2016
by
Marcin Wielgus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add pending pod check in cluster autoscaler e2e tests
parent
10255f8a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
cluster_size_autoscaling.go
test/e2e/cluster_size_autoscaling.go
+32
-0
No files found.
test/e2e/cluster_size_autoscaling.go
View file @
5359e9ec
...
@@ -127,6 +127,7 @@ var _ = framework.KubeDescribe("Cluster size autoscaling [Slow]", func() {
...
@@ -127,6 +127,7 @@ var _ = framework.KubeDescribe("Cluster size autoscaling [Slow]", func() {
// Verify, that cluster size is increased
// Verify, that cluster size is increased
framework
.
ExpectNoError
(
WaitForClusterSizeFunc
(
f
.
Client
,
framework
.
ExpectNoError
(
WaitForClusterSizeFunc
(
f
.
Client
,
func
(
size
int
)
bool
{
return
size
>=
nodeCount
+
1
},
scaleUpTimeout
))
func
(
size
int
)
bool
{
return
size
>=
nodeCount
+
1
},
scaleUpTimeout
))
framework
.
ExpectNoError
(
waitForAllCaPodsReadyInNamespace
(
f
,
c
))
})
})
It
(
"should increase cluster size if pods are pending due to host port conflict [Feature:ClusterSizeAutoscalingScaleUp]"
,
func
()
{
It
(
"should increase cluster size if pods are pending due to host port conflict [Feature:ClusterSizeAutoscalingScaleUp]"
,
func
()
{
...
@@ -135,6 +136,7 @@ var _ = framework.KubeDescribe("Cluster size autoscaling [Slow]", func() {
...
@@ -135,6 +136,7 @@ var _ = framework.KubeDescribe("Cluster size autoscaling [Slow]", func() {
framework
.
ExpectNoError
(
WaitForClusterSizeFunc
(
f
.
Client
,
framework
.
ExpectNoError
(
WaitForClusterSizeFunc
(
f
.
Client
,
func
(
size
int
)
bool
{
return
size
>=
nodeCount
+
2
},
scaleUpTimeout
))
func
(
size
int
)
bool
{
return
size
>=
nodeCount
+
2
},
scaleUpTimeout
))
framework
.
ExpectNoError
(
waitForAllCaPodsReadyInNamespace
(
f
,
c
))
})
})
It
(
"should correctly scale down after a node is not needed [Feature:ClusterSizeAutoscalingScaleDown]"
,
func
()
{
It
(
"should correctly scale down after a node is not needed [Feature:ClusterSizeAutoscalingScaleDown]"
,
func
()
{
...
@@ -205,6 +207,7 @@ var _ = framework.KubeDescribe("Cluster size autoscaling [Slow]", func() {
...
@@ -205,6 +207,7 @@ var _ = framework.KubeDescribe("Cluster size autoscaling [Slow]", func() {
framework
.
ExpectNoError
(
WaitForClusterSizeFunc
(
f
.
Client
,
framework
.
ExpectNoError
(
WaitForClusterSizeFunc
(
f
.
Client
,
func
(
size
int
)
bool
{
return
size
>=
nodeCount
+
1
},
scaleUpTimeout
))
func
(
size
int
)
bool
{
return
size
>=
nodeCount
+
1
},
scaleUpTimeout
))
framework
.
ExpectNoError
(
waitForAllCaPodsReadyInNamespace
(
f
,
c
))
framework
.
ExpectNoError
(
framework
.
DeleteRC
(
f
.
Client
,
f
.
Namespace
.
Name
,
"node-selector"
))
framework
.
ExpectNoError
(
framework
.
DeleteRC
(
f
.
Client
,
f
.
Namespace
.
Name
,
"node-selector"
))
})
})
})
})
...
@@ -382,6 +385,35 @@ func WaitForClusterSizeFunc(c *client.Client, sizeFunc func(int) bool, timeout t
...
@@ -382,6 +385,35 @@ func WaitForClusterSizeFunc(c *client.Client, sizeFunc func(int) bool, timeout t
return
fmt
.
Errorf
(
"timeout waiting %v for appropriate cluster size"
,
timeout
)
return
fmt
.
Errorf
(
"timeout waiting %v for appropriate cluster size"
,
timeout
)
}
}
func
waitForAllCaPodsReadyInNamespace
(
f
*
framework
.
Framework
,
c
*
client
.
Client
)
error
{
var
notready
[]
string
for
start
:=
time
.
Now
();
time
.
Now
()
.
Before
(
start
.
Add
(
scaleUpTimeout
));
time
.
Sleep
(
20
*
time
.
Second
)
{
pods
,
err
:=
c
.
Pods
(
f
.
Namespace
.
Name
)
.
List
(
api
.
ListOptions
{})
if
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to get pods: %v"
,
err
)
}
notready
=
make
([]
string
,
0
)
for
_
,
pod
:=
range
pods
.
Items
{
ready
:=
false
for
_
,
c
:=
range
pod
.
Status
.
Conditions
{
if
c
.
Type
==
api
.
PodReady
&&
c
.
Status
==
api
.
ConditionTrue
{
ready
=
true
}
}
if
!
ready
{
notready
=
append
(
notready
,
pod
.
Name
)
}
}
if
len
(
notready
)
==
0
{
glog
.
Infof
(
"All pods ready"
)
return
nil
}
glog
.
Infof
(
"Some pods are not ready yet: %v"
,
notready
)
}
// Some pods are still not running.
return
fmt
.
Errorf
(
"Some pods are still not running: %v"
,
notready
)
}
func
setMigSizes
(
sizes
map
[
string
]
int
)
{
func
setMigSizes
(
sizes
map
[
string
]
int
)
{
for
mig
,
desiredSize
:=
range
sizes
{
for
mig
,
desiredSize
:=
range
sizes
{
currentSize
,
err
:=
GroupSize
(
mig
)
currentSize
,
err
:=
GroupSize
(
mig
)
...
...
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