Enable remote dockershim by default. Once the grpc integration

is stablized, I'll remove the temporary knob and configure container
runtime endpoint in all test suite.
This commit is contained in:
Random-Liu 2016-10-25 16:10:36 -07:00
parent b1d8961fe4
commit 54feed4e41
2 changed files with 31 additions and 41 deletions

View File

@ -491,43 +491,32 @@ 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, // Start the in process dockershim grpc server.
float32(kubeCfg.RegistryPullQPS), server := dockerremote.NewDockerServer(remoteEndpoint, dockerService)
int(kubeCfg.RegistryBurst), err := server.Start()
klet.cpuCFSQuota, if err != nil {
dockerService, return nil, err
dockerService, }
) // Start the remote kuberuntime manager.
if err != nil { runtimeService, err = remote.NewRemoteRuntimeService(remoteEndpoint, kubeCfg.RuntimeRequestTimeout.Duration)
return nil, err 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. imageService, err = remote.NewRemoteImageService(remoteEndpoint, kubeCfg.RuntimeRequestTimeout.Duration)
dockerService := dockershim.NewDockerService(klet.dockerClient, kubeCfg.SeccompProfileRoot, kubeCfg.PodInfraContainerImage) if err != nil {
// Start the in process dockershim grpc server. return nil, err
server := dockerremote.NewDockerServer(kubeCfg.RemoteRuntimeEndpoint, dockerService) }
if err := server.Start(); err != nil {
return nil, err
}
// Start the remote kuberuntime manager.
remoteRuntimeService, err := remote.NewRemoteRuntimeService(kubeCfg.RemoteRuntimeEndpoint, kubeCfg.RuntimeRequestTimeout.Duration)
if err != nil {
return nil, err
}
remoteImageService, err := remote.NewRemoteImageService(kubeCfg.RemoteImageEndpoint, kubeCfg.RuntimeRequestTimeout.Duration)
if err != nil {
return nil, err
} }
klet.containerRuntime, err = kuberuntime.NewKubeGenericRuntimeManager( klet.containerRuntime, err = kuberuntime.NewKubeGenericRuntimeManager(
kubecontainer.FilterEventRecorder(kubeDeps.Recorder), kubecontainer.FilterEventRecorder(kubeDeps.Recorder),
@ -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(),
} }