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:
parent
302434e392
commit
51c05679e6
14 changed files with 204 additions and 111 deletions
|
@ -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))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue