Commit c1392ec5 authored by k8s-merge-robot's avatar k8s-merge-robot

Merge pull request #26747 from freehan/kubenetdir

Automatic merge from submit-queue pass NetworkPluginDir to kubenet to unblock GCI kubenet integration #26379 cc: @andyzheng0831
parents 69e45dc3 e9f8c70e
......@@ -92,7 +92,7 @@ func ProbeNetworkPlugins(pluginDir string) []network.NetworkPlugin {
// for each existing plugin, add to the list
allPlugins = append(allPlugins, exec.ProbeNetworkPlugins(pluginDir)...)
allPlugins = append(allPlugins, cni.ProbeNetworkPlugins(pluginDir)...)
allPlugins = append(allPlugins, kubenet.NewPlugin())
allPlugins = append(allPlugins, kubenet.NewPlugin(pluginDir))
return allPlugins
}
......@@ -77,20 +77,23 @@ type kubenetNetworkPlugin struct {
hairpinMode componentconfig.HairpinMode
hostPortMap map[hostport]closeable
iptables utiliptables.Interface
// vendorDir is passed by kubelet network-plugin-dir parameter.
// kubenet will search for cni binaries in DefaultCNIDir first, then continue to vendorDir.
vendorDir string
}
func NewPlugin() network.NetworkPlugin {
func NewPlugin(networkPluginDir string) network.NetworkPlugin {
protocol := utiliptables.ProtocolIpv4
execer := utilexec.New()
dbus := utildbus.New()
iptInterface := utiliptables.New(execer, dbus, protocol)
return &kubenetNetworkPlugin{
podIPs: make(map[kubecontainer.ContainerID]string),
hostPortMap: make(map[hostport]closeable),
MTU: 1460, //TODO: don't hardcode this
execer: utilexec.New(),
iptables: iptInterface,
vendorDir: networkPluginDir,
}
}
......@@ -98,7 +101,7 @@ func (plugin *kubenetNetworkPlugin) Init(host network.Host, hairpinMode componen
plugin.host = host
plugin.hairpinMode = hairpinMode
plugin.cniConfig = &libcni.CNIConfig{
Path: []string{DefaultCNIDir},
Path: []string{DefaultCNIDir, plugin.vendorDir},
}
if link, err := findMinMTU(); err == nil {
......
......@@ -30,7 +30,7 @@ type kubenetNetworkPlugin struct {
network.NoopNetworkPlugin
}
func NewPlugin() network.NetworkPlugin {
func NewPlugin(networkPluginDir string) network.NetworkPlugin {
return &kubenetNetworkPlugin{}
}
......
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