Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
Coredns
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Railgun
Coredns
Commits
bd83f74d
Commit
bd83f74d
authored
Jun 09, 2019
by
Chris O'Haver
Committed by
Miek Gieben
Jun 09, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove unused functions (#2873)
parent
458e7781
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
97 deletions
+0
-97
plugin/kubernetes/kubernetes.go
plugin/kubernetes/kubernetes.go
+0
-27
plugin/kubernetes/kubernetes_test.go
plugin/kubernetes/kubernetes_test.go
+0
-70
No files found.
plugin/kubernetes/kubernetes.go
View file @
bd83f74d
...
@@ -271,33 +271,6 @@ func (k *Kubernetes) Records(ctx context.Context, state request.Request, exact b
...
@@ -271,33 +271,6 @@ func (k *Kubernetes) Records(ctx context.Context, state request.Request, exact b
return
services
,
err
return
services
,
err
}
}
// serviceFQDN returns the k8s cluster dns spec service FQDN for the service (or endpoint) object.
func
serviceFQDN
(
obj
meta
.
Object
,
zone
string
)
string
{
return
dnsutil
.
Join
(
obj
.
GetName
(),
obj
.
GetNamespace
(),
Svc
,
zone
)
}
// podFQDN returns the k8s cluster dns spec FQDN for the pod.
func
podFQDN
(
p
*
object
.
Pod
,
zone
string
)
string
{
if
strings
.
Contains
(
p
.
PodIP
,
"."
)
{
name
:=
strings
.
Replace
(
p
.
PodIP
,
"."
,
"-"
,
-
1
)
return
dnsutil
.
Join
(
name
,
p
.
GetNamespace
(),
Pod
,
zone
)
}
name
:=
strings
.
Replace
(
p
.
PodIP
,
":"
,
"-"
,
-
1
)
return
dnsutil
.
Join
(
name
,
p
.
GetNamespace
(),
Pod
,
zone
)
}
// endpointFQDN returns a list of k8s cluster dns spec service FQDNs for each subset in the endpoint.
func
endpointFQDN
(
ep
*
object
.
Endpoints
,
zone
string
,
endpointNameMode
bool
)
[]
string
{
var
names
[]
string
for
_
,
ss
:=
range
ep
.
Subsets
{
for
_
,
addr
:=
range
ss
.
Addresses
{
names
=
append
(
names
,
dnsutil
.
Join
(
endpointHostname
(
addr
,
endpointNameMode
),
serviceFQDN
(
ep
,
zone
)))
}
}
return
names
}
func
endpointHostname
(
addr
object
.
EndpointAddress
,
endpointNameMode
bool
)
string
{
func
endpointHostname
(
addr
object
.
EndpointAddress
,
endpointNameMode
bool
)
string
{
if
addr
.
Hostname
!=
""
{
if
addr
.
Hostname
!=
""
{
return
addr
.
Hostname
return
addr
.
Hostname
...
...
plugin/kubernetes/kubernetes_test.go
View file @
bd83f74d
...
@@ -355,73 +355,3 @@ func TestServicesAuthority(t *testing.T) {
...
@@ -355,73 +355,3 @@ func TestServicesAuthority(t *testing.T) {
}
}
}
}
}
}
func
TestServiceFQDN
(
t
*
testing
.
T
)
{
fqdn
:=
serviceFQDN
(
&
object
.
Service
{
Name
:
"svc1"
,
Namespace
:
"testns"
,
},
"cluster.local"
)
expected
:=
"svc1.testns.svc.cluster.local."
if
fqdn
!=
expected
{
t
.
Errorf
(
"Expected '%v', got '%v'."
,
expected
,
fqdn
)
}
}
func
TestPodFQDN
(
t
*
testing
.
T
)
{
fqdn
:=
podFQDN
(
&
object
.
Pod
{
Name
:
"pod1"
,
Namespace
:
"testns"
,
PodIP
:
"10.10.0.10"
,
},
"cluster.local"
)
expected
:=
"10-10-0-10.testns.pod.cluster.local."
if
fqdn
!=
expected
{
t
.
Errorf
(
"Expected '%v', got '%v'."
,
expected
,
fqdn
)
}
fqdn
=
podFQDN
(
&
object
.
Pod
{
Name
:
"pod1"
,
Namespace
:
"testns"
,
PodIP
:
"aaaa:bbbb:cccc::zzzz"
,
},
"cluster.local"
)
expected
=
"aaaa-bbbb-cccc--zzzz.testns.pod.cluster.local."
if
fqdn
!=
expected
{
t
.
Errorf
(
"Expected '%v', got '%v'."
,
expected
,
fqdn
)
}
}
func
TestEndpointFQDN
(
t
*
testing
.
T
)
{
fqdns
:=
endpointFQDN
(
&
object
.
Endpoints
{
Subsets
:
[]
object
.
EndpointSubset
{
{
Addresses
:
[]
object
.
EndpointAddress
{
{
IP
:
"172.0.0.1"
,
Hostname
:
"ep1a"
,
},
{
IP
:
"172.0.0.2"
,
},
},
},
},
Name
:
"svc1"
,
Namespace
:
"testns"
,
},
"cluster.local"
,
false
)
expected
:=
[]
string
{
"ep1a.svc1.testns.svc.cluster.local."
,
"172-0-0-2.svc1.testns.svc.cluster.local."
,
}
for
i
:=
range
fqdns
{
if
fqdns
[
i
]
!=
expected
[
i
]
{
t
.
Errorf
(
"Expected '%v', got '%v'."
,
expected
[
i
],
fqdns
[
i
])
}
}
}
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