Commit 215e8fab authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #48516 from freehan/shared-iptables

Automatic merge from submit-queue (batch tested with PRs 48698, 48712, 48516, 48734, 48735) share iptables util client within kubenet reduce the number of goroutine waiting for dbus.
parents 0912abb2 0c2ceeb8
...@@ -19,8 +19,6 @@ go_library( ...@@ -19,8 +19,6 @@ go_library(
tags = ["automanaged"], tags = ["automanaged"],
deps = [ deps = [
"//pkg/proxy/iptables:go_default_library", "//pkg/proxy/iptables:go_default_library",
"//pkg/util/dbus:go_default_library",
"//pkg/util/exec:go_default_library",
"//pkg/util/iptables:go_default_library", "//pkg/util/iptables:go_default_library",
"//vendor/github.com/golang/glog:go_default_library", "//vendor/github.com/golang/glog:go_default_library",
"//vendor/k8s.io/api/core/v1:go_default_library", "//vendor/k8s.io/api/core/v1:go_default_library",
......
...@@ -27,8 +27,6 @@ import ( ...@@ -27,8 +27,6 @@ import (
"github.com/golang/glog" "github.com/golang/glog"
utilerrors "k8s.io/apimachinery/pkg/util/errors" utilerrors "k8s.io/apimachinery/pkg/util/errors"
iptablesproxy "k8s.io/kubernetes/pkg/proxy/iptables" iptablesproxy "k8s.io/kubernetes/pkg/proxy/iptables"
utildbus "k8s.io/kubernetes/pkg/util/dbus"
utilexec "k8s.io/kubernetes/pkg/util/exec"
utiliptables "k8s.io/kubernetes/pkg/util/iptables" utiliptables "k8s.io/kubernetes/pkg/util/iptables"
) )
...@@ -51,11 +49,10 @@ type hostportManager struct { ...@@ -51,11 +49,10 @@ type hostportManager struct {
mu sync.Mutex mu sync.Mutex
} }
func NewHostportManager() HostPortManager { func NewHostportManager(iptables utiliptables.Interface) HostPortManager {
iptInterface := utiliptables.New(utilexec.New(), utildbus.New(), utiliptables.ProtocolIpv4)
return &hostportManager{ return &hostportManager{
hostPortMap: make(map[hostport]closeable), hostPortMap: make(map[hostport]closeable),
iptables: iptInterface, iptables: iptables,
portOpener: openLocalPort, portOpener: openLocalPort,
} }
} }
......
...@@ -27,8 +27,6 @@ import ( ...@@ -27,8 +27,6 @@ import (
"github.com/golang/glog" "github.com/golang/glog"
iptablesproxy "k8s.io/kubernetes/pkg/proxy/iptables" iptablesproxy "k8s.io/kubernetes/pkg/proxy/iptables"
utildbus "k8s.io/kubernetes/pkg/util/dbus"
utilexec "k8s.io/kubernetes/pkg/util/exec"
utiliptables "k8s.io/kubernetes/pkg/util/iptables" utiliptables "k8s.io/kubernetes/pkg/util/iptables"
) )
...@@ -49,11 +47,10 @@ type hostportSyncer struct { ...@@ -49,11 +47,10 @@ type hostportSyncer struct {
portOpener hostportOpener portOpener hostportOpener
} }
func NewHostportSyncer() HostportSyncer { func NewHostportSyncer(iptables utiliptables.Interface) HostportSyncer {
iptInterface := utiliptables.New(utilexec.New(), utildbus.New(), utiliptables.ProtocolIpv4)
return &hostportSyncer{ return &hostportSyncer{
hostPortMap: make(map[hostport]closeable), hostPortMap: make(map[hostport]closeable),
iptables: iptInterface, iptables: iptables,
portOpener: openLocalPort, portOpener: openLocalPort,
} }
} }
......
...@@ -118,8 +118,8 @@ func NewPlugin(networkPluginDir string) network.NetworkPlugin { ...@@ -118,8 +118,8 @@ func NewPlugin(networkPluginDir string) network.NetworkPlugin {
iptables: iptInterface, iptables: iptInterface,
sysctl: sysctl, sysctl: sysctl,
vendorDir: networkPluginDir, vendorDir: networkPluginDir,
hostportSyncer: hostport.NewHostportSyncer(), hostportSyncer: hostport.NewHostportSyncer(iptInterface),
hostportManager: hostport.NewHostportManager(), hostportManager: hostport.NewHostportManager(iptInterface),
nonMasqueradeCIDR: "10.0.0.0/8", nonMasqueradeCIDR: "10.0.0.0/8",
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment