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
e3328286
Commit
e3328286
authored
May 26, 2017
by
Zihong Zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apply KubeProxyEndpointLagTimeout to ESIPP tests
parent
7bc6da0b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
24 deletions
+27
-24
service_util.go
test/e2e/framework/service_util.go
+20
-10
service.go
test/e2e/service.go
+7
-14
No files found.
test/e2e/framework/service_util.go
View file @
e3328286
...
@@ -50,6 +50,10 @@ const (
...
@@ -50,6 +50,10 @@ const (
// liberal. Fix tracked in #20567.
// liberal. Fix tracked in #20567.
KubeProxyLagTimeout
=
5
*
time
.
Minute
KubeProxyLagTimeout
=
5
*
time
.
Minute
// KubeProxyEndpointLagTimeout is the maximum time a kube-proxy daemon on a node is allowed
// to not notice an Endpoint update.
KubeProxyEndpointLagTimeout
=
30
*
time
.
Second
// LoadBalancerLagTimeoutDefault is the maximum time a load balancer is allowed to
// LoadBalancerLagTimeoutDefault is the maximum time a load balancer is allowed to
// not respond after creation.
// not respond after creation.
LoadBalancerLagTimeoutDefault
=
2
*
time
.
Minute
LoadBalancerLagTimeoutDefault
=
2
*
time
.
Minute
...
@@ -733,18 +737,24 @@ func testHTTPHealthCheckNodePort(ip string, port int, request string) (bool, err
...
@@ -733,18 +737,24 @@ func testHTTPHealthCheckNodePort(ip string, port int, request string) (bool, err
return
false
,
fmt
.
Errorf
(
"Unexpected HTTP response code %s from health check responder at %s"
,
resp
.
Status
,
url
)
return
false
,
fmt
.
Errorf
(
"Unexpected HTTP response code %s from health check responder at %s"
,
resp
.
Status
,
url
)
}
}
func
(
j
*
ServiceTestJig
)
TestHTTPHealthCheckNodePort
(
host
string
,
port
int
,
request
string
,
tries
int
)
(
pass
,
fail
int
,
statusMsg
string
)
{
func
(
j
*
ServiceTestJig
)
TestHTTPHealthCheckNodePort
(
host
string
,
port
int
,
request
string
,
timeout
time
.
Duration
,
expectSucceed
bool
,
threshold
int
)
error
{
for
i
:=
0
;
i
<
tries
;
i
++
{
count
:=
0
success
,
err
:=
testHTTPHealthCheckNodePort
(
host
,
port
,
request
)
condition
:=
func
()
(
bool
,
error
)
{
if
success
{
success
,
_
:=
testHTTPHealthCheckNodePort
(
host
,
port
,
request
)
pass
++
if
success
&&
expectSucceed
||
}
else
{
!
success
&&
!
expectSucceed
{
fail
++
count
++
}
if
count
>=
threshold
{
return
true
,
nil
}
}
statusMsg
+=
fmt
.
Sprintf
(
"
\n
Attempt %d Error %v"
,
i
,
err
)
return
false
,
nil
time
.
Sleep
(
1
*
time
.
Second
)
}
if
err
:=
wait
.
PollImmediate
(
time
.
Second
,
timeout
,
condition
);
err
!=
nil
{
return
fmt
.
Errorf
(
"error waiting for healthCheckNodePort: expected at least %d succeed=%v on %v%v, got %d"
,
threshold
,
expectSucceed
,
host
,
port
,
count
)
}
}
return
pass
,
fail
,
statusMsg
return
nil
}
}
// Simple helper class to avoid too much boilerplate in tests
// Simple helper class to avoid too much boilerplate in tests
...
...
test/e2e/service.go
View file @
e3328286
...
@@ -1287,12 +1287,9 @@ var _ = framework.KubeDescribe("ESIPP [Slow]", func() {
...
@@ -1287,12 +1287,9 @@ var _ = framework.KubeDescribe("ESIPP [Slow]", func() {
jig
.
ChangeServiceType
(
svc
.
Namespace
,
svc
.
Name
,
v1
.
ServiceTypeClusterIP
,
loadBalancerCreateTimeout
)
jig
.
ChangeServiceType
(
svc
.
Namespace
,
svc
.
Name
,
v1
.
ServiceTypeClusterIP
,
loadBalancerCreateTimeout
)
// Make sure we didn't leak the health check node port.
// Make sure we didn't leak the health check node port.
for
name
,
ips
:=
range
jig
.
GetEndpointNodes
(
svc
)
{
threshold
:=
2
_
,
fail
,
status
:=
jig
.
TestHTTPHealthCheckNodePort
(
ips
[
0
],
healthCheckNodePort
,
"/healthz"
,
5
)
for
_
,
ips
:=
range
jig
.
GetEndpointNodes
(
svc
)
{
if
fail
<
2
{
Expect
(
jig
.
TestHTTPHealthCheckNodePort
(
ips
[
0
],
healthCheckNodePort
,
"/healthz"
,
framework
.
KubeProxyEndpointLagTimeout
,
false
,
threshold
))
.
NotTo
(
HaveOccurred
())
framework
.
Failf
(
"Health check node port %v not released on node %v: %v"
,
healthCheckNodePort
,
name
,
status
)
}
break
}
}
Expect
(
cs
.
Core
()
.
Services
(
svc
.
Namespace
)
.
Delete
(
svc
.
Name
,
nil
))
.
NotTo
(
HaveOccurred
())
Expect
(
cs
.
Core
()
.
Services
(
svc
.
Namespace
)
.
Delete
(
svc
.
Name
,
nil
))
.
NotTo
(
HaveOccurred
())
}()
}()
...
@@ -1379,16 +1376,12 @@ var _ = framework.KubeDescribe("ESIPP [Slow]", func() {
...
@@ -1379,16 +1376,12 @@ var _ = framework.KubeDescribe("ESIPP [Slow]", func() {
// HealthCheck should pass only on the node where num(endpoints) > 0
// HealthCheck should pass only on the node where num(endpoints) > 0
// All other nodes should fail the healthcheck on the service healthCheckNodePort
// All other nodes should fail the healthcheck on the service healthCheckNodePort
for
n
,
publicIP
:=
range
ips
{
for
n
,
publicIP
:=
range
ips
{
// Make sure the loadbalancer picked up the health check change.
// Confirm traffic can reach backend through LB before checking healthcheck nodeport.
jig
.
TestReachableHTTP
(
ingressIP
,
svcTCPPort
,
framework
.
KubeProxyLagTimeout
)
expectedSuccess
:=
nodes
.
Items
[
n
]
.
Name
==
endpointNodeName
expectedSuccess
:=
nodes
.
Items
[
n
]
.
Name
==
endpointNodeName
framework
.
Logf
(
"Health checking %s, http://%s:%d%s, expectedSuccess %v"
,
nodes
.
Items
[
n
]
.
Name
,
publicIP
,
healthCheckNodePort
,
path
,
expectedSuccess
)
framework
.
Logf
(
"Health checking %s, http://%s:%d%s, expectedSuccess %v"
,
nodes
.
Items
[
n
]
.
Name
,
publicIP
,
healthCheckNodePort
,
path
,
expectedSuccess
)
pass
,
fail
,
err
:=
jig
.
TestHTTPHealthCheckNodePort
(
publicIP
,
healthCheckNodePort
,
path
,
5
)
Expect
(
jig
.
TestHTTPHealthCheckNodePort
(
publicIP
,
healthCheckNodePort
,
path
,
framework
.
KubeProxyEndpointLagTimeout
,
expectedSuccess
,
threshold
))
.
NotTo
(
HaveOccurred
())
if
expectedSuccess
&&
pass
<
threshold
{
framework
.
Failf
(
"Expected %d successes on %v%v, got %d, err %v"
,
threshold
,
endpointNodeName
,
path
,
pass
,
err
)
}
else
if
!
expectedSuccess
&&
fail
<
threshold
{
framework
.
Failf
(
"Expected %d failures on %v%v, got %d, err %v"
,
threshold
,
endpointNodeName
,
path
,
fail
,
err
)
}
// Make sure the loadbalancer picked up the helth check change
jig
.
TestReachableHTTP
(
ingressIP
,
svcTCPPort
,
framework
.
KubeProxyLagTimeout
)
}
}
framework
.
ExpectNoError
(
framework
.
DeleteRCAndPods
(
f
.
ClientSet
,
f
.
InternalClientset
,
namespace
,
serviceName
))
framework
.
ExpectNoError
(
framework
.
DeleteRCAndPods
(
f
.
ClientSet
,
f
.
InternalClientset
,
namespace
,
serviceName
))
}
}
...
...
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