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
ed1f2d75
Commit
ed1f2d75
authored
Dec 10, 2015
by
Tim Hockin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deflake services e2e
Picking a nodePort needs to be more robust than "add one to an existing port and hope it works". Now we try all ports in the range if we have to.
parent
f1f250c6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
8 deletions
+15
-8
service.go
test/e2e/service.go
+15
-8
No files found.
test/e2e/service.go
View file @
ed1f2d75
...
@@ -504,15 +504,22 @@ var _ = Describe("Services", func() {
...
@@ -504,15 +504,22 @@ var _ = Describe("Services", func() {
By
(
"hitting the pod through the service's LoadBalancer"
)
By
(
"hitting the pod through the service's LoadBalancer"
)
testLoadBalancerReachable
(
ingress1
,
80
)
testLoadBalancerReachable
(
ingress1
,
80
)
By
(
"changing service "
+
serviceName
+
" update NodePort"
)
By
(
"changing service "
+
serviceName
+
": update NodePort"
)
nodePort2
:=
nodePort1
-
1
nodePort2
:=
0
if
!
ServiceNodePortRange
.
Contains
(
nodePort2
)
{
for
i
:=
1
;
i
<
ServiceNodePortRange
.
Size
;
i
++
{
//Check for (unlikely) assignment at bottom of range
offs1
:=
nodePort1
-
ServiceNodePortRange
.
Base
nodePort2
=
nodePort1
+
1
offs2
:=
(
offs1
+
i
)
%
ServiceNodePortRange
.
Size
nodePort2
:=
ServiceNodePortRange
.
Base
+
offs2
service
,
err
=
updateService
(
f
.
Client
,
f
.
Namespace
.
Name
,
serviceName
,
func
(
s
*
api
.
Service
)
{
s
.
Spec
.
Ports
[
0
]
.
NodePort
=
nodePort2
})
if
err
!=
nil
&&
strings
.
Contains
(
err
.
Error
(),
"provided port is already allocated"
)
{
Logf
(
"nodePort %d is busy, will retry"
,
nodePort2
)
continue
}
// Otherwise err was nil or err was a real error
break
}
}
service
,
err
=
updateService
(
f
.
Client
,
f
.
Namespace
.
Name
,
serviceName
,
func
(
s
*
api
.
Service
)
{
s
.
Spec
.
Ports
[
0
]
.
NodePort
=
nodePort2
})
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
if
service
.
Spec
.
Type
!=
api
.
ServiceTypeLoadBalancer
{
if
service
.
Spec
.
Type
!=
api
.
ServiceTypeLoadBalancer
{
...
...
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