forked from cri-o/cri-o
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sandbox_stop.go
27 lines (24 loc) · 869 Bytes
/
sandbox_stop.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package server
import (
"github.com/sirupsen/logrus"
"golang.org/x/net/context"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
)
// StopPodSandbox stops the sandbox. If there are any running containers in the
// sandbox, they should be force terminated.
func (s *Server) StopPodSandbox(ctx context.Context, req *pb.StopPodSandboxRequest) (resp *pb.StopPodSandboxResponse, err error) {
// platform dependent call
return s.stopPodSandbox(ctx, req)
}
// stopAllPodSandboxes removes all pod sandboxes
func (s *Server) stopAllPodSandboxes(ctx context.Context) {
logrus.Debugf("stopAllPodSandboxes")
for _, sb := range s.ContainerServer.ListSandboxes() {
pod := &pb.StopPodSandboxRequest{
PodSandboxId: sb.ID(),
}
if _, err := s.StopPodSandbox(ctx, pod); err != nil {
logrus.Warnf("could not StopPodSandbox %s: %v", sb.ID(), err)
}
}
}