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:
parent
84988ce2c2
commit
338d148c78
6 changed files with 180 additions and 70 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue