From 5d6abf59ffe5c6e06fafffd4142abd1d77df626b Mon Sep 17 00:00:00 2001 From: Girish Kalele Date: Tue, 9 Aug 2016 10:05:29 -0700 Subject: [PATCH] kube-proxy: Propagate hostname to iptables proxier --- cmd/kube-proxy/app/server.go | 2 +- pkg/proxy/iptables/proxier.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/kube-proxy/app/server.go b/cmd/kube-proxy/app/server.go index 261181f2acc..609cc26cb39 100644 --- a/cmd/kube-proxy/app/server.go +++ b/cmd/kube-proxy/app/server.go @@ -205,7 +205,7 @@ func NewProxyServerDefault(config *options.ProxyServerConfig) (*ProxyServer, err return nil, fmt.Errorf("Unable to read IPTablesMasqueradeBit from config") } - proxierIptables, err := iptables.NewProxier(iptInterface, execer, config.IPTablesSyncPeriod.Duration, config.MasqueradeAll, int(*config.IPTablesMasqueradeBit), config.ClusterCIDR) + proxierIptables, err := iptables.NewProxier(iptInterface, execer, config.IPTablesSyncPeriod.Duration, config.MasqueradeAll, int(*config.IPTablesMasqueradeBit), config.ClusterCIDR, hostname) if err != nil { glog.Fatalf("Unable to create proxier: %v", err) } diff --git a/pkg/proxy/iptables/proxier.go b/pkg/proxy/iptables/proxier.go index 7ef1c0ce4cb..197d0779d85 100644 --- a/pkg/proxy/iptables/proxier.go +++ b/pkg/proxy/iptables/proxier.go @@ -163,6 +163,7 @@ type Proxier struct { masqueradeMark string exec utilexec.Interface clusterCIDR string + hostname string } type localPort struct { @@ -188,7 +189,7 @@ var _ proxy.ProxyProvider = &Proxier{} // An error will be returned if iptables fails to update or acquire the initial lock. // Once a proxier is created, it will keep iptables up to date in the background and // will not terminate if a particular iptables call fails. -func NewProxier(ipt utiliptables.Interface, exec utilexec.Interface, syncPeriod time.Duration, masqueradeAll bool, masqueradeBit int, clusterCIDR string) (*Proxier, error) { +func NewProxier(ipt utiliptables.Interface, exec utilexec.Interface, syncPeriod time.Duration, masqueradeAll bool, masqueradeBit int, clusterCIDR string, hostname string) (*Proxier, error) { // Set the route_localnet sysctl we need for if err := utilsysctl.SetSysctl(sysctlRouteLocalnet, 1); err != nil { return nil, fmt.Errorf("can't set sysctl %s: %v", sysctlRouteLocalnet, err) @@ -218,6 +219,7 @@ func NewProxier(ipt utiliptables.Interface, exec utilexec.Interface, syncPeriod masqueradeMark: masqueradeMark, exec: exec, clusterCIDR: clusterCIDR, + hostname: hostname, }, nil }