dockershim: call DockerService.Start() during grpc server startup

This commit is contained in:
Yu-Ju Hong 2018-01-19 13:51:24 -08:00
parent 20910289b8
commit 9728c56a5a
4 changed files with 8 additions and 8 deletions

View File

@ -998,10 +998,6 @@ func RunDockershim(f *options.KubeletFlags, c *kubeletconfiginternal.KubeletConf
if err != nil { if err != nil {
return err return err
} }
if err := ds.Start(); err != nil {
return err
}
glog.V(2).Infof("Starting the GRPC server for the docker CRI shim.") glog.V(2).Infof("Starting the GRPC server for the docker CRI shim.")
server := dockerremote.NewDockerServer(f.RemoteRuntimeEndpoint, ds) server := dockerremote.NewDockerServer(f.RemoteRuntimeEndpoint, ds)
if err := server.Start(); err != nil { if err := server.Start(); err != nil {

View File

@ -266,6 +266,8 @@ func NewDockerService(config *ClientConfig, podSandboxImage string, streamingCon
type CRIService interface { type CRIService interface {
runtimeapi.RuntimeServiceServer runtimeapi.RuntimeServiceServer
runtimeapi.ImageServiceServer runtimeapi.ImageServiceServer
Start() error
} }
// DockerService is an interface that embeds the new RuntimeService and // DockerService is an interface that embeds the new RuntimeService and
@ -273,7 +275,6 @@ type CRIService interface {
type DockerService interface { type DockerService interface {
CRIService CRIService
Start() error
// For serving streaming calls. // For serving streaming calls.
http.Handler http.Handler

View File

@ -48,6 +48,12 @@ func NewDockerServer(endpoint string, s dockershim.CRIService) *DockerServer {
// Start starts the dockershim grpc server. // Start starts the dockershim grpc server.
func (s *DockerServer) Start() error { func (s *DockerServer) Start() error {
// Start the internal service.
if err := s.service.Start(); err != nil {
glog.Errorf("Unable to start docker service")
return err
}
glog.V(2).Infof("Start dockershim grpc server") glog.V(2).Infof("Start dockershim grpc server")
l, err := util.CreateListener(s.endpoint) l, err := util.CreateListener(s.endpoint)
if err != nil { if err != nil {

View File

@ -610,9 +610,6 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
if err != nil { if err != nil {
return nil, err return nil, err
} }
if err := ds.Start(); err != nil {
return nil, err
}
// For now, the CRI shim redirects the streaming requests to the // For now, the CRI shim redirects the streaming requests to the
// kubelet, which handles the requests using DockerService.. // kubelet, which handles the requests using DockerService..
klet.criHandler = ds klet.criHandler = ds