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>
This commit is contained in:
Chris O'Haver
2020-12-21 05:30:24 -05:00
committed by GitHub
parent 302434e392
commit 51c05679e6
14 changed files with 204 additions and 111 deletions

View File

@@ -50,13 +50,16 @@ func (k *Kubernetes) Transfer(zone string, serial uint32) (<-chan []dns.RR, erro
switch svc.Type {
case api.ServiceTypeClusterIP, api.ServiceTypeNodePort, api.ServiceTypeLoadBalancer:
clusterIP := net.ParseIP(svc.ClusterIP)
clusterIP := net.ParseIP(svc.ClusterIPs[0])
if clusterIP != nil {
s := msg.Service{Host: svc.ClusterIP, TTL: k.ttl}
s.Key = strings.Join(svcBase, "/")
var host string
for _, ip := range svc.ClusterIPs {
s := msg.Service{Host: ip, TTL: k.ttl}
s.Key = strings.Join(svcBase, "/")
// Change host from IP to Name for SRV records
host := emitAddressRecord(ch, s)
// Change host from IP to Name for SRV records
host = emitAddressRecord(ch, s)
}
for _, p := range svc.Ports {
s := msg.Service{Host: host, Port: int(p.Port), TTL: k.ttl}