2016-11-22 16:49:54 +00:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
2017-11-09 10:10:35 +00:00
|
|
|
"time"
|
|
|
|
|
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
|
|
|
)
|
|
|
|
|
|
|
|
// RemoveContainer removes the container. If the container is running, the container
|
|
|
|
// should be force removed.
|
2017-11-09 10:10:35 +00:00
|
|
|
func (s *Server) RemoveContainer(ctx context.Context, req *pb.RemoveContainerRequest) (resp *pb.RemoveContainerResponse, err error) {
|
|
|
|
const operation = "remove_container"
|
|
|
|
defer func() {
|
|
|
|
recordOperation(operation, time.Now())
|
|
|
|
recordError(operation, err)
|
|
|
|
}()
|
|
|
|
logrus.Debugf("RemoveContainerRequest: %+v", req)
|
|
|
|
|
|
|
|
_, err = s.ContainerServer.Remove(ctx, req.ContainerId, true)
|
2016-11-22 16:49:54 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2017-11-09 10:10:35 +00:00
|
|
|
resp = &pb.RemoveContainerResponse{}
|
2016-11-22 16:49:54 +00:00
|
|
|
logrus.Debugf("RemoveContainerResponse: %+v", resp)
|
|
|
|
return resp, nil
|
|
|
|
}
|