diff options
author | 2020-12-21 05:30:24 -0500 | |
---|---|---|
committer | 2020-12-21 02:30:24 -0800 | |
commit | 51c05679e69dacd745db2b1eb33be04d7b626959 (patch) | |
tree | 6ec0071b8378f31a0d96eeea4061e58723be2d6d /plugin/kubernetes/ns.go | |
parent | 302434e3928219138313610c7faf9be5cc598129 (diff) | |
download | coredns-51c05679e69dacd745db2b1eb33be04d7b626959.tar.gz coredns-51c05679e69dacd745db2b1eb33be04d7b626959.tar.zst coredns-51c05679e69dacd745db2b1eb33be04d7b626959.zip |
plugin/kubernetes: Add support for dual stack ClusterIP Services (#4339)
* support dual stack clusterIPs
Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
* stickler
Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
* fix ClusterIPs make
Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
Diffstat (limited to 'plugin/kubernetes/ns.go')
-rw-r--r-- | plugin/kubernetes/ns.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/plugin/kubernetes/ns.go b/plugin/kubernetes/ns.go index ba687cb13..84f4e344b 100644 --- a/plugin/kubernetes/ns.go +++ b/plugin/kubernetes/ns.go @@ -5,7 +5,6 @@ import ( "strings" "github.com/miekg/dns" - api "k8s.io/api/core/v1" ) func isDefaultNS(name, zone string) bool { @@ -37,7 +36,7 @@ func (k *Kubernetes) nsAddrs(external bool, zone string) []dns.RR { continue } svcName := strings.Join([]string{svc.Name, svc.Namespace, Svc, zone}, ".") - if svc.ClusterIP == api.ClusterIPNone { + if svc.Headless() { // For a headless service, use the endpoints IPs for _, s := range endpoint.Subsets { for _, a := range s.Addresses { @@ -46,8 +45,10 @@ func (k *Kubernetes) nsAddrs(external bool, zone string) []dns.RR { } } } else { - svcNames = append(svcNames, svcName) - svcIPs = append(svcIPs, net.ParseIP(svc.ClusterIP)) + for _, clusterIP := range svc.ClusterIPs { + svcNames = append(svcNames, svcName) + svcIPs = append(svcIPs, net.ParseIP(clusterIP)) + } } } } |