// ProbeNetworkPlugins collects all compiled-in plugins func ProbeNetworkPlugins(pluginDir string) []network.NetworkPlugin { allPlugins := []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(pluginDir)) return allPlugins }
// ProbeNetworkPlugins collects all compiled-in plugins func ProbeNetworkPlugins(pluginDir, cniConfDir, cniBinDir string) []network.NetworkPlugin { allPlugins := []network.NetworkPlugin{} // for backwards-compat, allow pluginDir as a source of CNI config files if cniConfDir == "" { cniConfDir = pluginDir } // for each existing plugin, add to the list allPlugins = append(allPlugins, cni.ProbeNetworkPlugins(cniConfDir, cniBinDir)...) allPlugins = append(allPlugins, kubenet.NewPlugin(pluginDir)) return allPlugins }
// NOTE: Anything passed to DockerService should be eventually handled in another way when we switch to running the shim as a different process. func NewDockerService(client dockertools.DockerInterface, seccompProfileRoot string, podSandboxImage string, streamingConfig *streaming.Config, pluginSettings *NetworkPluginSettings, cgroupsName string) (DockerService, error) { c := dockertools.NewInstrumentedDockerInterface(client) ds := &dockerService{ seccompProfileRoot: seccompProfileRoot, client: c, os: kubecontainer.RealOS{}, podSandboxImage: podSandboxImage, streamingRuntime: &streamingRuntime{ client: client, // Only the native exec handling is supported for now. // TODO(#35747) - Either deprecate nsenter exec handling, or add support for it here. execHandler: &dockertools.NativeExecHandler{}, }, containerManager: cm.NewContainerManager(cgroupsName, client), } if streamingConfig != nil { var err error ds.streamingServer, err = streaming.NewServer(*streamingConfig, ds.streamingRuntime) if err != nil { return nil, err } } // dockershim currently only supports CNI plugins. cniPlugins := cni.ProbeNetworkPlugins(pluginSettings.PluginConfDir, pluginSettings.PluginBinDir) cniPlugins = append(cniPlugins, kubenet.NewPlugin(pluginSettings.PluginBinDir)) netHost := &dockerNetworkHost{ pluginSettings.LegacyRuntimeHost, &namespaceGetter{ds}, } plug, err := network.InitNetworkPlugin(cniPlugins, pluginSettings.PluginName, netHost, pluginSettings.HairpinMode, pluginSettings.NonMasqueradeCIDR, pluginSettings.MTU) if err != nil { return nil, fmt.Errorf("didn't find compatible CNI plugin with given settings %+v: %v", pluginSettings, err) } ds.networkPlugin = plug glog.Infof("Docker cri networking managed by %v", plug.Name()) return ds, nil }