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
4387dcbd
Commit
4387dcbd
authored
Sep 14, 2016
by
Kubernetes Submit Queue
Committed by
GitHub
Sep 14, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #32659 from wojtek-t/fix_gke_cluster
Automatic merge from submit-queue Make networking tests work reasonably fast in large clusters @bprashanth - FYI
parents
e56a32a2
b86ba6ea
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
4 deletions
+26
-4
networking_utils.go
test/e2e/networking_utils.go
+26
-4
No files found.
test/e2e/networking_utils.go
View file @
4387dcbd
...
@@ -30,6 +30,7 @@ import (
...
@@ -30,6 +30,7 @@ import (
client
"k8s.io/kubernetes/pkg/client/unversioned"
client
"k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/util/intstr"
"k8s.io/kubernetes/pkg/util/intstr"
"k8s.io/kubernetes/pkg/util/rand"
"k8s.io/kubernetes/pkg/util/sets"
"k8s.io/kubernetes/pkg/util/sets"
"k8s.io/kubernetes/pkg/util/uuid"
"k8s.io/kubernetes/pkg/util/uuid"
"k8s.io/kubernetes/pkg/util/wait"
"k8s.io/kubernetes/pkg/util/wait"
...
@@ -51,6 +52,8 @@ const (
...
@@ -51,6 +52,8 @@ const (
// Number of retries to hit a given set of endpoints. Needs to be high
// Number of retries to hit a given set of endpoints. Needs to be high
// because we verify iptables statistical rr loadbalancing.
// because we verify iptables statistical rr loadbalancing.
testTries
=
30
testTries
=
30
// Maximum number of pods in a test, to make test work in large clusters.
maxNetProxyPodsCount
=
100
)
)
// NewNetworkingTestConfig creates and sets up a new test config helper.
// NewNetworkingTestConfig creates and sets up a new test config helper.
...
@@ -441,13 +444,32 @@ func (config *NetworkingTestConfig) cleanup() {
...
@@ -441,13 +444,32 @@ func (config *NetworkingTestConfig) cleanup() {
}
}
}
}
// shuffleNodes copies nodes from the specified slice into a copy in random
// order. It returns a new slice.
func
shuffleNodes
(
nodes
[]
api
.
Node
)
[]
api
.
Node
{
shuffled
:=
make
([]
api
.
Node
,
len
(
nodes
))
perm
:=
rand
.
Perm
(
len
(
nodes
))
for
i
,
j
:=
range
perm
{
shuffled
[
j
]
=
nodes
[
i
]
}
return
shuffled
}
func
(
config
*
NetworkingTestConfig
)
createNetProxyPods
(
podName
string
,
selector
map
[
string
]
string
)
[]
*
api
.
Pod
{
func
(
config
*
NetworkingTestConfig
)
createNetProxyPods
(
podName
string
,
selector
map
[
string
]
string
)
[]
*
api
.
Pod
{
framework
.
ExpectNoError
(
framework
.
WaitForAllNodesSchedulable
(
config
.
f
.
Client
))
framework
.
ExpectNoError
(
framework
.
WaitForAllNodesSchedulable
(
config
.
f
.
Client
))
nodes
:=
framework
.
GetReadySchedulableNodesOrDie
(
config
.
f
.
Client
)
nodeList
:=
framework
.
GetReadySchedulableNodesOrDie
(
config
.
f
.
Client
)
// To make this test work reasonably fast in large clusters,
// we limit the number of NetProxyPods to no more than 100 ones
// on random nodes.
nodes
:=
shuffleNodes
(
nodeList
.
Items
)
if
len
(
nodes
)
>
maxNetProxyPodsCount
{
nodes
=
nodes
[
:
maxNetProxyPodsCount
]
}
// create pods, one for each node
// create pods, one for each node
createdPods
:=
make
([]
*
api
.
Pod
,
0
,
len
(
nodes
.
Items
))
createdPods
:=
make
([]
*
api
.
Pod
,
0
,
len
(
nodes
))
for
i
,
n
:=
range
nodes
.
Items
{
for
i
,
n
:=
range
nodes
{
podName
:=
fmt
.
Sprintf
(
"%s-%d"
,
podName
,
i
)
podName
:=
fmt
.
Sprintf
(
"%s-%d"
,
podName
,
i
)
pod
:=
config
.
createNetShellPodSpec
(
podName
,
n
.
Name
)
pod
:=
config
.
createNetShellPodSpec
(
podName
,
n
.
Name
)
pod
.
ObjectMeta
.
Labels
=
selector
pod
.
ObjectMeta
.
Labels
=
selector
...
@@ -456,7 +478,7 @@ func (config *NetworkingTestConfig) createNetProxyPods(podName string, selector
...
@@ -456,7 +478,7 @@ func (config *NetworkingTestConfig) createNetProxyPods(podName string, selector
}
}
// wait that all of them are up
// wait that all of them are up
runningPods
:=
make
([]
*
api
.
Pod
,
0
,
len
(
nodes
.
Items
))
runningPods
:=
make
([]
*
api
.
Pod
,
0
,
len
(
nodes
))
for
_
,
p
:=
range
createdPods
{
for
_
,
p
:=
range
createdPods
{
framework
.
ExpectNoError
(
config
.
f
.
WaitForPodReady
(
p
.
Name
))
framework
.
ExpectNoError
(
config
.
f
.
WaitForPodReady
(
p
.
Name
))
rp
,
err
:=
config
.
getPodClient
()
.
Get
(
p
.
Name
)
rp
,
err
:=
config
.
getPodClient
()
.
Get
(
p
.
Name
)
...
...
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