diff --git a/cmd/kubelet/app/server.go b/cmd/kubelet/app/server.go index 95c5aa7fc39..bb6aef10390 100644 --- a/cmd/kubelet/app/server.go +++ b/cmd/kubelet/app/server.go @@ -945,6 +945,7 @@ func RunDockershim(c *componentconfig.KubeletConfiguration, dockershimRootDir st if binDir == "" { binDir = c.NetworkPluginDir } + nh := &kubelet.NoOpLegacyHost{} pluginSettings := dockershim.NetworkPluginSettings{ HairpinMode: componentconfig.HairpinMode(c.HairpinMode), NonMasqueradeCIDR: c.NonMasqueradeCIDR, @@ -952,6 +953,7 @@ func RunDockershim(c *componentconfig.KubeletConfiguration, dockershimRootDir st PluginConfDir: c.CNIConfDir, PluginBinDir: binDir, MTU: int(c.NetworkPluginMTU), + LegacyRuntimeHost: nh, } // Initialize streaming configuration. (Not using TLS now) diff --git a/pkg/kubelet/kubelet.go b/pkg/kubelet/kubelet.go index 6525f6d2a73..141da39c146 100644 --- a/pkg/kubelet/kubelet.go +++ b/pkg/kubelet/kubelet.go @@ -524,7 +524,7 @@ func NewMainKubelet(kubeCfg *componentconfig.KubeletConfiguration, kubeDeps *Kub // Remote runtime shim just cannot talk back to kubelet, so it doesn't // support bandwidth shaping or hostports till #35457. To enable legacy // features, replace with networkHost. - var nl *noOpLegacyHost + var nl *NoOpLegacyHost pluginSettings.LegacyRuntimeHost = nl // rktnetes cannot be run with CRI. diff --git a/pkg/kubelet/networks.go b/pkg/kubelet/networks.go index d8382433372..6f2020d0da1 100644 --- a/pkg/kubelet/networks.go +++ b/pkg/kubelet/networks.go @@ -72,20 +72,20 @@ func (c *criNetworkHost) GetNetNS(containerID string) (string, error) { // noOpLegacyHost implements the network.LegacyHost interface for the remote // runtime shim by just returning empties. It doesn't support legacy features // 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 } -func (n *noOpLegacyHost) GetKubeClient() clientset.Interface { +func (n *NoOpLegacyHost) GetKubeClient() clientset.Interface { return nil } -func (n *noOpLegacyHost) GetRuntime() kubecontainer.Runtime { +func (n *NoOpLegacyHost) GetRuntime() kubecontainer.Runtime { return nil } -func (nh *noOpLegacyHost) SupportsLegacyFeatures() bool { +func (nh *NoOpLegacyHost) SupportsLegacyFeatures() bool { return false }