mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-24 19:38:02 +00:00
kubelet: make --cni-bin-dir accept a comma-separated list of CNI plugin directories
Allow CNI-related network plugin drivers (kubenet, cni) to search a list of directories for plugin binaries instead of just one. This allows using an administrator-provided path and fallbacks to others (like the previous default of /opt/cni/bin) for backwards compatibility.
This commit is contained in:
@@ -114,12 +114,12 @@ func GetDynamicPluginProber(pluginDir string) volume.DynamicPluginProber {
|
||||
}
|
||||
|
||||
// ProbeNetworkPlugins collects all compiled-in plugins
|
||||
func ProbeNetworkPlugins(cniConfDir, cniBinDir string) []network.NetworkPlugin {
|
||||
func ProbeNetworkPlugins(cniConfDir string, cniBinDirs []string) []network.NetworkPlugin {
|
||||
allPlugins := []network.NetworkPlugin{}
|
||||
|
||||
// for each existing plugin, add to the list
|
||||
allPlugins = append(allPlugins, cni.ProbeNetworkPlugins(cniConfDir, []string{cniBinDir})...)
|
||||
allPlugins = append(allPlugins, kubenet.NewPlugin([]string{cniBinDir}))
|
||||
allPlugins = append(allPlugins, cni.ProbeNetworkPlugins(cniConfDir, cniBinDirs)...)
|
||||
allPlugins = append(allPlugins, kubenet.NewPlugin(cniBinDirs))
|
||||
|
||||
return allPlugins
|
||||
}
|
||||
|
@@ -78,6 +78,7 @@ import (
|
||||
evictionapi "k8s.io/kubernetes/pkg/kubelet/eviction/api"
|
||||
dynamickubeletconfig "k8s.io/kubernetes/pkg/kubelet/kubeletconfig"
|
||||
"k8s.io/kubernetes/pkg/kubelet/kubeletconfig/configfiles"
|
||||
"k8s.io/kubernetes/pkg/kubelet/network/cni"
|
||||
"k8s.io/kubernetes/pkg/kubelet/server"
|
||||
"k8s.io/kubernetes/pkg/kubelet/server/streaming"
|
||||
kubetypes "k8s.io/kubernetes/pkg/kubelet/types"
|
||||
@@ -355,7 +356,7 @@ func UnsecuredDependencies(s *options.KubeletServer) (*kubelet.Dependencies, err
|
||||
ExternalKubeClient: nil,
|
||||
EventClient: nil,
|
||||
Mounter: mounter,
|
||||
NetworkPlugins: ProbeNetworkPlugins(s.CNIConfDir, s.CNIBinDir),
|
||||
NetworkPlugins: ProbeNetworkPlugins(s.CNIConfDir, cni.SplitDirs(s.CNIBinDir)),
|
||||
OOMAdjuster: oom.NewOOMAdjuster(),
|
||||
OSInterface: kubecontainer.RealOS{},
|
||||
Writer: writer,
|
||||
@@ -1096,7 +1097,7 @@ func RunDockershim(f *options.KubeletFlags, c *kubeletconfiginternal.KubeletConf
|
||||
NonMasqueradeCIDR: f.NonMasqueradeCIDR,
|
||||
PluginName: r.NetworkPluginName,
|
||||
PluginConfDir: r.CNIConfDir,
|
||||
PluginBinDir: r.CNIBinDir,
|
||||
PluginBinDirs: cni.SplitDirs(r.CNIBinDir),
|
||||
MTU: int(r.NetworkPluginMTU),
|
||||
LegacyRuntimeHost: nh,
|
||||
}
|
||||
|
Reference in New Issue
Block a user