diff options
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)) + } } } } |