mirror of
https://github.com/coredns/coredns.git
synced 2025-11-01 18:53:43 -04:00
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:
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user