aboutsummaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorGravatar Chris O'Haver <cohaver@infoblox.com> 2019-09-08 03:28:30 -0400
committerGravatar Miek Gieben <miek@miek.nl> 2019-09-08 08:28:30 +0100
commit70f2bd1dfffcb8ab725dd459daa6ec11a4269391 (patch)
tree06fe8b703f1377184355cc317efabaa309c63c6f /plugin
parentacabfc5e9eb1443709352571ebf55880e94cfa8a (diff)
downloadcoredns-70f2bd1dfffcb8ab725dd459daa6ec11a4269391.tar.gz
coredns-70f2bd1dfffcb8ab725dd459daa6ec11a4269391.tar.zst
coredns-70f2bd1dfffcb8ab725dd459daa6ec11a4269391.zip
dont duplicate service recrod for every port (#3240)
Diffstat (limited to 'plugin')
-rw-r--r--plugin/kubernetes/xfr.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/plugin/kubernetes/xfr.go b/plugin/kubernetes/xfr.go
index 7ea99fd8d..9ad6c9aca 100644
--- a/plugin/kubernetes/xfr.go
+++ b/plugin/kubernetes/xfr.go
@@ -110,14 +110,15 @@ func (k *Kubernetes) transfer(c chan dns.RR, zone string) {
case api.ServiceTypeClusterIP, api.ServiceTypeNodePort, api.ServiceTypeLoadBalancer:
clusterIP := net.ParseIP(svc.ClusterIP)
if clusterIP != nil {
- for _, p := range svc.Ports {
+ s := msg.Service{Host: svc.ClusterIP, TTL: k.ttl}
+ s.Key = strings.Join(svcBase, "/")
- s := msg.Service{Host: svc.ClusterIP, Port: int(p.Port), TTL: k.ttl}
- s.Key = strings.Join(svcBase, "/")
+ // Change host from IP to Name for SRV records
+ host := emitAddressRecord(c, s)
- // Change host from IP to Name for SRV records
- host := emitAddressRecord(c, s)
- s.Host = host
+ for _, p := range svc.Ports {
+ s := msg.Service{Host: host, Port: int(p.Port), TTL: k.ttl}
+ s.Key = strings.Join(svcBase, "/")
// Need to generate this to handle use cases for peer-finder
// ref: https://github.com/coredns/coredns/pull/823