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-Liu
pull/6/head
Kubernetes Submit Queue 2017-05-04 05:19:49 -07:00 committed by GitHub
commit f6ec7bade1
3 changed files with 8 additions and 6 deletions

View File

@ -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)

View File

@ -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.

View File

@ -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
}