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
8b354556
Commit
8b354556
authored
Nov 07, 2015
by
Prashanth Balasubramanian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dump kubectl logs of Ingress controller at on e2e failure
parent
70d89a35
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
4 deletions
+39
-4
ingress.go
test/e2e/ingress.go
+39
-4
No files found.
test/e2e/ingress.go
View file @
8b354556
...
@@ -62,6 +62,9 @@ var (
...
@@ -62,6 +62,9 @@ var (
expectedLBCreationTime
=
7
*
time
.
Minute
expectedLBCreationTime
=
7
*
time
.
Minute
expectedLBHealthCheckTime
=
7
*
time
.
Minute
expectedLBHealthCheckTime
=
7
*
time
.
Minute
// Name of the loadbalancer controller within the cluster addon
lbContainerName
=
"l7-lb-controller"
// On average it takes ~6 minutes for a single backend to come online.
// On average it takes ~6 minutes for a single backend to come online.
// We *don't* expect this poll to consistently take 15 minutes for every
// We *don't* expect this poll to consistently take 15 minutes for every
// Ingress as GCE is creating/checking backends in parallel, but at the
// Ingress as GCE is creating/checking backends in parallel, but at the
...
@@ -201,6 +204,35 @@ func checkLeakedResources() error {
...
@@ -201,6 +204,35 @@ func checkLeakedResources() error {
return
nil
return
nil
}
}
// run kubectl log on the L7 controller pod.
func
kubectlLogLBController
(
c
*
client
.
Client
)
{
selector
:=
labels
.
SelectorFromSet
(
labels
.
Set
(
map
[
string
]
string
{
"name"
:
"glbc"
}))
podList
,
err
:=
c
.
Pods
(
api
.
NamespaceAll
)
.
List
(
selector
,
fields
.
Everything
())
if
err
!=
nil
{
Logf
(
"Cannot log L7 controller output, error listing pods %v"
,
err
)
return
}
if
len
(
podList
.
Items
)
==
0
{
Logf
(
"Loadbalancer controller pod not found"
)
return
}
for
_
,
p
:=
range
podList
.
Items
{
Logf
(
"
\n
Last 100 log lines of %v
\n
"
,
p
.
Name
)
Logf
(
runKubectl
(
"logs"
,
p
.
Name
,
"--namespace=kube-system"
,
"-c"
,
lbContainerName
,
"--tail=100"
))
}
}
// dumpDebugAndFail dumps verbose debug output before failing.
func
dumpDebugAndFail
(
err
string
,
ns
string
,
c
*
client
.
Client
)
{
kubectlLogLBController
(
c
)
Logf
(
"
\n
Output of kubectl describe ing:
\n
"
)
// TODO: runKubectl will hard fail if kubectl fails, swap it out for
// something more befitting for a debug dumper.
Logf
(
runKubectl
(
"describe"
,
"ing"
,
fmt
.
Sprintf
(
"--namespace=%v"
,
ns
)))
Failf
(
err
)
}
var
_
=
Describe
(
"GCE L7 LoadBalancer Controller"
,
func
()
{
var
_
=
Describe
(
"GCE L7 LoadBalancer Controller"
,
func
()
{
// These variables are initialized after framework's beforeEach.
// These variables are initialized after framework's beforeEach.
var
ns
string
var
ns
string
...
@@ -268,6 +300,9 @@ var _ = Describe("GCE L7 LoadBalancer Controller", func() {
...
@@ -268,6 +300,9 @@ var _ = Describe("GCE L7 LoadBalancer Controller", func() {
// Wait for the loadbalancer IP.
// Wait for the loadbalancer IP.
start
:=
time
.
Now
()
start
:=
time
.
Now
()
address
,
err
:=
waitForIngressAddress
(
client
,
ing
.
Namespace
,
ing
.
Name
,
lbPollTimeout
)
address
,
err
:=
waitForIngressAddress
(
client
,
ing
.
Namespace
,
ing
.
Name
,
lbPollTimeout
)
if
err
!=
nil
{
dumpDebugAndFail
(
fmt
.
Sprintf
(
"Ingress failed to acquire an IP address within %v"
,
lbPollTimeout
),
ns
,
client
)
}
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
By
(
fmt
.
Sprintf
(
"Found address %v for ingress %v, took %v to come online"
,
By
(
fmt
.
Sprintf
(
"Found address %v for ingress %v, took %v to come online"
,
address
,
ing
.
Name
,
time
.
Since
(
start
)))
address
,
ing
.
Name
,
time
.
Since
(
start
)))
...
@@ -295,8 +330,8 @@ var _ = Describe("GCE L7 LoadBalancer Controller", func() {
...
@@ -295,8 +330,8 @@ var _ = Describe("GCE L7 LoadBalancer Controller", func() {
return
true
,
nil
return
true
,
nil
})
})
if
pollErr
!=
nil
{
if
pollErr
!=
nil
{
Fail
f
(
"Failed to execute a successful GET within %v, Last response body for %v, host %v:
\n
%v
\n\n
%v"
,
dumpDebugAndFail
(
fmt
.
Sprint
f
(
"Failed to execute a successful GET within %v, Last response body for %v, host %v:
\n
%v
\n\n
%v"
,
lbPollTimeout
,
route
,
rules
.
Host
,
lastBody
,
pollErr
)
lbPollTimeout
,
route
,
rules
.
Host
,
lastBody
,
pollErr
)
,
ns
,
client
)
}
}
rt
:=
time
.
Since
(
GETStart
)
rt
:=
time
.
Since
(
GETStart
)
By
(
fmt
.
Sprintf
(
"Route %v host %v took %v to respond"
,
route
,
rules
.
Host
,
rt
))
By
(
fmt
.
Sprintf
(
"Route %v host %v took %v to respond"
,
route
,
rules
.
Host
,
rt
))
...
@@ -310,12 +345,12 @@ var _ = Describe("GCE L7 LoadBalancer Controller", func() {
...
@@ -310,12 +345,12 @@ var _ = Describe("GCE L7 LoadBalancer Controller", func() {
sort
.
Sort
(
timeSlice
(
creationTimes
))
sort
.
Sort
(
timeSlice
(
creationTimes
))
perc50
:=
creationTimes
[
len
(
creationTimes
)
/
2
]
perc50
:=
creationTimes
[
len
(
creationTimes
)
/
2
]
if
perc50
>
expectedLBCreationTime
{
if
perc50
>
expectedLBCreationTime
{
Failf
(
"Average creation time is too high: %+v"
,
creationTimes
)
dumpDebugAndFail
(
fmt
.
Sprintf
(
"Average creation time is too high: %+v"
,
creationTimes
),
ns
,
client
)
}
}
sort
.
Sort
(
timeSlice
(
responseTimes
))
sort
.
Sort
(
timeSlice
(
responseTimes
))
perc50
=
responseTimes
[
len
(
responseTimes
)
/
2
]
perc50
=
responseTimes
[
len
(
responseTimes
)
/
2
]
if
perc50
>
expectedLBHealthCheckTime
{
if
perc50
>
expectedLBHealthCheckTime
{
Failf
(
"Average startup time is too high: %+v"
,
responseTimes
)
dumpDebugAndFail
(
fmt
.
Sprintf
(
"Average startup time is too high: %+v"
,
responseTimes
),
ns
,
client
)
}
}
})
})
})
})
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