[sandbox] Implement sandbox controller

Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
This commit is contained in:
Maksym Pavlenko
2021-11-07 17:25:16 -08:00
parent eaccbf1d03
commit 6343fe3ea2
3 changed files with 120 additions and 7 deletions

View File

@@ -324,7 +324,8 @@ func (m *ShimManager) Get(ctx context.Context, id string) (ShimProcess, error) {
return nil, err
}
return proc, nil
shimTask := proc.(*shimTask)
return shimTask, nil
}
// Delete a runtime task

View File

@@ -194,6 +194,8 @@ type ShimProcess interface {
ID() string
// Namespace of this shim.
Namespace() string
// Client returns the underlying TTRPC client for this shim.
Client() *ttrpc.Client
}
type shim struct {
@@ -243,6 +245,10 @@ type shimTask struct {
task task.TaskService
}
func (s *shimTask) Client() *ttrpc.Client {
return s.client
}
func (s *shimTask) Shutdown(ctx context.Context) error {
_, err := s.task.Shutdown(ctx, &task.ShutdownRequest{
ID: s.ID(),