fix IPV6 judgement bug and add UTs

This commit is contained in:
m1093782566
2017-10-30 13:51:14 +08:00
parent 5ad34ac60a
commit 28000f925f
4 changed files with 109 additions and 8 deletions

View File

@@ -1343,7 +1343,7 @@ func (proxier *Proxier) syncProxyRules() {
// This is very low impact. The NodePort range is intentionally obscure, and unlikely to actually collide with real Services.
// This only affects UDP connections, which are not common.
// See issue: https://github.com/kubernetes/kubernetes/issues/49881
isIPv6 := svcInfo.clusterIP.To4() != nil
isIPv6 := utilproxy.IsIPv6(svcInfo.clusterIP)
err := utilproxy.ClearUDPConntrackForPort(proxier.exec, lp.Port, isIPv6)
if err != nil {
glog.Errorf("Failed to clear udp conntrack for port %d, error: %v", lp.Port, err)