aboutsummaryrefslogtreecommitdiff
path: root/plugin/backend_lookup.go
diff options
context:
space:
mode:
authorGravatar Chris O'Haver <cohaver@infoblox.com> 2019-09-05 09:07:55 -0400
committerGravatar GitHub <noreply@github.com> 2019-09-05 09:07:55 -0400
commit630d3d60b9fa3b9c1f070e4aa0504e50a85d70c2 (patch)
treeb9b95d55ecca3964142f6d064b48065f1cb5128b /plugin/backend_lookup.go
parentd79562842aacfa5808ec0b8d160d720470ece060 (diff)
downloadcoredns-630d3d60b9fa3b9c1f070e4aa0504e50a85d70c2.tar.gz
coredns-630d3d60b9fa3b9c1f070e4aa0504e50a85d70c2.tar.zst
coredns-630d3d60b9fa3b9c1f070e4aa0504e50a85d70c2.zip
plugin/kubernetes: Handle multiple local IPs and bind (#3208)
* use all local IPs * mult/bind ips * gofmt + boundIPs fix * fix no matching endpoint case * don't duplicate NS records in answer * fix answer dedup * fix comment * add multi local ip test case
Diffstat (limited to 'plugin/backend_lookup.go')
-rw-r--r--plugin/backend_lookup.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/plugin/backend_lookup.go b/plugin/backend_lookup.go
index 096cf806b..9e5c9eeec 100644
--- a/plugin/backend_lookup.go
+++ b/plugin/backend_lookup.go
@@ -372,6 +372,8 @@ func NS(ctx context.Context, b ServiceBackend, zone string, state request.Reques
// ... and reset
state.Req.Question[0].Name = old
+ seen := map[string]bool{}
+
for _, serv := range services {
what, ip := serv.HostType()
switch what {
@@ -380,8 +382,13 @@ func NS(ctx context.Context, b ServiceBackend, zone string, state request.Reques
case dns.TypeA, dns.TypeAAAA:
serv.Host = msg.Domain(serv.Key)
- records = append(records, serv.NewNS(state.QName()))
extra = append(extra, newAddress(serv, serv.Host, ip, what))
+ ns := serv.NewNS(state.QName())
+ if _, ok := seen[ns.Ns]; ok {
+ continue
+ }
+ seen[ns.Ns] = true
+ records = append(records, ns)
}
}
return records, extra, nil