mirror of
https://github.com/coredns/coredns.git
synced 2025-10-28 00:34:24 -04:00
plugin/k8s_external/kubernetes: handle NS records (#3160)
* fix external ns records * use k8s service name for ns record * update test, add func comment * expand nsAddrs() test cases * support local ipv6 ip * use less confusing pod ip in test
This commit is contained in:
committed by
Miek Gieben
parent
84988ce2c2
commit
338d148c78
@@ -12,11 +12,14 @@ func localPodIP() net.IP {
|
||||
|
||||
for _, addr := range addrs {
|
||||
ip, _, _ := net.ParseCIDR(addr.String())
|
||||
ip = ip.To4()
|
||||
if ip == nil || ip.IsLoopback() {
|
||||
continue
|
||||
ip4 := ip.To4()
|
||||
if ip4 != nil && !ip4.IsLoopback() {
|
||||
return ip4
|
||||
}
|
||||
ip6 := ip.To16()
|
||||
if ip6 != nil && !ip6.IsLoopback() {
|
||||
return ip6
|
||||
}
|
||||
return ip
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user