2016-11-22 16:49:54 +00:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
2017-08-05 11:40:46 +00:00
|
|
|
"github.com/sirupsen/logrus"
|
2016-11-22 16:49:54 +00:00
|
|
|
"golang.org/x/net/context"
|
2017-08-04 11:13:19 +00:00
|
|
|
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
|
2016-11-22 16:49:54 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// StopContainer stops a running container with a grace period (i.e., timeout).
|
|
|
|
func (s *Server) StopContainer(ctx context.Context, req *pb.StopContainerRequest) (*pb.StopContainerResponse, error) {
|
2017-08-30 20:03:26 +00:00
|
|
|
_, err := s.ContainerServer.ContainerStop(req.ContainerId, req.Timeout)
|
2016-11-22 16:49:54 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
resp := &pb.StopContainerResponse{}
|
2017-08-30 20:03:26 +00:00
|
|
|
logrus.Debugf("StopContainerResponse %s: %+v", req.ContainerId, resp)
|
2016-11-22 16:49:54 +00:00
|
|
|
return resp, nil
|
|
|
|
}
|