Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
k8s-ingress
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
3
Merge Requests
3
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
uplex-varnish
k8s-ingress
Commits
ca3b99d8
Commit
ca3b99d8
authored
Jan 14, 2021
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Encapsulate getting Pod ns & name from an Endpoint TargetRef.
parent
a34a99bd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
14 deletions
+14
-14
endpoints.go
pkg/controller/endpoints.go
+10
-0
service.go
pkg/controller/service.go
+2
-8
utils.go
pkg/controller/utils.go
+2
-6
No files found.
pkg/controller/endpoints.go
View file @
ca3b99d8
...
...
@@ -128,3 +128,13 @@ func (worker *NamespaceWorker) getAllServiceEndpoints(
}
return
}
func
getTargetPod
(
epAddr
api_v1
.
EndpointAddress
)
(
string
,
string
)
{
ns
:=
""
name
:=
""
if
epAddr
.
TargetRef
!=
nil
{
ns
=
epAddr
.
TargetRef
.
Namespace
name
=
epAddr
.
TargetRef
.
Name
}
return
ns
,
name
}
pkg/controller/service.go
View file @
ca3b99d8
...
...
@@ -172,10 +172,7 @@ func epAddrs2VCLAddrs(
IP
:
epAddr
.
IP
,
Port
:
admPort
,
}
if
epAddr
.
TargetRef
!=
nil
{
vclAddr
.
PodNamespace
=
epAddr
.
TargetRef
.
Namespace
vclAddr
.
PodName
=
epAddr
.
TargetRef
.
Name
}
vclAddr
.
PodNamespace
,
vclAddr
.
PodName
=
getTargetPod
(
epAddr
)
vclAddrs
=
append
(
vclAddrs
,
vclAddr
)
}
return
vclAddrs
...
...
@@ -192,10 +189,7 @@ func epAddrs2OffldAddrs(
DataplanePort
:
dplanePort
,
CrtDnldrPort
:
crtDnldrPort
,
}
if
epAddr
.
TargetRef
!=
nil
{
offldAddr
.
PodNamespace
=
epAddr
.
TargetRef
.
Namespace
offldAddr
.
PodName
=
epAddr
.
TargetRef
.
Name
}
offldAddr
.
PodNamespace
,
offldAddr
.
PodName
=
getTargetPod
(
epAddr
)
offldAddrs
=
append
(
offldAddrs
,
offldAddr
)
}
return
offldAddrs
...
...
pkg/controller/utils.go
View file @
ca3b99d8
...
...
@@ -105,12 +105,8 @@ func endpsTargetPort2Addrs(
IP
:
address
.
IP
,
Port
:
port
.
Port
,
}
if
address
.
TargetRef
!=
nil
{
addr
.
PodNamespace
=
address
.
TargetRef
.
Namespace
addr
.
PodName
=
address
.
TargetRef
.
Name
}
addr
.
PodNamespace
,
addr
.
PodName
=
getTargetPod
(
address
)
addrs
=
append
(
addrs
,
addr
)
}
return
addrs
,
update
.
MakeSuccess
(
""
)
...
...
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