Merge pull request #46678 from tacy/fix46039

Automatic merge from submit-queue

fix#46039: iptables proxier need use '--bind-address' if set

**What this PR does / why we need it**: 
iptables proxier need use '--bind-address' if set

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #46039 

**Special notes for your reviewer**:

**Release note**:

```release-note
```
This commit is contained in:
Kubernetes Submit Queue 2017-06-12 20:11:22 -07:00 committed by GitHub
commit 117b6248ef

View File

@ -472,6 +472,12 @@ func NewProxyServer(config *componentconfig.KubeProxyConfiguration, cleanupAndEx
proxyMode := getProxyMode(string(config.Mode), iptInterface, iptables.LinuxKernelCompatTester{})
if proxyMode == proxyModeIPTables {
glog.V(0).Info("Using iptables Proxier.")
var nodeIP net.IP
if config.BindAddress != "0.0.0.0" {
nodeIP = net.ParseIP(config.BindAddress)
} else {
nodeIP = getNodeIP(client, hostname)
}
if config.IPTables.MasqueradeBit == nil {
// MasqueradeBit must be specified or defaulted.
return nil, fmt.Errorf("unable to read IPTables MasqueradeBit from config")
@ -488,7 +494,7 @@ func NewProxyServer(config *componentconfig.KubeProxyConfiguration, cleanupAndEx
int(*config.IPTables.MasqueradeBit),
config.ClusterCIDR,
hostname,
getNodeIP(client, hostname),
nodeIP,
recorder,
healthzServer,
)