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
36e4f3db
Commit
36e4f3db
authored
Jun 02, 2016
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #26692 from wojtek-t/fix_scalability_test
Automatic merge from submit-queue Wait for all nodes to be schedulable in scalability tests
parents
3b908a53
2a5883fc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
4 deletions
+43
-4
density.go
test/e2e/density.go
+5
-0
util.go
test/e2e/framework/util.go
+33
-4
load.go
test/e2e/load.go
+5
-0
No files found.
test/e2e/density.go
View file @
36e4f3db
...
@@ -158,6 +158,11 @@ var _ = framework.KubeDescribe("Density", func() {
...
@@ -158,6 +158,11 @@ var _ = framework.KubeDescribe("Density", func() {
c
=
f
.
Client
c
=
f
.
Client
ns
=
f
.
Namespace
.
Name
ns
=
f
.
Namespace
.
Name
// In large clusters we may get to this point but still have a bunch
// of nodes without Routes created. Since this would make a node
// unschedulable, we need to wait until all of them are schedulable.
framework
.
ExpectNoError
(
framework
.
WaitForAllNodesSchedulable
(
c
))
nodes
:=
framework
.
GetReadySchedulableNodesOrDie
(
c
)
nodes
:=
framework
.
GetReadySchedulableNodesOrDie
(
c
)
nodeCount
=
len
(
nodes
.
Items
)
nodeCount
=
len
(
nodes
.
Items
)
Expect
(
nodeCount
)
.
NotTo
(
BeZero
())
Expect
(
nodeCount
)
.
NotTo
(
BeZero
())
...
...
test/e2e/framework/util.go
View file @
36e4f3db
...
@@ -2596,6 +2596,17 @@ func waitListSchedulableNodesOrDie(c *client.Client) *api.NodeList {
...
@@ -2596,6 +2596,17 @@ func waitListSchedulableNodesOrDie(c *client.Client) *api.NodeList {
return
nodes
return
nodes
}
}
// Node is schedulable if:
// 1) doesn't have "unschedulable" field set
// 2) it's Ready condition is set to true
// 3) doesn't have NetworkUnavailable condition set to true
func
isNodeSchedulable
(
node
*
api
.
Node
)
bool
{
nodeReady
:=
IsNodeConditionSetAsExpected
(
node
,
api
.
NodeReady
,
true
)
networkReady
:=
IsNodeConditionUnset
(
node
,
api
.
NodeNetworkUnavailable
)
||
IsNodeConditionSetAsExpected
(
node
,
api
.
NodeNetworkUnavailable
,
false
)
return
!
node
.
Spec
.
Unschedulable
&&
nodeReady
&&
networkReady
}
// GetReadySchedulableNodesOrDie addresses the common use case of getting nodes you can do work on.
// GetReadySchedulableNodesOrDie addresses the common use case of getting nodes you can do work on.
// 1) Needs to be schedulable.
// 1) Needs to be schedulable.
// 2) Needs to be ready.
// 2) Needs to be ready.
...
@@ -2605,14 +2616,32 @@ func GetReadySchedulableNodesOrDie(c *client.Client) (nodes *api.NodeList) {
...
@@ -2605,14 +2616,32 @@ func GetReadySchedulableNodesOrDie(c *client.Client) (nodes *api.NodeList) {
// previous tests may have cause failures of some nodes. Let's skip
// previous tests may have cause failures of some nodes. Let's skip
// 'Not Ready' nodes, just in case (there is no need to fail the test).
// 'Not Ready' nodes, just in case (there is no need to fail the test).
FilterNodes
(
nodes
,
func
(
node
api
.
Node
)
bool
{
FilterNodes
(
nodes
,
func
(
node
api
.
Node
)
bool
{
nodeReady
:=
IsNodeConditionSetAsExpected
(
&
node
,
api
.
NodeReady
,
true
)
return
isNodeSchedulable
(
&
node
)
networkReady
:=
IsNodeConditionUnset
(
&
node
,
api
.
NodeNetworkUnavailable
)
||
IsNodeConditionSetAsExpected
(
&
node
,
api
.
NodeNetworkUnavailable
,
false
)
return
!
node
.
Spec
.
Unschedulable
&&
nodeReady
&&
networkReady
})
})
return
nodes
return
nodes
}
}
func
WaitForAllNodesSchedulable
(
c
*
client
.
Client
)
error
{
return
wait
.
PollImmediate
(
30
*
time
.
Second
,
2
*
time
.
Hour
,
func
()
(
bool
,
error
)
{
opts
:=
api
.
ListOptions
{
ResourceVersion
:
"0"
,
FieldSelector
:
fields
.
Set
{
"spec.unschedulable"
:
"false"
}
.
AsSelector
(),
}
nodes
,
err
:=
c
.
Nodes
()
.
List
(
opts
)
if
err
!=
nil
{
Logf
(
"Unexpected error listing nodes: %v"
,
err
)
// Ignore the error here - it will be retried.
return
false
,
nil
}
for
_
,
node
:=
range
nodes
.
Items
{
if
!
isNodeSchedulable
(
&
node
)
{
return
false
,
nil
}
}
return
true
,
nil
})
}
func
ScaleRC
(
c
*
client
.
Client
,
ns
,
name
string
,
size
uint
,
wait
bool
)
error
{
func
ScaleRC
(
c
*
client
.
Client
,
ns
,
name
string
,
size
uint
,
wait
bool
)
error
{
By
(
fmt
.
Sprintf
(
"Scaling replication controller %s in namespace %s to %d"
,
name
,
ns
,
size
))
By
(
fmt
.
Sprintf
(
"Scaling replication controller %s in namespace %s to %d"
,
name
,
ns
,
size
))
scaler
,
err
:=
kubectl
.
ScalerFor
(
api
.
Kind
(
"ReplicationController"
),
c
)
scaler
,
err
:=
kubectl
.
ScalerFor
(
api
.
Kind
(
"ReplicationController"
),
c
)
...
...
test/e2e/load.go
View file @
36e4f3db
...
@@ -82,6 +82,11 @@ var _ = framework.KubeDescribe("Load capacity", func() {
...
@@ -82,6 +82,11 @@ var _ = framework.KubeDescribe("Load capacity", func() {
BeforeEach
(
func
()
{
BeforeEach
(
func
()
{
c
=
f
.
Client
c
=
f
.
Client
// In large clusters we may get to this point but still have a bunch
// of nodes without Routes created. Since this would make a node
// unschedulable, we need to wait until all of them are schedulable.
framework
.
ExpectNoError
(
framework
.
WaitForAllNodesSchedulable
(
c
))
ns
=
f
.
Namespace
.
Name
ns
=
f
.
Namespace
.
Name
nodes
:=
framework
.
GetReadySchedulableNodesOrDie
(
c
)
nodes
:=
framework
.
GetReadySchedulableNodesOrDie
(
c
)
nodeCount
=
len
(
nodes
.
Items
)
nodeCount
=
len
(
nodes
.
Items
)
...
...
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