set config.BindAddress to IPv4 address "127.0.0.1" if not specified

Signed-off-by: Zou Nengren <zouyee1989@gmail.com>
This commit is contained in:
zouyee
2019-10-25 21:46:41 +08:00
parent a3560d3ad9
commit a3e0ac2951
4 changed files with 11 additions and 14 deletions

View File

@@ -18,6 +18,7 @@ package kubemark
import (
"fmt"
"net"
"time"
v1 "k8s.io/api/core/v1"
@@ -77,6 +78,11 @@ func NewHollowProxyOrDie(
var err error
if useRealProxier {
nodeIP := utilnode.GetNodeIP(client, nodeName)
if nodeIP == nil {
klog.V(0).Infof("can't determine this node's IP, assuming 127.0.0.1")
nodeIP = net.ParseIP("127.0.0.1")
}
// Real proxier with fake iptables, sysctl, etc underneath it.
//var err error
proxier, err = iptables.NewProxier(
@@ -89,7 +95,7 @@ func NewHollowProxyOrDie(
0,
"10.0.0.0/8",
nodeName,
utilnode.GetNodeIP(client, nodeName),
nodeIP,
recorder,
nil,
[]string{},