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
0c1ab559
Commit
0c1ab559
authored
Aug 29, 2017
by
Andrzej Wasylkowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed ClusterSize and WaitForClusterSize to NumberOfReadyNodes and…
Renamed ClusterSize and WaitForClusterSize to NumberOfReadyNodes and WaitForReadyNodes, respectively.
parent
9b0f4c9f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
32 additions
and
32 deletions
+32
-32
autoscaling_timer.go
test/e2e/autoscaling/autoscaling_timer.go
+1
-1
cluster_autoscaler_scalability.go
test/e2e/autoscaling/cluster_autoscaler_scalability.go
+7
-7
cluster_size_autoscaling.go
test/e2e/autoscaling/cluster_size_autoscaling.go
+13
-13
dns_autoscaling.go
test/e2e/autoscaling/dns_autoscaling.go
+1
-1
util.go
test/e2e/framework/util.go
+7
-7
resize_nodes.go
test/e2e/lifecycle/resize_nodes.go
+3
-3
No files found.
test/e2e/autoscaling/autoscaling_timer.go
View file @
0c1ab559
...
@@ -70,7 +70,7 @@ var _ = SIGDescribe("[Feature:ClusterSizeAutoscalingScaleUp] [Slow] Autoscaling"
...
@@ -70,7 +70,7 @@ var _ = SIGDescribe("[Feature:ClusterSizeAutoscalingScaleUp] [Slow] Autoscaling"
AfterEach
(
func
()
{
AfterEach
(
func
()
{
// Scale down back to only 'nodesNum' nodes, as expected at the start of the test.
// Scale down back to only 'nodesNum' nodes, as expected at the start of the test.
framework
.
ExpectNoError
(
framework
.
ResizeGroup
(
nodeGroupName
,
nodesNum
))
framework
.
ExpectNoError
(
framework
.
ResizeGroup
(
nodeGroupName
,
nodesNum
))
framework
.
ExpectNoError
(
framework
.
WaitFor
ClusterSize
(
f
.
ClientSet
,
nodesNum
,
15
*
time
.
Minute
))
framework
.
ExpectNoError
(
framework
.
WaitFor
ReadyNodes
(
f
.
ClientSet
,
nodesNum
,
15
*
time
.
Minute
))
})
})
Measure
(
"takes less than 15 minutes"
,
func
(
b
Benchmarker
)
{
Measure
(
"takes less than 15 minutes"
,
func
(
b
Benchmarker
)
{
...
...
test/e2e/autoscaling/cluster_autoscaler_scalability.go
View file @
0c1ab559
...
@@ -89,7 +89,7 @@ var _ = framework.KubeDescribe("Cluster size autoscaler scalability [Slow]", fun
...
@@ -89,7 +89,7 @@ var _ = framework.KubeDescribe("Cluster size autoscaler scalability [Slow]", fun
}
}
}
}
framework
.
ExpectNoError
(
framework
.
WaitFor
ClusterSize
(
c
,
sum
,
scaleUpTimeout
))
framework
.
ExpectNoError
(
framework
.
WaitFor
ReadyNodes
(
c
,
sum
,
scaleUpTimeout
))
nodes
:=
framework
.
GetReadySchedulableNodesOrDie
(
f
.
ClientSet
)
nodes
:=
framework
.
GetReadySchedulableNodesOrDie
(
f
.
ClientSet
)
nodeCount
=
len
(
nodes
.
Items
)
nodeCount
=
len
(
nodes
.
Items
)
...
@@ -114,7 +114,7 @@ var _ = framework.KubeDescribe("Cluster size autoscaler scalability [Slow]", fun
...
@@ -114,7 +114,7 @@ var _ = framework.KubeDescribe("Cluster size autoscaler scalability [Slow]", fun
AfterEach
(
func
()
{
AfterEach
(
func
()
{
By
(
fmt
.
Sprintf
(
"Restoring initial size of the cluster"
))
By
(
fmt
.
Sprintf
(
"Restoring initial size of the cluster"
))
setMigSizes
(
originalSizes
)
setMigSizes
(
originalSizes
)
framework
.
ExpectNoError
(
framework
.
WaitFor
ClusterSize
(
c
,
nodeCount
,
scaleDownTimeout
))
framework
.
ExpectNoError
(
framework
.
WaitFor
ReadyNodes
(
c
,
nodeCount
,
scaleDownTimeout
))
nodes
,
err
:=
c
.
Core
()
.
Nodes
()
.
List
(
metav1
.
ListOptions
{})
nodes
,
err
:=
c
.
Core
()
.
Nodes
()
.
List
(
metav1
.
ListOptions
{})
framework
.
ExpectNoError
(
err
)
framework
.
ExpectNoError
(
err
)
s
:=
time
.
Now
()
s
:=
time
.
Now
()
...
@@ -216,7 +216,7 @@ var _ = framework.KubeDescribe("Cluster size autoscaler scalability [Slow]", fun
...
@@ -216,7 +216,7 @@ var _ = framework.KubeDescribe("Cluster size autoscaler scalability [Slow]", fun
anyKey
(
originalSizes
)
:
totalNodes
,
anyKey
(
originalSizes
)
:
totalNodes
,
}
}
setMigSizes
(
newSizes
)
setMigSizes
(
newSizes
)
framework
.
ExpectNoError
(
framework
.
WaitFor
ClusterSize
(
f
.
ClientSet
,
totalNodes
,
largeResizeTimeout
))
framework
.
ExpectNoError
(
framework
.
WaitFor
ReadyNodes
(
f
.
ClientSet
,
totalNodes
,
largeResizeTimeout
))
// run replicas
// run replicas
rcConfig
:=
reserveMemoryRCConfig
(
f
,
"some-pod"
,
replicas
,
replicas
*
perNodeReservation
,
largeScaleUpTimeout
)
rcConfig
:=
reserveMemoryRCConfig
(
f
,
"some-pod"
,
replicas
,
replicas
*
perNodeReservation
,
largeScaleUpTimeout
)
...
@@ -250,7 +250,7 @@ var _ = framework.KubeDescribe("Cluster size autoscaler scalability [Slow]", fun
...
@@ -250,7 +250,7 @@ var _ = framework.KubeDescribe("Cluster size autoscaler scalability [Slow]", fun
}
}
setMigSizes
(
newSizes
)
setMigSizes
(
newSizes
)
framework
.
ExpectNoError
(
framework
.
WaitFor
ClusterSize
(
f
.
ClientSet
,
totalNodes
,
largeResizeTimeout
))
framework
.
ExpectNoError
(
framework
.
WaitFor
ReadyNodes
(
f
.
ClientSet
,
totalNodes
,
largeResizeTimeout
))
// annotate all nodes with no-scale-down
// annotate all nodes with no-scale-down
ScaleDownDisabledKey
:=
"cluster-autoscaler.kubernetes.io/scale-down-disabled"
ScaleDownDisabledKey
:=
"cluster-autoscaler.kubernetes.io/scale-down-disabled"
...
@@ -304,7 +304,7 @@ var _ = framework.KubeDescribe("Cluster size autoscaler scalability [Slow]", fun
...
@@ -304,7 +304,7 @@ var _ = framework.KubeDescribe("Cluster size autoscaler scalability [Slow]", fun
anyKey
(
originalSizes
)
:
totalNodes
,
anyKey
(
originalSizes
)
:
totalNodes
,
}
}
setMigSizes
(
newSizes
)
setMigSizes
(
newSizes
)
framework
.
ExpectNoError
(
framework
.
WaitFor
ClusterSize
(
f
.
ClientSet
,
totalNodes
,
largeResizeTimeout
))
framework
.
ExpectNoError
(
framework
.
WaitFor
ReadyNodes
(
f
.
ClientSet
,
totalNodes
,
largeResizeTimeout
))
divider
:=
int
(
float64
(
totalNodes
)
*
0.7
)
divider
:=
int
(
float64
(
totalNodes
)
*
0.7
)
fullNodesCount
:=
divider
fullNodesCount
:=
divider
underutilizedNodesCount
:=
totalNodes
-
fullNodesCount
underutilizedNodesCount
:=
totalNodes
-
fullNodesCount
...
@@ -350,7 +350,7 @@ var _ = framework.KubeDescribe("Cluster size autoscaler scalability [Slow]", fun
...
@@ -350,7 +350,7 @@ var _ = framework.KubeDescribe("Cluster size autoscaler scalability [Slow]", fun
defer
framework
.
DeleteRCAndPods
(
f
.
ClientSet
,
f
.
InternalClientset
,
f
.
Namespace
.
Name
,
podsConfig
.
Name
)
defer
framework
.
DeleteRCAndPods
(
f
.
ClientSet
,
f
.
InternalClientset
,
f
.
Namespace
.
Name
,
podsConfig
.
Name
)
// Ensure that no new nodes have been added so far.
// Ensure that no new nodes have been added so far.
Expect
(
framework
.
ClusterSize
(
f
.
ClientSet
))
.
To
(
Equal
(
nodeCount
))
Expect
(
framework
.
NumberOfReadyNodes
(
f
.
ClientSet
))
.
To
(
Equal
(
nodeCount
))
// Start a number of schedulable pods to ensure CA reacts.
// Start a number of schedulable pods to ensure CA reacts.
additionalNodes
:=
maxNodes
-
nodeCount
additionalNodes
:=
maxNodes
-
nodeCount
...
@@ -407,7 +407,7 @@ func simpleScaleUpTestWithTolerance(f *framework.Framework, config *scaleUpTestC
...
@@ -407,7 +407,7 @@ func simpleScaleUpTestWithTolerance(f *framework.Framework, config *scaleUpTestC
framework
.
ExpectNoError
(
WaitForClusterSizeFunc
(
f
.
ClientSet
,
framework
.
ExpectNoError
(
WaitForClusterSizeFunc
(
f
.
ClientSet
,
func
(
size
int
)
bool
{
return
size
>=
minExpectedNodeCount
},
scaleUpTimeout
))
func
(
size
int
)
bool
{
return
size
>=
minExpectedNodeCount
},
scaleUpTimeout
))
}
else
{
}
else
{
framework
.
ExpectNoError
(
framework
.
WaitFor
ClusterSize
(
f
.
ClientSet
,
config
.
expectedResult
.
nodes
,
scaleUpTimeout
))
framework
.
ExpectNoError
(
framework
.
WaitFor
ReadyNodes
(
f
.
ClientSet
,
config
.
expectedResult
.
nodes
,
scaleUpTimeout
))
}
}
glog
.
Infof
(
"cluster is increased"
)
glog
.
Infof
(
"cluster is increased"
)
if
tolerateMissingPodCount
>
0
{
if
tolerateMissingPodCount
>
0
{
...
...
test/e2e/autoscaling/cluster_size_autoscaling.go
View file @
0c1ab559
...
@@ -97,7 +97,7 @@ var _ = SIGDescribe("Cluster size autoscaling [Slow]", func() {
...
@@ -97,7 +97,7 @@ var _ = SIGDescribe("Cluster size autoscaling [Slow]", func() {
sum
+=
size
sum
+=
size
}
}
// Give instances time to spin up
// Give instances time to spin up
framework
.
ExpectNoError
(
framework
.
WaitFor
ClusterSize
(
c
,
sum
,
scaleUpTimeout
))
framework
.
ExpectNoError
(
framework
.
WaitFor
ReadyNodes
(
c
,
sum
,
scaleUpTimeout
))
nodes
:=
framework
.
GetReadySchedulableNodesOrDie
(
f
.
ClientSet
)
nodes
:=
framework
.
GetReadySchedulableNodesOrDie
(
f
.
ClientSet
)
nodeCount
=
len
(
nodes
.
Items
)
nodeCount
=
len
(
nodes
.
Items
)
...
@@ -127,7 +127,7 @@ var _ = SIGDescribe("Cluster size autoscaling [Slow]", func() {
...
@@ -127,7 +127,7 @@ var _ = SIGDescribe("Cluster size autoscaling [Slow]", func() {
for
_
,
size
:=
range
originalSizes
{
for
_
,
size
:=
range
originalSizes
{
expectedNodes
+=
size
expectedNodes
+=
size
}
}
framework
.
ExpectNoError
(
framework
.
WaitFor
ClusterSize
(
c
,
expectedNodes
,
scaleDownTimeout
))
framework
.
ExpectNoError
(
framework
.
WaitFor
ReadyNodes
(
c
,
expectedNodes
,
scaleDownTimeout
))
nodes
,
err
:=
c
.
Core
()
.
Nodes
()
.
List
(
metav1
.
ListOptions
{})
nodes
,
err
:=
c
.
Core
()
.
Nodes
()
.
List
(
metav1
.
ListOptions
{})
framework
.
ExpectNoError
(
err
)
framework
.
ExpectNoError
(
err
)
...
@@ -226,7 +226,7 @@ var _ = SIGDescribe("Cluster size autoscaling [Slow]", func() {
...
@@ -226,7 +226,7 @@ var _ = SIGDescribe("Cluster size autoscaling [Slow]", func() {
const
extraPoolName
=
"extra-pool"
const
extraPoolName
=
"extra-pool"
addNodePool
(
extraPoolName
,
"n1-standard-4"
,
1
)
addNodePool
(
extraPoolName
,
"n1-standard-4"
,
1
)
defer
deleteNodePool
(
extraPoolName
)
defer
deleteNodePool
(
extraPoolName
)
framework
.
ExpectNoError
(
framework
.
WaitFor
ClusterSize
(
c
,
nodeCount
+
1
,
resizeTimeout
))
framework
.
ExpectNoError
(
framework
.
WaitFor
ReadyNodes
(
c
,
nodeCount
+
1
,
resizeTimeout
))
glog
.
Infof
(
"Not enabling cluster autoscaler for the node pool (on purpose)."
)
glog
.
Infof
(
"Not enabling cluster autoscaler for the node pool (on purpose)."
)
By
(
"Get memory available on new node, so we can account for it when creating RC"
)
By
(
"Get memory available on new node, so we can account for it when creating RC"
)
...
@@ -253,7 +253,7 @@ var _ = SIGDescribe("Cluster size autoscaling [Slow]", func() {
...
@@ -253,7 +253,7 @@ var _ = SIGDescribe("Cluster size autoscaling [Slow]", func() {
const
extraPoolName
=
"extra-pool"
const
extraPoolName
=
"extra-pool"
addNodePool
(
extraPoolName
,
"n1-standard-4"
,
1
)
addNodePool
(
extraPoolName
,
"n1-standard-4"
,
1
)
defer
deleteNodePool
(
extraPoolName
)
defer
deleteNodePool
(
extraPoolName
)
framework
.
ExpectNoError
(
framework
.
WaitFor
ClusterSize
(
c
,
nodeCount
+
1
,
resizeTimeout
))
framework
.
ExpectNoError
(
framework
.
WaitFor
ReadyNodes
(
c
,
nodeCount
+
1
,
resizeTimeout
))
framework
.
ExpectNoError
(
enableAutoscaler
(
extraPoolName
,
1
,
2
))
framework
.
ExpectNoError
(
enableAutoscaler
(
extraPoolName
,
1
,
2
))
framework
.
ExpectNoError
(
disableAutoscaler
(
extraPoolName
,
1
,
2
))
framework
.
ExpectNoError
(
disableAutoscaler
(
extraPoolName
,
1
,
2
))
})
})
...
@@ -283,7 +283,7 @@ var _ = SIGDescribe("Cluster size autoscaling [Slow]", func() {
...
@@ -283,7 +283,7 @@ var _ = SIGDescribe("Cluster size autoscaling [Slow]", func() {
defer
framework
.
DeleteRCAndPods
(
f
.
ClientSet
,
f
.
InternalClientset
,
f
.
Namespace
.
Name
,
"extra-pod"
)
defer
framework
.
DeleteRCAndPods
(
f
.
ClientSet
,
f
.
InternalClientset
,
f
.
Namespace
.
Name
,
"extra-pod"
)
framework
.
ExpectNoError
(
waitForAllCaPodsReadyInNamespace
(
f
,
c
))
framework
.
ExpectNoError
(
waitForAllCaPodsReadyInNamespace
(
f
,
c
))
framework
.
ExpectNoError
(
framework
.
WaitFor
ClusterSize
(
c
,
nodeCount
+
newPods
,
scaleUpTimeout
))
framework
.
ExpectNoError
(
framework
.
WaitFor
ReadyNodes
(
c
,
nodeCount
+
newPods
,
scaleUpTimeout
))
})
})
It
(
"should increase cluster size if pod requesting EmptyDir volume is pending [Feature:ClusterSizeAutoscalingScaleUp]"
,
func
()
{
It
(
"should increase cluster size if pod requesting EmptyDir volume is pending [Feature:ClusterSizeAutoscalingScaleUp]"
,
func
()
{
...
@@ -304,7 +304,7 @@ var _ = SIGDescribe("Cluster size autoscaling [Slow]", func() {
...
@@ -304,7 +304,7 @@ var _ = SIGDescribe("Cluster size autoscaling [Slow]", func() {
defer
framework
.
DeleteRCAndPods
(
f
.
ClientSet
,
f
.
InternalClientset
,
f
.
Namespace
.
Name
,
"extra-pod"
)
defer
framework
.
DeleteRCAndPods
(
f
.
ClientSet
,
f
.
InternalClientset
,
f
.
Namespace
.
Name
,
"extra-pod"
)
framework
.
ExpectNoError
(
waitForAllCaPodsReadyInNamespace
(
f
,
c
))
framework
.
ExpectNoError
(
waitForAllCaPodsReadyInNamespace
(
f
,
c
))
framework
.
ExpectNoError
(
framework
.
WaitFor
ClusterSize
(
c
,
nodeCount
+
newPods
,
scaleUpTimeout
))
framework
.
ExpectNoError
(
framework
.
WaitFor
ReadyNodes
(
c
,
nodeCount
+
newPods
,
scaleUpTimeout
))
})
})
It
(
"should increase cluster size if pod requesting volume is pending [Feature:ClusterSizeAutoscalingScaleUp]"
,
func
()
{
It
(
"should increase cluster size if pod requesting volume is pending [Feature:ClusterSizeAutoscalingScaleUp]"
,
func
()
{
...
@@ -377,7 +377,7 @@ var _ = SIGDescribe("Cluster size autoscaling [Slow]", func() {
...
@@ -377,7 +377,7 @@ var _ = SIGDescribe("Cluster size autoscaling [Slow]", func() {
}()
}()
framework
.
ExpectNoError
(
waitForAllCaPodsReadyInNamespace
(
f
,
c
))
framework
.
ExpectNoError
(
waitForAllCaPodsReadyInNamespace
(
f
,
c
))
framework
.
ExpectNoError
(
framework
.
WaitFor
ClusterSize
(
c
,
nodeCount
+
newPods
,
scaleUpTimeout
))
framework
.
ExpectNoError
(
framework
.
WaitFor
ReadyNodes
(
c
,
nodeCount
+
newPods
,
scaleUpTimeout
))
})
})
It
(
"should add node to the particular mig [Feature:ClusterSizeAutoscalingScaleUp]"
,
func
()
{
It
(
"should add node to the particular mig [Feature:ClusterSizeAutoscalingScaleUp]"
,
func
()
{
...
@@ -478,7 +478,7 @@ var _ = SIGDescribe("Cluster size autoscaling [Slow]", func() {
...
@@ -478,7 +478,7 @@ var _ = SIGDescribe("Cluster size autoscaling [Slow]", func() {
const
extraPoolName
=
"extra-pool"
const
extraPoolName
=
"extra-pool"
addNodePool
(
extraPoolName
,
"n1-standard-4"
,
1
)
addNodePool
(
extraPoolName
,
"n1-standard-4"
,
1
)
defer
deleteNodePool
(
extraPoolName
)
defer
deleteNodePool
(
extraPoolName
)
framework
.
ExpectNoError
(
framework
.
WaitFor
ClusterSize
(
c
,
nodeCount
+
1
,
resizeTimeout
))
framework
.
ExpectNoError
(
framework
.
WaitFor
ReadyNodes
(
c
,
nodeCount
+
1
,
resizeTimeout
))
framework
.
ExpectNoError
(
enableAutoscaler
(
extraPoolName
,
1
,
2
))
framework
.
ExpectNoError
(
enableAutoscaler
(
extraPoolName
,
1
,
2
))
By
(
"Creating rc with 2 pods too big to fit default-pool but fitting extra-pool"
)
By
(
"Creating rc with 2 pods too big to fit default-pool but fitting extra-pool"
)
...
@@ -489,7 +489,7 @@ var _ = SIGDescribe("Cluster size autoscaling [Slow]", func() {
...
@@ -489,7 +489,7 @@ var _ = SIGDescribe("Cluster size autoscaling [Slow]", func() {
// reseting all the timers in scale down code. Adding 5 extra minutes to workaround
// reseting all the timers in scale down code. Adding 5 extra minutes to workaround
// this issue.
// this issue.
// TODO: Remove the extra time when GKE restart is fixed.
// TODO: Remove the extra time when GKE restart is fixed.
framework
.
ExpectNoError
(
framework
.
WaitFor
ClusterSize
(
c
,
nodeCount
+
2
,
scaleUpTimeout
+
5
*
time
.
Minute
))
framework
.
ExpectNoError
(
framework
.
WaitFor
ReadyNodes
(
c
,
nodeCount
+
2
,
scaleUpTimeout
+
5
*
time
.
Minute
))
})
})
simpleScaleDownTest
:=
func
(
unready
int
)
{
simpleScaleDownTest
:=
func
(
unready
int
)
{
...
@@ -588,7 +588,7 @@ var _ = SIGDescribe("Cluster size autoscaling [Slow]", func() {
...
@@ -588,7 +588,7 @@ var _ = SIGDescribe("Cluster size autoscaling [Slow]", func() {
}
}
err
:=
framework
.
ResizeGroup
(
minMig
,
int32
(
0
))
err
:=
framework
.
ResizeGroup
(
minMig
,
int32
(
0
))
framework
.
ExpectNoError
(
err
)
framework
.
ExpectNoError
(
err
)
framework
.
ExpectNoError
(
framework
.
WaitFor
ClusterSize
(
c
,
nodeCount
-
minSize
,
resizeTimeout
))
framework
.
ExpectNoError
(
framework
.
WaitFor
ReadyNodes
(
c
,
nodeCount
-
minSize
,
resizeTimeout
))
By
(
"Make remaining nodes unschedulable"
)
By
(
"Make remaining nodes unschedulable"
)
nodes
,
err
:=
f
.
ClientSet
.
Core
()
.
Nodes
()
.
List
(
metav1
.
ListOptions
{
FieldSelector
:
fields
.
Set
{
nodes
,
err
:=
f
.
ClientSet
.
Core
()
.
Nodes
()
.
List
(
metav1
.
ListOptions
{
FieldSelector
:
fields
.
Set
{
...
@@ -628,7 +628,7 @@ var _ = SIGDescribe("Cluster size autoscaling [Slow]", func() {
...
@@ -628,7 +628,7 @@ var _ = SIGDescribe("Cluster size autoscaling [Slow]", func() {
}
}
err
:=
framework
.
ResizeGroup
(
minMig
,
int32
(
1
))
err
:=
framework
.
ResizeGroup
(
minMig
,
int32
(
1
))
framework
.
ExpectNoError
(
err
)
framework
.
ExpectNoError
(
err
)
framework
.
ExpectNoError
(
framework
.
WaitFor
ClusterSize
(
c
,
nodeCount
-
minSize
+
1
,
resizeTimeout
))
framework
.
ExpectNoError
(
framework
.
WaitFor
ReadyNodes
(
c
,
nodeCount
-
minSize
+
1
,
resizeTimeout
))
By
(
"Make the single node unschedulable"
)
By
(
"Make the single node unschedulable"
)
allNodes
,
err
:=
f
.
ClientSet
.
Core
()
.
Nodes
()
.
List
(
metav1
.
ListOptions
{
FieldSelector
:
fields
.
Set
{
allNodes
,
err
:=
f
.
ClientSet
.
Core
()
.
Nodes
()
.
List
(
metav1
.
ListOptions
{
FieldSelector
:
fields
.
Set
{
...
@@ -699,7 +699,7 @@ var _ = SIGDescribe("Cluster size autoscaling [Slow]", func() {
...
@@ -699,7 +699,7 @@ var _ = SIGDescribe("Cluster size autoscaling [Slow]", func() {
}
}
testFunction
()
testFunction
()
// Give nodes time to recover from network failure
// Give nodes time to recover from network failure
framework
.
ExpectNoError
(
framework
.
WaitFor
ClusterSize
(
c
,
len
(
nodes
.
Items
),
nodesRecoverTimeout
))
framework
.
ExpectNoError
(
framework
.
WaitFor
ReadyNodes
(
c
,
len
(
nodes
.
Items
),
nodesRecoverTimeout
))
})
})
})
})
...
@@ -937,7 +937,7 @@ func ReserveMemory(f *framework.Framework, id string, replicas, megabytes int, e
...
@@ -937,7 +937,7 @@ func ReserveMemory(f *framework.Framework, id string, replicas, megabytes int, e
return
nil
return
nil
}
}
// WaitForClusterSize waits until the cluster size matches the given function.
// WaitForClusterSize
Func
waits until the cluster size matches the given function.
func
WaitForClusterSizeFunc
(
c
clientset
.
Interface
,
sizeFunc
func
(
int
)
bool
,
timeout
time
.
Duration
)
error
{
func
WaitForClusterSizeFunc
(
c
clientset
.
Interface
,
sizeFunc
func
(
int
)
bool
,
timeout
time
.
Duration
)
error
{
return
WaitForClusterSizeFuncWithUnready
(
c
,
sizeFunc
,
timeout
,
0
)
return
WaitForClusterSizeFuncWithUnready
(
c
,
sizeFunc
,
timeout
,
0
)
}
}
...
...
test/e2e/autoscaling/dns_autoscaling.go
View file @
0c1ab559
...
@@ -151,7 +151,7 @@ var _ = SIGDescribe("DNS horizontal autoscaling", func() {
...
@@ -151,7 +151,7 @@ var _ = SIGDescribe("DNS horizontal autoscaling", func() {
By
(
"Restoring cluster size"
)
By
(
"Restoring cluster size"
)
setMigSizes
(
originalSizes
)
setMigSizes
(
originalSizes
)
Expect
(
framework
.
WaitFor
ClusterSize
(
c
,
sum
,
scaleDownTimeout
))
.
NotTo
(
HaveOccurred
())
Expect
(
framework
.
WaitFor
ReadyNodes
(
c
,
sum
,
scaleDownTimeout
))
.
NotTo
(
HaveOccurred
())
By
(
"Wait for kube-dns scaled to expected number"
)
By
(
"Wait for kube-dns scaled to expected number"
)
Expect
(
waitForDNSReplicasSatisfied
(
c
,
getExpectReplicasLinear
,
DNSdefaultTimeout
))
.
NotTo
(
HaveOccurred
())
Expect
(
waitForDNSReplicasSatisfied
(
c
,
getExpectReplicasLinear
,
DNSdefaultTimeout
))
.
NotTo
(
HaveOccurred
())
...
...
test/e2e/framework/util.go
View file @
0c1ab559
...
@@ -3892,8 +3892,8 @@ func WaitForControllerManagerUp() error {
...
@@ -3892,8 +3892,8 @@ func WaitForControllerManagerUp() error {
return
fmt
.
Errorf
(
"waiting for controller-manager timed out"
)
return
fmt
.
Errorf
(
"waiting for controller-manager timed out"
)
}
}
// Returns
cluster size (number of ready Nodes excluding Master Node)
.
// Returns
number of ready Nodes excluding Master Node
.
func
ClusterSize
(
c
clientset
.
Interface
)
(
int
,
error
)
{
func
NumberOfReadyNodes
(
c
clientset
.
Interface
)
(
int
,
error
)
{
nodes
,
err
:=
c
.
Core
()
.
Nodes
()
.
List
(
metav1
.
ListOptions
{
FieldSelector
:
fields
.
Set
{
nodes
,
err
:=
c
.
Core
()
.
Nodes
()
.
List
(
metav1
.
ListOptions
{
FieldSelector
:
fields
.
Set
{
"spec.unschedulable"
:
"false"
,
"spec.unschedulable"
:
"false"
,
}
.
AsSelector
()
.
String
()})
}
.
AsSelector
()
.
String
()})
...
@@ -3909,9 +3909,9 @@ func ClusterSize(c clientset.Interface) (int, error) {
...
@@ -3909,9 +3909,9 @@ func ClusterSize(c clientset.Interface) (int, error) {
return
len
(
nodes
.
Items
),
nil
return
len
(
nodes
.
Items
),
nil
}
}
// WaitFor
ClusterSize
waits until the cluster has desired size and there is no not-ready nodes in it.
// WaitFor
ReadyNodes
waits until the cluster has desired size and there is no not-ready nodes in it.
// By cluster size we mean number of Nodes excluding Master Node.
// By cluster size we mean number of Nodes excluding Master Node.
func
WaitFor
ClusterSize
(
c
clientset
.
Interface
,
size
int
,
timeout
time
.
Duration
)
error
{
func
WaitFor
ReadyNodes
(
c
clientset
.
Interface
,
size
int
,
timeout
time
.
Duration
)
error
{
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
timeout
;
time
.
Sleep
(
20
*
time
.
Second
)
{
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
timeout
;
time
.
Sleep
(
20
*
time
.
Second
)
{
nodes
,
err
:=
c
.
Core
()
.
Nodes
()
.
List
(
metav1
.
ListOptions
{
FieldSelector
:
fields
.
Set
{
nodes
,
err
:=
c
.
Core
()
.
Nodes
()
.
List
(
metav1
.
ListOptions
{
FieldSelector
:
fields
.
Set
{
"spec.unschedulable"
:
"false"
,
"spec.unschedulable"
:
"false"
,
...
@@ -3929,12 +3929,12 @@ func WaitForClusterSize(c clientset.Interface, size int, timeout time.Duration)
...
@@ -3929,12 +3929,12 @@ func WaitForClusterSize(c clientset.Interface, size int, timeout time.Duration)
numReady
:=
len
(
nodes
.
Items
)
numReady
:=
len
(
nodes
.
Items
)
if
numNodes
==
size
&&
numReady
==
size
{
if
numNodes
==
size
&&
numReady
==
size
{
Logf
(
"Cluster has reached the desired
size
%d"
,
size
)
Logf
(
"Cluster has reached the desired
number of ready nodes
%d"
,
size
)
return
nil
return
nil
}
}
Logf
(
"Waiting for
cluster size %d, current size
%d, not ready nodes %d"
,
size
,
numNodes
,
numNodes
-
numReady
)
Logf
(
"Waiting for
ready nodes %d, current ready
%d, not ready nodes %d"
,
size
,
numNodes
,
numNodes
-
numReady
)
}
}
return
fmt
.
Errorf
(
"timeout waiting %v for
cluster size
to be %d"
,
timeout
,
size
)
return
fmt
.
Errorf
(
"timeout waiting %v for
number of ready nodes
to be %d"
,
timeout
,
size
)
}
}
func
GenerateMasterRegexp
(
prefix
string
)
string
{
func
GenerateMasterRegexp
(
prefix
string
)
string
{
...
...
test/e2e/lifecycle/resize_nodes.go
View file @
0c1ab559
...
@@ -98,7 +98,7 @@ var _ = SIGDescribe("Nodes [Disruptive]", func() {
...
@@ -98,7 +98,7 @@ var _ = SIGDescribe("Nodes [Disruptive]", func() {
if
err
:=
framework
.
WaitForGroupSize
(
group
,
int32
(
framework
.
TestContext
.
CloudConfig
.
NumNodes
));
err
!=
nil
{
if
err
:=
framework
.
WaitForGroupSize
(
group
,
int32
(
framework
.
TestContext
.
CloudConfig
.
NumNodes
));
err
!=
nil
{
framework
.
Failf
(
"Couldn't restore the original node instance group size: %v"
,
err
)
framework
.
Failf
(
"Couldn't restore the original node instance group size: %v"
,
err
)
}
}
if
err
:=
framework
.
WaitFor
ClusterSize
(
c
,
framework
.
TestContext
.
CloudConfig
.
NumNodes
,
10
*
time
.
Minute
);
err
!=
nil
{
if
err
:=
framework
.
WaitFor
ReadyNodes
(
c
,
framework
.
TestContext
.
CloudConfig
.
NumNodes
,
10
*
time
.
Minute
);
err
!=
nil
{
framework
.
Failf
(
"Couldn't restore the original cluster size: %v"
,
err
)
framework
.
Failf
(
"Couldn't restore the original cluster size: %v"
,
err
)
}
}
// Many e2e tests assume that the cluster is fully healthy before they start. Wait until
// Many e2e tests assume that the cluster is fully healthy before they start. Wait until
...
@@ -124,7 +124,7 @@ var _ = SIGDescribe("Nodes [Disruptive]", func() {
...
@@ -124,7 +124,7 @@ var _ = SIGDescribe("Nodes [Disruptive]", func() {
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
err
=
framework
.
WaitForGroupSize
(
group
,
replicas
-
1
)
err
=
framework
.
WaitForGroupSize
(
group
,
replicas
-
1
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
err
=
framework
.
WaitFor
ClusterSize
(
c
,
int
(
replicas
-
1
),
10
*
time
.
Minute
)
err
=
framework
.
WaitFor
ReadyNodes
(
c
,
int
(
replicas
-
1
),
10
*
time
.
Minute
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
By
(
"waiting 1 minute for the watch in the podGC to catch up, remove any pods scheduled on "
+
By
(
"waiting 1 minute for the watch in the podGC to catch up, remove any pods scheduled on "
+
...
@@ -152,7 +152,7 @@ var _ = SIGDescribe("Nodes [Disruptive]", func() {
...
@@ -152,7 +152,7 @@ var _ = SIGDescribe("Nodes [Disruptive]", func() {
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
err
=
framework
.
WaitForGroupSize
(
group
,
replicas
+
1
)
err
=
framework
.
WaitForGroupSize
(
group
,
replicas
+
1
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
err
=
framework
.
WaitFor
ClusterSize
(
c
,
int
(
replicas
+
1
),
10
*
time
.
Minute
)
err
=
framework
.
WaitFor
ReadyNodes
(
c
,
int
(
replicas
+
1
),
10
*
time
.
Minute
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
By
(
fmt
.
Sprintf
(
"increasing size of the replication controller to %d and verifying all pods are running"
,
replicas
+
1
))
By
(
fmt
.
Sprintf
(
"increasing size of the replication controller to %d and verifying all pods are running"
,
replicas
+
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