mirror of https://github.com/k3s-io/k3s
Merge pull request #45316 from yujuhong/dockershim-plugin-settings
Automatic merge from submit-queue (batch tested with PRs 45316, 45341) Pass NoOpLegacyHost to dockershim in --experimental-dockershim mode This allows dockershim to use network plugins, if needed. /cc @Random-Liupull/6/head
commit
f6ec7bade1
|
@ -945,6 +945,7 @@ func RunDockershim(c *componentconfig.KubeletConfiguration, dockershimRootDir st
|
||||||
if binDir == "" {
|
if binDir == "" {
|
||||||
binDir = c.NetworkPluginDir
|
binDir = c.NetworkPluginDir
|
||||||
}
|
}
|
||||||
|
nh := &kubelet.NoOpLegacyHost{}
|
||||||
pluginSettings := dockershim.NetworkPluginSettings{
|
pluginSettings := dockershim.NetworkPluginSettings{
|
||||||
HairpinMode: componentconfig.HairpinMode(c.HairpinMode),
|
HairpinMode: componentconfig.HairpinMode(c.HairpinMode),
|
||||||
NonMasqueradeCIDR: c.NonMasqueradeCIDR,
|
NonMasqueradeCIDR: c.NonMasqueradeCIDR,
|
||||||
|
@ -952,6 +953,7 @@ func RunDockershim(c *componentconfig.KubeletConfiguration, dockershimRootDir st
|
||||||
PluginConfDir: c.CNIConfDir,
|
PluginConfDir: c.CNIConfDir,
|
||||||
PluginBinDir: binDir,
|
PluginBinDir: binDir,
|
||||||
MTU: int(c.NetworkPluginMTU),
|
MTU: int(c.NetworkPluginMTU),
|
||||||
|
LegacyRuntimeHost: nh,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize streaming configuration. (Not using TLS now)
|
// Initialize streaming configuration. (Not using TLS now)
|
||||||
|
|
|
@ -524,7 +524,7 @@ func NewMainKubelet(kubeCfg *componentconfig.KubeletConfiguration, kubeDeps *Kub
|
||||||
// Remote runtime shim just cannot talk back to kubelet, so it doesn't
|
// Remote runtime shim just cannot talk back to kubelet, so it doesn't
|
||||||
// support bandwidth shaping or hostports till #35457. To enable legacy
|
// support bandwidth shaping or hostports till #35457. To enable legacy
|
||||||
// features, replace with networkHost.
|
// features, replace with networkHost.
|
||||||
var nl *noOpLegacyHost
|
var nl *NoOpLegacyHost
|
||||||
pluginSettings.LegacyRuntimeHost = nl
|
pluginSettings.LegacyRuntimeHost = nl
|
||||||
|
|
||||||
// rktnetes cannot be run with CRI.
|
// rktnetes cannot be run with CRI.
|
||||||
|
|
|
@ -72,20 +72,20 @@ func (c *criNetworkHost) GetNetNS(containerID string) (string, error) {
|
||||||
// noOpLegacyHost implements the network.LegacyHost interface for the remote
|
// noOpLegacyHost implements the network.LegacyHost interface for the remote
|
||||||
// runtime shim by just returning empties. It doesn't support legacy features
|
// runtime shim by just returning empties. It doesn't support legacy features
|
||||||
// like host port and bandwidth shaping.
|
// like host port and bandwidth shaping.
|
||||||
type noOpLegacyHost struct{}
|
type NoOpLegacyHost struct{}
|
||||||
|
|
||||||
func (n *noOpLegacyHost) GetPodByName(namespace, name string) (*v1.Pod, bool) {
|
func (n *NoOpLegacyHost) GetPodByName(namespace, name string) (*v1.Pod, bool) {
|
||||||
return nil, true
|
return nil, true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *noOpLegacyHost) GetKubeClient() clientset.Interface {
|
func (n *NoOpLegacyHost) GetKubeClient() clientset.Interface {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *noOpLegacyHost) GetRuntime() kubecontainer.Runtime {
|
func (n *NoOpLegacyHost) GetRuntime() kubecontainer.Runtime {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (nh *noOpLegacyHost) SupportsLegacyFeatures() bool {
|
func (nh *NoOpLegacyHost) SupportsLegacyFeatures() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue