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
101dde0c
Commit
101dde0c
authored
May 15, 2018
by
Ashley Gau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check for NEG healthcheck with correct name
parent
7d9725e9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
8 deletions
+29
-8
ingress_utils.go
test/e2e/framework/ingress_utils.go
+29
-8
No files found.
test/e2e/framework/ingress_utils.go
View file @
101dde0c
...
...
@@ -924,32 +924,53 @@ func (cont *GCEIngressController) backendMode(svcPorts map[string]v1.ServicePort
return
false
,
fmt
.
Errorf
(
"failed to list backend services: %v"
,
err
)
}
hcList
,
err
:=
gceCloud
.
ListHealthChecks
()
if
err
!=
nil
{
return
false
,
fmt
.
Errorf
(
"failed to list health checks: %v"
,
err
)
}
uid
:=
cont
.
UID
if
len
(
uid
)
>
8
{
uid
=
uid
[
:
8
]
}
matchingBackendService
:=
0
for
_
,
bs
:=
range
beList
{
for
svcName
,
sp
:=
range
svcPorts
{
match
:=
false
for
svcName
,
sp
:=
range
svcPorts
{
// Non-NEG BackendServices are named with the Nodeport in the name.
// NEG BackendServices' names contain the a sha256 hash of a string.
negString
:=
strings
.
Join
([]
string
{
uid
,
cont
.
Ns
,
svcName
,
sp
.
TargetPort
.
String
()},
";"
)
negHash
:=
fmt
.
Sprintf
(
"%x"
,
sha256
.
Sum256
([]
byte
(
negString
)))[
:
8
]
bsMatch
:=
&
compute
.
BackendService
{}
// Non-NEG BackendServices are named with the Nodeport in the name.
// NEG BackendServices' names contain the a sha256 hash of a string.
negString
:=
strings
.
Join
([]
string
{
uid
,
cont
.
Ns
,
svcName
,
sp
.
TargetPort
.
String
()},
";"
)
negHash
:=
fmt
.
Sprintf
(
"%x"
,
sha256
.
Sum256
([]
byte
(
negString
)))[
:
8
]
for
_
,
bs
:=
range
beList
{
if
strings
.
Contains
(
bs
.
Name
,
strconv
.
Itoa
(
int
(
sp
.
NodePort
)))
||
strings
.
Contains
(
bs
.
Name
,
negHash
)
{
match
=
true
bsMatch
=
bs
matchingBackendService
+=
1
break
}
}
if
match
{
for
_
,
be
:=
range
bs
.
Backends
{
for
_
,
be
:=
range
bs
Match
.
Backends
{
if
!
strings
.
Contains
(
be
.
Group
,
keyword
)
{
return
false
,
nil
}
}
// Check that the correct HealthCheck exists for the BackendService
hcMatch
:=
false
for
_
,
hc
:=
range
hcList
{
if
hc
.
Name
==
bsMatch
.
Name
{
hcMatch
=
true
break
}
}
if
!
hcMatch
{
return
false
,
fmt
.
Errorf
(
"missing healthcheck for backendservice: %v"
,
bsMatch
.
Name
)
}
}
}
return
matchingBackendService
==
len
(
svcPorts
),
nil
...
...
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