Merge pull request #35561 from Random-Liu/enable-remote-docker-shim

Automatic merge from submit-queue

CRI: Enable remote dockershim by default

Enable remote dockershim by default.

Once the grpc integration is stabilized, I'll remove the temporary knob and configure container runtime endpoint in all test suite.

@yujuhong @feiskyer 
/cc @kubernetes/sig-node
This commit is contained in:
Kubernetes Submit Queue 2016-10-26 17:38:57 -07:00 committed by GitHub
commit 29d8c39a37
2 changed files with 31 additions and 41 deletions

View File

@ -491,44 +491,33 @@ func NewMainKubelet(kubeCfg *componentconfig.KubeletConfiguration, kubeDeps *Kub
// Use the new CRI shim for docker. This is needed for testing the // Use the new CRI shim for docker. This is needed for testing the
// docker integration through CRI, and may be removed in the future. // docker integration through CRI, and may be removed in the future.
dockerService := dockershim.NewDockerService(klet.dockerClient, kubeCfg.SeccompProfileRoot, kubeCfg.PodInfraContainerImage) dockerService := dockershim.NewDockerService(klet.dockerClient, kubeCfg.SeccompProfileRoot, kubeCfg.PodInfraContainerImage)
klet.containerRuntime, err = kuberuntime.NewKubeGenericRuntimeManager( runtimeService := dockerService.(internalApi.RuntimeService)
kubecontainer.FilterEventRecorder(kubeDeps.Recorder), imageService := dockerService.(internalApi.ImageManagerService)
klet.livenessManager,
containerRefManager, // This is a temporary knob to easily switch between grpc and non-grpc integration. grpc
machineInfo, // will be enabled if this is not empty.
klet.podManager, // TODO(random-liu): Remove the temporary knob after grpc integration is stabilized and
kubeDeps.OSInterface, // pass the runtime endpoint through kubelet flags.
klet.networkPlugin, remoteEndpoint := "/var/run/dockershim.sock"
klet,
klet.httpClient, // If the remote runtime endpoint is set, use the grpc integration.
imageBackOff, if remoteEndpoint != "" {
kubeCfg.SerializeImagePulls,
float32(kubeCfg.RegistryPullQPS),
int(kubeCfg.RegistryBurst),
klet.cpuCFSQuota,
dockerService,
dockerService,
)
if err != nil {
return nil, err
}
case "remote":
// kubelet will talk to the shim over a unix socket using grpc. This may become the default in the near future.
dockerService := dockershim.NewDockerService(klet.dockerClient, kubeCfg.SeccompProfileRoot, kubeCfg.PodInfraContainerImage)
// Start the in process dockershim grpc server. // Start the in process dockershim grpc server.
server := dockerremote.NewDockerServer(kubeCfg.RemoteRuntimeEndpoint, dockerService) server := dockerremote.NewDockerServer(remoteEndpoint, dockerService)
if err := server.Start(); err != nil { err := server.Start()
if err != nil {
return nil, err return nil, err
} }
// Start the remote kuberuntime manager. // Start the remote kuberuntime manager.
remoteRuntimeService, err := remote.NewRemoteRuntimeService(kubeCfg.RemoteRuntimeEndpoint, kubeCfg.RuntimeRequestTimeout.Duration) runtimeService, err = remote.NewRemoteRuntimeService(remoteEndpoint, kubeCfg.RuntimeRequestTimeout.Duration)
if err != nil { if err != nil {
return nil, err return nil, err
} }
remoteImageService, err := remote.NewRemoteImageService(kubeCfg.RemoteImageEndpoint, kubeCfg.RuntimeRequestTimeout.Duration) imageService, err = remote.NewRemoteImageService(remoteEndpoint, kubeCfg.RuntimeRequestTimeout.Duration)
if err != nil { if err != nil {
return nil, err return nil, err
} }
}
klet.containerRuntime, err = kuberuntime.NewKubeGenericRuntimeManager( klet.containerRuntime, err = kuberuntime.NewKubeGenericRuntimeManager(
kubecontainer.FilterEventRecorder(kubeDeps.Recorder), kubecontainer.FilterEventRecorder(kubeDeps.Recorder),
klet.livenessManager, klet.livenessManager,
@ -547,14 +536,15 @@ func NewMainKubelet(kubeCfg *componentconfig.KubeletConfiguration, kubeDeps *Kub
// Use DockerLegacyService directly to workaround unimplemented functions. // Use DockerLegacyService directly to workaround unimplemented functions.
// We add short hack here to keep other code clean. // We add short hack here to keep other code clean.
// TODO: Remove this hack after CRI is fully designed and implemented. // TODO: Remove this hack after CRI is fully designed and implemented.
// TODO: Move the instrumented interface wrapping into kuberuntime.
&struct { &struct {
internalApi.RuntimeService internalApi.RuntimeService
dockershim.DockerLegacyService dockershim.DockerLegacyService
}{ }{
RuntimeService: remoteRuntimeService, RuntimeService: kuberuntime.NewInstrumentedRuntimeService(runtimeService),
DockerLegacyService: dockerService, DockerLegacyService: dockerService,
}, },
remoteImageService, kuberuntime.NewInstrumentedImageManagerService(imageService),
) )
if err != nil { if err != nil {
return nil, err return nil, err

View File

@ -138,8 +138,8 @@ func NewKubeGenericRuntimeManager(
osInterface: osInterface, osInterface: osInterface,
networkPlugin: networkPlugin, networkPlugin: networkPlugin,
runtimeHelper: runtimeHelper, runtimeHelper: runtimeHelper,
runtimeService: NewInstrumentedRuntimeService(runtimeService), runtimeService: runtimeService,
imageService: NewInstrumentedImageManagerService(imageService), imageService: imageService,
keyring: credentialprovider.NewDockerKeyring(), keyring: credentialprovider.NewDockerKeyring(),
} }