mirror of https://github.com/k3s-io/k3s
pass NetworkPluginDir to kubenet
parent
0a2a7a9d6a
commit
e9f8c70eaf
|
@ -92,7 +92,7 @@ func ProbeNetworkPlugins(pluginDir string) []network.NetworkPlugin {
|
||||||
// for each existing plugin, add to the list
|
// for each existing plugin, add to the list
|
||||||
allPlugins = append(allPlugins, exec.ProbeNetworkPlugins(pluginDir)...)
|
allPlugins = append(allPlugins, exec.ProbeNetworkPlugins(pluginDir)...)
|
||||||
allPlugins = append(allPlugins, cni.ProbeNetworkPlugins(pluginDir)...)
|
allPlugins = append(allPlugins, cni.ProbeNetworkPlugins(pluginDir)...)
|
||||||
allPlugins = append(allPlugins, kubenet.NewPlugin())
|
allPlugins = append(allPlugins, kubenet.NewPlugin(pluginDir))
|
||||||
|
|
||||||
return allPlugins
|
return allPlugins
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,20 +77,23 @@ type kubenetNetworkPlugin struct {
|
||||||
hairpinMode componentconfig.HairpinMode
|
hairpinMode componentconfig.HairpinMode
|
||||||
hostPortMap map[hostport]closeable
|
hostPortMap map[hostport]closeable
|
||||||
iptables utiliptables.Interface
|
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
|
protocol := utiliptables.ProtocolIpv4
|
||||||
execer := utilexec.New()
|
execer := utilexec.New()
|
||||||
dbus := utildbus.New()
|
dbus := utildbus.New()
|
||||||
iptInterface := utiliptables.New(execer, dbus, protocol)
|
iptInterface := utiliptables.New(execer, dbus, protocol)
|
||||||
|
|
||||||
return &kubenetNetworkPlugin{
|
return &kubenetNetworkPlugin{
|
||||||
podIPs: make(map[kubecontainer.ContainerID]string),
|
podIPs: make(map[kubecontainer.ContainerID]string),
|
||||||
hostPortMap: make(map[hostport]closeable),
|
hostPortMap: make(map[hostport]closeable),
|
||||||
MTU: 1460, //TODO: don't hardcode this
|
MTU: 1460, //TODO: don't hardcode this
|
||||||
execer: utilexec.New(),
|
execer: utilexec.New(),
|
||||||
iptables: iptInterface,
|
iptables: iptInterface,
|
||||||
|
vendorDir: networkPluginDir,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +101,7 @@ func (plugin *kubenetNetworkPlugin) Init(host network.Host, hairpinMode componen
|
||||||
plugin.host = host
|
plugin.host = host
|
||||||
plugin.hairpinMode = hairpinMode
|
plugin.hairpinMode = hairpinMode
|
||||||
plugin.cniConfig = &libcni.CNIConfig{
|
plugin.cniConfig = &libcni.CNIConfig{
|
||||||
Path: []string{DefaultCNIDir},
|
Path: []string{DefaultCNIDir, plugin.vendorDir},
|
||||||
}
|
}
|
||||||
|
|
||||||
if link, err := findMinMTU(); err == nil {
|
if link, err := findMinMTU(); err == nil {
|
||||||
|
|
|
@ -30,7 +30,7 @@ type kubenetNetworkPlugin struct {
|
||||||
network.NoopNetworkPlugin
|
network.NoopNetworkPlugin
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewPlugin() network.NetworkPlugin {
|
func NewPlugin(networkPluginDir string) network.NetworkPlugin {
|
||||||
return &kubenetNetworkPlugin{}
|
return &kubenetNetworkPlugin{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue