From b7a36950f65826a046413f8aa9ec93307fb274f4 Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Wed, 9 Feb 2022 12:52:37 -0800 Subject: [PATCH] [Sandbox] Add Wait and PID Signed-off-by: Maksym Pavlenko --- api/next.pb.txt | 122 +++- api/services/sandbox/v1/sandbox.pb.go | 969 ++++++++++++++++++++++--- api/services/sandbox/v1/sandbox.proto | 28 +- runtime/v2/runc/pause/sandbox.go | 6 + runtime/v2/shim.go | 6 + runtime/v2/task/sandbox.pb.go | 910 ++++++++++++++++++++--- runtime/v2/task/sandbox.proto | 27 +- sandbox.go | 67 +- sandbox/controller.go | 8 +- sandbox_controller.go | 25 +- services/sandbox/controller_local.go | 43 +- services/sandbox/controller_service.go | 5 + 12 files changed, 1996 insertions(+), 220 deletions(-) diff --git a/api/next.pb.txt b/api/next.pb.txt index efaeb9930..28355603f 100644 --- a/api/next.pb.txt +++ b/api/next.pb.txt @@ -3085,9 +3085,11 @@ file { file { name: "github.com/containerd/containerd/api/services/sandbox/v1/sandbox.proto" package: "containerd.services.sandbox.v1" - dependency: "gogoproto/gogo.proto" dependency: "google/protobuf/any.proto" + dependency: "google/protobuf/timestamp.proto" + dependency: "gogoproto/gogo.proto" dependency: "github.com/containerd/containerd/api/types/sandbox.proto" + dependency: "github.com/containerd/containerd/api/types/mount.proto" message_type { name: "StoreCreateRequest" field { @@ -3219,16 +3221,38 @@ file { json_name: "sandboxId" } field { - name: "spec" - number: 4 + name: "rootfs" + number: 2 + label: LABEL_REPEATED + type: TYPE_MESSAGE + type_name: ".containerd.types.Mount" + json_name: "rootfs" + } + field { + name: "options" + number: 3 label: LABEL_OPTIONAL type: TYPE_MESSAGE type_name: ".google.protobuf.Any" - json_name: "spec" + json_name: "options" } } message_type { name: "ControllerStartResponse" + field { + name: "sandbox_id" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "sandboxId" + } + field { + name: "pid" + number: 2 + label: LABEL_OPTIONAL + type: TYPE_UINT32 + json_name: "pid" + } } message_type { name: "ControllerShutdownRequest" @@ -3239,10 +3263,49 @@ file { type: TYPE_STRING json_name: "sandboxId" } + field { + name: "timeout_secs" + number: 2 + label: LABEL_OPTIONAL + type: TYPE_UINT32 + json_name: "timeoutSecs" + } } message_type { name: "ControllerShutdownResponse" } + message_type { + name: "ControllerWaitRequest" + field { + name: "sandbox_id" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "sandboxId" + } + } + message_type { + name: "ControllerWaitResponse" + field { + name: "exit_status" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_UINT32 + json_name: "exitStatus" + } + field { + name: "exited_at" + number: 2 + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: ".google.protobuf.Timestamp" + options { + 65001: 0 + 65010: 1 + } + json_name: "exitedAt" + } + } message_type { name: "ControllerPauseRequest" field { @@ -3295,12 +3358,52 @@ file { message_type { name: "ControllerStatusResponse" field { - name: "status" + name: "id" number: 1 label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "id" + } + field { + name: "pid" + number: 2 + label: LABEL_OPTIONAL + type: TYPE_UINT32 + json_name: "pid" + } + field { + name: "state" + number: 3 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "state" + } + field { + name: "exit_status" + number: 4 + label: LABEL_OPTIONAL + type: TYPE_UINT32 + json_name: "exitStatus" + } + field { + name: "exited_at" + number: 5 + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: ".google.protobuf.Timestamp" + options { + 65001: 0 + 65010: 1 + } + json_name: "exitedAt" + } + field { + name: "extra" + number: 6 + label: LABEL_OPTIONAL type: TYPE_MESSAGE type_name: ".google.protobuf.Any" - json_name: "status" + json_name: "extra" } } service { @@ -3343,6 +3446,11 @@ file { input_type: ".containerd.services.sandbox.v1.ControllerShutdownRequest" output_type: ".containerd.services.sandbox.v1.ControllerShutdownResponse" } + method { + name: "Wait" + input_type: ".containerd.services.sandbox.v1.ControllerWaitRequest" + output_type: ".containerd.services.sandbox.v1.ControllerWaitResponse" + } method { name: "Pause" input_type: ".containerd.services.sandbox.v1.ControllerPauseRequest" @@ -3367,7 +3475,7 @@ file { options { go_package: "github.com/containerd/containerd/api/services/sandbox/v1;sandbox" } - weak_dependency: 0 + weak_dependency: 2 syntax: "proto3" } file { diff --git a/api/services/sandbox/v1/sandbox.pb.go b/api/services/sandbox/v1/sandbox.pb.go index 76f099aea..3e8480481 100644 --- a/api/services/sandbox/v1/sandbox.pb.go +++ b/api/services/sandbox/v1/sandbox.pb.go @@ -16,6 +16,7 @@ import ( fmt "fmt" types "github.com/containerd/containerd/api/types" proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" types1 "github.com/gogo/protobuf/types" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -25,12 +26,14 @@ import ( math_bits "math/bits" reflect "reflect" strings "strings" + time "time" ) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf +var _ = time.Kitchen // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -429,11 +432,12 @@ func (m *StoreGetResponse) XXX_DiscardUnknown() { var xxx_messageInfo_StoreGetResponse proto.InternalMessageInfo type ControllerStartRequest struct { - SandboxID string `protobuf:"bytes,1,opt,name=sandbox_id,json=sandboxId,proto3" json:"sandbox_id,omitempty"` - Spec *types1.Any `protobuf:"bytes,4,opt,name=spec,proto3" json:"spec,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + SandboxID string `protobuf:"bytes,1,opt,name=sandbox_id,json=sandboxId,proto3" json:"sandbox_id,omitempty"` + Rootfs []*types.Mount `protobuf:"bytes,2,rep,name=rootfs,proto3" json:"rootfs,omitempty"` + Options *types1.Any `protobuf:"bytes,3,opt,name=options,proto3" json:"options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *ControllerStartRequest) Reset() { *m = ControllerStartRequest{} } @@ -469,6 +473,8 @@ func (m *ControllerStartRequest) XXX_DiscardUnknown() { var xxx_messageInfo_ControllerStartRequest proto.InternalMessageInfo type ControllerStartResponse struct { + SandboxID string `protobuf:"bytes,1,opt,name=sandbox_id,json=sandboxId,proto3" json:"sandbox_id,omitempty"` + Pid uint32 `protobuf:"varint,2,opt,name=pid,proto3" json:"pid,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -508,6 +514,7 @@ var xxx_messageInfo_ControllerStartResponse proto.InternalMessageInfo type ControllerShutdownRequest struct { SandboxID string `protobuf:"bytes,1,opt,name=sandbox_id,json=sandboxId,proto3" json:"sandbox_id,omitempty"` + TimeoutSecs uint32 `protobuf:"varint,2,opt,name=timeout_secs,json=timeoutSecs,proto3" json:"timeout_secs,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -583,6 +590,85 @@ func (m *ControllerShutdownResponse) XXX_DiscardUnknown() { var xxx_messageInfo_ControllerShutdownResponse proto.InternalMessageInfo +type ControllerWaitRequest struct { + SandboxID string `protobuf:"bytes,1,opt,name=sandbox_id,json=sandboxId,proto3" json:"sandbox_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ControllerWaitRequest) Reset() { *m = ControllerWaitRequest{} } +func (*ControllerWaitRequest) ProtoMessage() {} +func (*ControllerWaitRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{14} +} +func (m *ControllerWaitRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ControllerWaitRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ControllerWaitRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ControllerWaitRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ControllerWaitRequest.Merge(m, src) +} +func (m *ControllerWaitRequest) XXX_Size() int { + return m.Size() +} +func (m *ControllerWaitRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ControllerWaitRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ControllerWaitRequest proto.InternalMessageInfo + +type ControllerWaitResponse struct { + ExitStatus uint32 `protobuf:"varint,1,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"` + ExitedAt time.Time `protobuf:"bytes,2,opt,name=exited_at,json=exitedAt,proto3,stdtime" json:"exited_at"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ControllerWaitResponse) Reset() { *m = ControllerWaitResponse{} } +func (*ControllerWaitResponse) ProtoMessage() {} +func (*ControllerWaitResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{15} +} +func (m *ControllerWaitResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ControllerWaitResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ControllerWaitResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ControllerWaitResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ControllerWaitResponse.Merge(m, src) +} +func (m *ControllerWaitResponse) XXX_Size() int { + return m.Size() +} +func (m *ControllerWaitResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ControllerWaitResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ControllerWaitResponse proto.InternalMessageInfo + type ControllerPauseRequest struct { SandboxID string `protobuf:"bytes,1,opt,name=sandbox_id,json=sandboxId,proto3" json:"sandbox_id,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -593,7 +679,7 @@ type ControllerPauseRequest struct { func (m *ControllerPauseRequest) Reset() { *m = ControllerPauseRequest{} } func (*ControllerPauseRequest) ProtoMessage() {} func (*ControllerPauseRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d6eb1ebcbc2879f1, []int{14} + return fileDescriptor_d6eb1ebcbc2879f1, []int{16} } func (m *ControllerPauseRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -631,7 +717,7 @@ type ControllerPauseResponse struct { func (m *ControllerPauseResponse) Reset() { *m = ControllerPauseResponse{} } func (*ControllerPauseResponse) ProtoMessage() {} func (*ControllerPauseResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d6eb1ebcbc2879f1, []int{15} + return fileDescriptor_d6eb1ebcbc2879f1, []int{17} } func (m *ControllerPauseResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -670,7 +756,7 @@ type ControllerResumeRequest struct { func (m *ControllerResumeRequest) Reset() { *m = ControllerResumeRequest{} } func (*ControllerResumeRequest) ProtoMessage() {} func (*ControllerResumeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d6eb1ebcbc2879f1, []int{16} + return fileDescriptor_d6eb1ebcbc2879f1, []int{18} } func (m *ControllerResumeRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -708,7 +794,7 @@ type ControllerResumeResponse struct { func (m *ControllerResumeResponse) Reset() { *m = ControllerResumeResponse{} } func (*ControllerResumeResponse) ProtoMessage() {} func (*ControllerResumeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d6eb1ebcbc2879f1, []int{17} + return fileDescriptor_d6eb1ebcbc2879f1, []int{19} } func (m *ControllerResumeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -747,7 +833,7 @@ type ControllerPingRequest struct { func (m *ControllerPingRequest) Reset() { *m = ControllerPingRequest{} } func (*ControllerPingRequest) ProtoMessage() {} func (*ControllerPingRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d6eb1ebcbc2879f1, []int{18} + return fileDescriptor_d6eb1ebcbc2879f1, []int{20} } func (m *ControllerPingRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -785,7 +871,7 @@ type ControllerPingResponse struct { func (m *ControllerPingResponse) Reset() { *m = ControllerPingResponse{} } func (*ControllerPingResponse) ProtoMessage() {} func (*ControllerPingResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d6eb1ebcbc2879f1, []int{19} + return fileDescriptor_d6eb1ebcbc2879f1, []int{21} } func (m *ControllerPingResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -824,7 +910,7 @@ type ControllerStatusRequest struct { func (m *ControllerStatusRequest) Reset() { *m = ControllerStatusRequest{} } func (*ControllerStatusRequest) ProtoMessage() {} func (*ControllerStatusRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d6eb1ebcbc2879f1, []int{20} + return fileDescriptor_d6eb1ebcbc2879f1, []int{22} } func (m *ControllerStatusRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -854,7 +940,12 @@ func (m *ControllerStatusRequest) XXX_DiscardUnknown() { var xxx_messageInfo_ControllerStatusRequest proto.InternalMessageInfo type ControllerStatusResponse struct { - Status *types1.Any `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Pid uint32 `protobuf:"varint,2,opt,name=pid,proto3" json:"pid,omitempty"` + State string `protobuf:"bytes,3,opt,name=state,proto3" json:"state,omitempty"` + ExitStatus uint32 `protobuf:"varint,4,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"` + ExitedAt time.Time `protobuf:"bytes,5,opt,name=exited_at,json=exitedAt,proto3,stdtime" json:"exited_at"` + Extra *types1.Any `protobuf:"bytes,6,opt,name=extra,proto3" json:"extra,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -863,7 +954,7 @@ type ControllerStatusResponse struct { func (m *ControllerStatusResponse) Reset() { *m = ControllerStatusResponse{} } func (*ControllerStatusResponse) ProtoMessage() {} func (*ControllerStatusResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d6eb1ebcbc2879f1, []int{21} + return fileDescriptor_d6eb1ebcbc2879f1, []int{23} } func (m *ControllerStatusResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -907,6 +998,8 @@ func init() { proto.RegisterType((*ControllerStartResponse)(nil), "containerd.services.sandbox.v1.ControllerStartResponse") proto.RegisterType((*ControllerShutdownRequest)(nil), "containerd.services.sandbox.v1.ControllerShutdownRequest") proto.RegisterType((*ControllerShutdownResponse)(nil), "containerd.services.sandbox.v1.ControllerShutdownResponse") + proto.RegisterType((*ControllerWaitRequest)(nil), "containerd.services.sandbox.v1.ControllerWaitRequest") + proto.RegisterType((*ControllerWaitResponse)(nil), "containerd.services.sandbox.v1.ControllerWaitResponse") proto.RegisterType((*ControllerPauseRequest)(nil), "containerd.services.sandbox.v1.ControllerPauseRequest") proto.RegisterType((*ControllerPauseResponse)(nil), "containerd.services.sandbox.v1.ControllerPauseResponse") proto.RegisterType((*ControllerResumeRequest)(nil), "containerd.services.sandbox.v1.ControllerResumeRequest") @@ -922,53 +1015,67 @@ func init() { } var fileDescriptor_d6eb1ebcbc2879f1 = []byte{ - // 730 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4d, 0x4f, 0xd4, 0x40, - 0x18, 0xde, 0xca, 0x52, 0xdc, 0xd7, 0x18, 0x75, 0x04, 0xec, 0x36, 0xa6, 0x90, 0x9e, 0x38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x42, 0x6f, 0xc2, 0xa3, 0x6b, - 0x8a, 0xe2, 0xcf, 0xb1, 0x07, 0xcd, 0xcc, 0xab, 0xa3, 0x88, 0xd9, 0xe4, 0x93, 0x5f, 0xed, 0x82, - 0x1e, 0x83, 0x3a, 0x89, 0x4a, 0x08, 0xed, 0x64, 0x53, 0xef, 0x5b, 0x11, 0xad, 0xb8, 0x56, 0xb9, - 0x2c, 0x82, 0x47, 0x48, 0x74, 0xb2, 0xaf, 0xba, 0x98, 0x46, 0xc7, 0x15, 0x35, 0x54, 0x50, 0xae, - 0x13, 0x09, 0x91, 0xd7, 0x30, 0x97, 0xd1, 0x77, 0x7d, 0xa7, 0x9a, 0x84, 0x92, 0xbb, 0x0e, 0x4e, - 0x33, 0x29, 0x45, 0x8f, 0x59, 0x2c, 0xa2, 0xd5, 0x24, 0x76, 0xb3, 0x29, 0x12, 0x22, 0xb1, 0xb8, - 0xcb, 0x20, 0x53, 0xfe, 0x89, 0xd8, 0xdb, 0xc9, 0xdb, 0x23, 0x30, 0xad, 0x6f, 0x75, 0x98, 0xe6, - 0xbb, 0x8f, 0x86, 0x20, 0xc7, 0x05, 0x89, 0x5a, 0xc6, 0xdf, 0xff, 0x19, 0x18, 0xd7, 0xeb, 0x59, - 0x5d, 0x2b, 0x35, 0x23, 0xac, 0x0e, 0x41, 0x8e, 0x8b, 0xad, 0xa0, 0x64, 0xae, 0x6e, 0x0b, 0x4a, - 0xfe, 0xd1, 0x9c, 0x43, 0x90, 0xe3, 0xd6, 0x2a, 0x28, 0x99, 0xab, 0xc9, 0x82, 0x92, 0xf9, 0x5a, - 0x44, 0x1f, 0xa1, 0x3e, 0xee, 0x38, 0xb4, 0x52, 0x68, 0x38, 0x53, 0x9e, 0xea, 0x6a, 0x89, 0x09, - 0x21, 0x76, 0x04, 0x53, 0x1d, 0xcc, 0x90, 0x59, 0x68, 0x32, 0x2d, 0x4c, 0x75, 0xa5, 0xf8, 0x40, - 0xac, 0xd4, 0xfa, 0x35, 0x0d, 0x90, 0x2e, 0x21, 0x3a, 0x1d, 0xef, 0x91, 0x15, 0x32, 0xb4, 0xfe, - 0x2f, 0xa6, 0xc9, 0x0d, 0xa9, 0x3e, 0x2d, 0x3d, 0x27, 0x22, 0x7f, 0x95, 0xe0, 0x76, 0xd2, 0x49, - 0x68, 0xb3, 0x04, 0x4b, 0xbe, 0x12, 0xd5, 0x67, 0x55, 0x46, 0x85, 0x87, 0x53, 0x98, 0xe6, 0x85, - 0x55, 0x26, 0x7d, 0xb6, 0x29, 0xcb, 0xa4, 0xcf, 0x35, 0x23, 0xfa, 0x0c, 0x72, 0x5c, 0x63, 0xa8, - 0x04, 0x45, 0xae, 0x41, 0xd5, 0x8d, 0xf2, 0x83, 0x42, 0x3c, 0x82, 0xfa, 0xb8, 0xe0, 0xd0, 0x93, - 0x12, 0xee, 0xd3, 0x5e, 0x55, 0xd7, 0xcb, 0x8e, 0xa5, 0x99, 0xe3, 0xd2, 0x43, 0xe5, 0x96, 0x26, - 0xed, 0xdb, 0x32, 0x99, 0xf3, 0xfd, 0xda, 0x3e, 0x38, 0xbf, 0xd4, 0x6a, 0x3f, 0x2e, 0xb5, 0xda, - 0x97, 0x91, 0x26, 0x9d, 0x8f, 0x34, 0xe9, 0xfb, 0x48, 0x93, 0x7e, 0x8e, 0x34, 0xe9, 0xe0, 0x65, - 0xd5, 0xdf, 0xe2, 0xcf, 0xc5, 0xf1, 0x7d, 0xad, 0x2f, 0xf3, 0x96, 0x5e, 0xfb, 0x1d, 0x00, 0x00, - 0xff, 0xff, 0x94, 0xa8, 0x1b, 0x82, 0xd8, 0x0b, 0x00, 0x00, + // 946 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0x41, 0x6f, 0xe3, 0x44, + 0x14, 0xae, 0xd3, 0xc4, 0x6d, 0x5e, 0xa8, 0x58, 0x86, 0x6e, 0xd7, 0xb5, 0x50, 0x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89, 0x0a, 0xdb, 0xe4, 0xab, 0x0e, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1201,6 +1308,7 @@ var _Store_serviceDesc = grpc.ServiceDesc{ type ControllerClient interface { Start(ctx context.Context, in *ControllerStartRequest, opts ...grpc.CallOption) (*ControllerStartResponse, error) Shutdown(ctx context.Context, in *ControllerShutdownRequest, opts ...grpc.CallOption) (*ControllerShutdownResponse, error) + Wait(ctx context.Context, in *ControllerWaitRequest, opts ...grpc.CallOption) (*ControllerWaitResponse, error) Pause(ctx context.Context, in *ControllerPauseRequest, opts ...grpc.CallOption) (*ControllerPauseResponse, error) Resume(ctx context.Context, in *ControllerResumeRequest, opts ...grpc.CallOption) (*ControllerResumeResponse, error) Ping(ctx context.Context, in *ControllerPingRequest, opts ...grpc.CallOption) (*ControllerPingResponse, error) @@ -1233,6 +1341,15 @@ func (c *controllerClient) Shutdown(ctx context.Context, in *ControllerShutdownR return out, nil } +func (c *controllerClient) Wait(ctx context.Context, in *ControllerWaitRequest, opts ...grpc.CallOption) (*ControllerWaitResponse, error) { + out := new(ControllerWaitResponse) + err := c.cc.Invoke(ctx, "/containerd.services.sandbox.v1.Controller/Wait", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *controllerClient) Pause(ctx context.Context, in *ControllerPauseRequest, opts ...grpc.CallOption) (*ControllerPauseResponse, error) { out := new(ControllerPauseResponse) err := c.cc.Invoke(ctx, "/containerd.services.sandbox.v1.Controller/Pause", in, out, opts...) @@ -1273,6 +1390,7 @@ func (c *controllerClient) Status(ctx context.Context, in *ControllerStatusReque type ControllerServer interface { Start(context.Context, *ControllerStartRequest) (*ControllerStartResponse, error) Shutdown(context.Context, *ControllerShutdownRequest) (*ControllerShutdownResponse, error) + Wait(context.Context, *ControllerWaitRequest) (*ControllerWaitResponse, error) Pause(context.Context, *ControllerPauseRequest) (*ControllerPauseResponse, error) Resume(context.Context, *ControllerResumeRequest) (*ControllerResumeResponse, error) Ping(context.Context, *ControllerPingRequest) (*ControllerPingResponse, error) @@ -1289,6 +1407,9 @@ func (*UnimplementedControllerServer) Start(ctx context.Context, req *Controller func (*UnimplementedControllerServer) Shutdown(ctx context.Context, req *ControllerShutdownRequest) (*ControllerShutdownResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Shutdown not implemented") } +func (*UnimplementedControllerServer) Wait(ctx context.Context, req *ControllerWaitRequest) (*ControllerWaitResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Wait not implemented") +} func (*UnimplementedControllerServer) Pause(ctx context.Context, req *ControllerPauseRequest) (*ControllerPauseResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Pause not implemented") } @@ -1342,6 +1463,24 @@ func _Controller_Shutdown_Handler(srv interface{}, ctx context.Context, dec func return interceptor(ctx, in, info, handler) } +func _Controller_Wait_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ControllerWaitRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ControllerServer).Wait(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.services.sandbox.v1.Controller/Wait", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ControllerServer).Wait(ctx, req.(*ControllerWaitRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Controller_Pause_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ControllerPauseRequest) if err := dec(in); err != nil { @@ -1426,6 +1565,10 @@ var _Controller_serviceDesc = grpc.ServiceDesc{ MethodName: "Shutdown", Handler: _Controller_Shutdown_Handler, }, + { + MethodName: "Wait", + Handler: _Controller_Wait_Handler, + }, { MethodName: "Pause", Handler: _Controller_Pause_Handler, @@ -1839,9 +1982,9 @@ func (m *ControllerStartRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.Spec != nil { + if m.Options != nil { { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Options.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1849,7 +1992,21 @@ func (m *ControllerStartRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) i = encodeVarintSandbox(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x22 + dAtA[i] = 0x1a + } + if len(m.Rootfs) > 0 { + for iNdEx := len(m.Rootfs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Rootfs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSandbox(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } } if len(m.SandboxID) > 0 { i -= len(m.SandboxID) @@ -1885,6 +2042,18 @@ func (m *ControllerStartResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + if m.Pid != 0 { + i = encodeVarintSandbox(dAtA, i, uint64(m.Pid)) + i-- + dAtA[i] = 0x10 + } + if len(m.SandboxID) > 0 { + i -= len(m.SandboxID) + copy(dAtA[i:], m.SandboxID) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.SandboxID))) + i-- + dAtA[i] = 0xa + } return len(dAtA) - i, nil } @@ -1912,6 +2081,11 @@ func (m *ControllerShutdownRequest) MarshalToSizedBuffer(dAtA []byte) (int, erro i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + if m.TimeoutSecs != 0 { + i = encodeVarintSandbox(dAtA, i, uint64(m.TimeoutSecs)) + i-- + dAtA[i] = 0x10 + } if len(m.SandboxID) > 0 { i -= len(m.SandboxID) copy(dAtA[i:], m.SandboxID) @@ -1949,6 +2123,80 @@ func (m *ControllerShutdownResponse) MarshalToSizedBuffer(dAtA []byte) (int, err return len(dAtA) - i, nil } +func (m *ControllerWaitRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ControllerWaitRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ControllerWaitRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.SandboxID) > 0 { + i -= len(m.SandboxID) + copy(dAtA[i:], m.SandboxID) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.SandboxID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ControllerWaitResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ControllerWaitResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ControllerWaitResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + n7, err7 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExitedAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt):]) + if err7 != nil { + return 0, err7 + } + i -= n7 + i = encodeVarintSandbox(dAtA, i, uint64(n7)) + i-- + dAtA[i] = 0x12 + if m.ExitStatus != 0 { + i = encodeVarintSandbox(dAtA, i, uint64(m.ExitStatus)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func (m *ControllerPauseRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2190,9 +2438,9 @@ func (m *ControllerStatusResponse) MarshalToSizedBuffer(dAtA []byte) (int, error i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.Status != nil { + if m.Extra != nil { { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Extra.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2200,6 +2448,38 @@ func (m *ControllerStatusResponse) MarshalToSizedBuffer(dAtA []byte) (int, error i = encodeVarintSandbox(dAtA, i, uint64(size)) } i-- + dAtA[i] = 0x32 + } + n9, err9 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExitedAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt):]) + if err9 != nil { + return 0, err9 + } + i -= n9 + i = encodeVarintSandbox(dAtA, i, uint64(n9)) + i-- + dAtA[i] = 0x2a + if m.ExitStatus != 0 { + i = encodeVarintSandbox(dAtA, i, uint64(m.ExitStatus)) + i-- + dAtA[i] = 0x20 + } + if len(m.State) > 0 { + i -= len(m.State) + copy(dAtA[i:], m.State) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.State))) + i-- + dAtA[i] = 0x1a + } + if m.Pid != 0 { + i = encodeVarintSandbox(dAtA, i, uint64(m.Pid)) + i-- + dAtA[i] = 0x10 + } + if len(m.ID) > 0 { + i -= len(m.ID) + copy(dAtA[i:], m.ID) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.ID))) + i-- dAtA[i] = 0xa } return len(dAtA) - i, nil @@ -2384,8 +2664,14 @@ func (m *ControllerStartRequest) Size() (n int) { if l > 0 { n += 1 + l + sovSandbox(uint64(l)) } - if m.Spec != nil { - l = m.Spec.Size() + if len(m.Rootfs) > 0 { + for _, e := range m.Rootfs { + l = e.Size() + n += 1 + l + sovSandbox(uint64(l)) + } + } + if m.Options != nil { + l = m.Options.Size() n += 1 + l + sovSandbox(uint64(l)) } if m.XXX_unrecognized != nil { @@ -2400,6 +2686,13 @@ func (m *ControllerStartResponse) Size() (n int) { } var l int _ = l + l = len(m.SandboxID) + if l > 0 { + n += 1 + l + sovSandbox(uint64(l)) + } + if m.Pid != 0 { + n += 1 + sovSandbox(uint64(m.Pid)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2416,6 +2709,9 @@ func (m *ControllerShutdownRequest) Size() (n int) { if l > 0 { n += 1 + l + sovSandbox(uint64(l)) } + if m.TimeoutSecs != 0 { + n += 1 + sovSandbox(uint64(m.TimeoutSecs)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2434,6 +2730,39 @@ func (m *ControllerShutdownResponse) Size() (n int) { return n } +func (m *ControllerWaitRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SandboxID) + if l > 0 { + n += 1 + l + sovSandbox(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ControllerWaitResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ExitStatus != 0 { + n += 1 + sovSandbox(uint64(m.ExitStatus)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt) + n += 1 + l + sovSandbox(uint64(l)) + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + func (m *ControllerPauseRequest) Size() (n int) { if m == nil { return 0 @@ -2540,8 +2869,24 @@ func (m *ControllerStatusResponse) Size() (n int) { } var l int _ = l - if m.Status != nil { - l = m.Status.Size() + l = len(m.ID) + if l > 0 { + n += 1 + l + sovSandbox(uint64(l)) + } + if m.Pid != 0 { + n += 1 + sovSandbox(uint64(m.Pid)) + } + l = len(m.State) + if l > 0 { + n += 1 + l + sovSandbox(uint64(l)) + } + if m.ExitStatus != 0 { + n += 1 + sovSandbox(uint64(m.ExitStatus)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt) + n += 1 + l + sovSandbox(uint64(l)) + if m.Extra != nil { + l = m.Extra.Size() n += 1 + l + sovSandbox(uint64(l)) } if m.XXX_unrecognized != nil { @@ -2675,9 +3020,15 @@ func (this *ControllerStartRequest) String() string { if this == nil { return "nil" } + repeatedStringForRootfs := "[]*Mount{" + for _, f := range this.Rootfs { + repeatedStringForRootfs += strings.Replace(fmt.Sprintf("%v", f), "Mount", "types.Mount", 1) + "," + } + repeatedStringForRootfs += "}" s := strings.Join([]string{`&ControllerStartRequest{`, `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, - `Spec:` + strings.Replace(fmt.Sprintf("%v", this.Spec), "Any", "types1.Any", 1) + `,`, + `Rootfs:` + repeatedStringForRootfs + `,`, + `Options:` + strings.Replace(fmt.Sprintf("%v", this.Options), "Any", "types1.Any", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") @@ -2688,6 +3039,8 @@ func (this *ControllerStartResponse) String() string { return "nil" } s := strings.Join([]string{`&ControllerStartResponse{`, + `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, + `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") @@ -2699,6 +3052,7 @@ func (this *ControllerShutdownRequest) String() string { } s := strings.Join([]string{`&ControllerShutdownRequest{`, `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, + `TimeoutSecs:` + fmt.Sprintf("%v", this.TimeoutSecs) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") @@ -2714,6 +3068,29 @@ func (this *ControllerShutdownResponse) String() string { }, "") return s } +func (this *ControllerWaitRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ControllerWaitRequest{`, + `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *ControllerWaitResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ControllerWaitResponse{`, + `ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`, + `ExitedAt:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ExitedAt), "Timestamp", "types1.Timestamp", 1), `&`, ``, 1) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} func (this *ControllerPauseRequest) String() string { if this == nil { return "nil" @@ -2793,7 +3170,12 @@ func (this *ControllerStatusResponse) String() string { return "nil" } s := strings.Join([]string{`&ControllerStatusResponse{`, - `Status:` + strings.Replace(fmt.Sprintf("%v", this.Status), "Any", "types1.Any", 1) + `,`, + `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, + `State:` + fmt.Sprintf("%v", this.State) + `,`, + `ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`, + `ExitedAt:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ExitedAt), "Timestamp", "types1.Timestamp", 1), `&`, ``, 1) + `,`, + `Extra:` + strings.Replace(fmt.Sprintf("%v", this.Extra), "Any", "types1.Any", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") @@ -3708,9 +4090,9 @@ func (m *ControllerStartRequest) Unmarshal(dAtA []byte) error { } m.SandboxID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Rootfs", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3737,10 +4119,44 @@ func (m *ControllerStartRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Spec == nil { - m.Spec = &types1.Any{} + m.Rootfs = append(m.Rootfs, &types.Mount{}) + if err := m.Rootfs[len(m.Rootfs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSandbox + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Options == nil { + m.Options = &types1.Any{} + } + if err := m.Options.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3795,6 +4211,57 @@ func (m *ControllerStartResponse) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: ControllerStartResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SandboxID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSandbox + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SandboxID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType) + } + m.Pid = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Pid |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipSandbox(dAtA[iNdEx:]) @@ -3878,6 +4345,25 @@ func (m *ControllerShutdownRequest) Unmarshal(dAtA []byte) error { } m.SandboxID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TimeoutSecs", wireType) + } + m.TimeoutSecs = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TimeoutSecs |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipSandbox(dAtA[iNdEx:]) @@ -3951,6 +4437,192 @@ func (m *ControllerShutdownResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *ControllerWaitRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ControllerWaitRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ControllerWaitRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SandboxID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSandbox + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SandboxID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ControllerWaitResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ControllerWaitResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ControllerWaitResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExitStatus", wireType) + } + m.ExitStatus = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExitStatus |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExitedAt", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSandbox + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.ExitedAt, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *ControllerPauseRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4467,7 +5139,109 @@ func (m *ControllerStatusResponse) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSandbox + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType) + } + m.Pid = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Pid |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSandbox + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.State = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExitStatus", wireType) + } + m.ExitStatus = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExitStatus |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExitedAt", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4494,10 +5268,43 @@ func (m *ControllerStatusResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Status == nil { - m.Status = &types1.Any{} + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.ExitedAt, dAtA[iNdEx:postIndex]); err != nil { + return err } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Extra", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSandbox + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Extra == nil { + m.Extra = &types1.Any{} + } + if err := m.Extra.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/api/services/sandbox/v1/sandbox.proto b/api/services/sandbox/v1/sandbox.proto index be9d938ed..862f5eee6 100644 --- a/api/services/sandbox/v1/sandbox.proto +++ b/api/services/sandbox/v1/sandbox.proto @@ -25,9 +25,12 @@ syntax = "proto3"; // See proposal and discussion here: https://github.com/containerd/containerd/issues/4131 package containerd.services.sandbox.v1; -import weak "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; +import "google/protobuf/timestamp.proto"; +import weak "gogoproto/gogo.proto"; + import "github.com/containerd/containerd/api/types/sandbox.proto"; +import "github.com/containerd/containerd/api/types/mount.proto"; option go_package = "github.com/containerd/containerd/api/services/sandbox/v1;sandbox"; @@ -85,6 +88,7 @@ message StoreGetResponse { service Controller { rpc Start(ControllerStartRequest) returns (ControllerStartResponse); rpc Shutdown(ControllerShutdownRequest) returns (ControllerShutdownResponse); + rpc Wait(ControllerWaitRequest) returns (ControllerWaitResponse); rpc Pause(ControllerPauseRequest) returns (ControllerPauseResponse); rpc Resume(ControllerResumeRequest) returns (ControllerResumeResponse); rpc Ping(ControllerPingRequest) returns (ControllerPingResponse); @@ -93,18 +97,31 @@ service Controller { message ControllerStartRequest { string sandbox_id = 1; - google.protobuf.Any spec = 4; + repeated containerd.types.Mount rootfs = 2; + google.protobuf.Any options = 3; } message ControllerStartResponse { + string sandbox_id = 1; + uint32 pid = 2; } message ControllerShutdownRequest { string sandbox_id = 1; + uint32 timeout_secs = 2; } message ControllerShutdownResponse {} +message ControllerWaitRequest { + string sandbox_id = 1; +} + +message ControllerWaitResponse { + uint32 exit_status = 1; + google.protobuf.Timestamp exited_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; +} + message ControllerPauseRequest { string sandbox_id = 1; } @@ -128,5 +145,10 @@ message ControllerStatusRequest { } message ControllerStatusResponse { - google.protobuf.Any status = 1; + string id = 1; + uint32 pid = 2; + string state = 3; + uint32 exit_status = 4; + google.protobuf.Timestamp exited_at = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + google.protobuf.Any extra = 6; } diff --git a/runtime/v2/runc/pause/sandbox.go b/runtime/v2/runc/pause/sandbox.go index dc08c33bb..2ef6fc710 100644 --- a/runtime/v2/runc/pause/sandbox.go +++ b/runtime/v2/runc/pause/sandbox.go @@ -73,6 +73,12 @@ func (p *pauseService) StopSandbox(ctx context.Context, req *api.StopSandboxRequ return &api.StopSandboxResponse{}, nil } +func (p *pauseService) WaitSandbox(ctx context.Context, req *api.WaitSandboxRequest) (*api.WaitSandboxResponse, error) { + return &api.WaitSandboxResponse{ + ExitStatus: 0, + }, nil +} + func (p *pauseService) UpdateSandbox(ctx context.Context, req *api.UpdateSandboxRequest) (*api.UpdateSandboxResponse, error) { log.Debugf("update sandbox request: %+v", req) return &api.UpdateSandboxResponse{}, nil diff --git a/runtime/v2/shim.go b/runtime/v2/shim.go index 3c8e2b9a2..4105f2b2b 100644 --- a/runtime/v2/shim.go +++ b/runtime/v2/shim.go @@ -194,6 +194,8 @@ type ShimProcess interface { ID() string // Namespace of this shim. Namespace() string + // Bundle is a file system path to shim's bundle. + Bundle() string // Client returns the underlying TTRPC client for this shim. Client() *ttrpc.Client } @@ -212,6 +214,10 @@ func (s *shim) Namespace() string { return s.bundle.Namespace } +func (s *shim) Bundle() string { + return s.bundle.Path +} + func (s *shim) Close() error { return s.client.Close() } diff --git a/runtime/v2/task/sandbox.pb.go b/runtime/v2/task/sandbox.pb.go index 23cb6402c..83268b854 100644 --- a/runtime/v2/task/sandbox.pb.go +++ b/runtime/v2/task/sandbox.pb.go @@ -6,21 +6,25 @@ package task import ( context "context" fmt "fmt" + types "github.com/containerd/containerd/api/types" github_com_containerd_ttrpc "github.com/containerd/ttrpc" proto "github.com/gogo/protobuf/proto" github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" - types "github.com/gogo/protobuf/types" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + types1 "github.com/gogo/protobuf/types" io "io" math "math" math_bits "math/bits" reflect "reflect" strings "strings" + time "time" ) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf +var _ = time.Kitchen // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -29,11 +33,13 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type StartSandboxRequest struct { - SandboxID string `protobuf:"bytes,1,opt,name=sandbox_id,json=sandboxId,proto3" json:"sandbox_id,omitempty"` - BundlePath string `protobuf:"bytes,2,opt,name=bundle_path,json=bundlePath,proto3" json:"bundle_path,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + SandboxID string `protobuf:"bytes,1,opt,name=sandbox_id,json=sandboxId,proto3" json:"sandbox_id,omitempty"` + BundlePath string `protobuf:"bytes,2,opt,name=bundle_path,json=bundlePath,proto3" json:"bundle_path,omitempty"` + Rootfs []*types.Mount `protobuf:"bytes,3,rep,name=rootfs,proto3" json:"rootfs,omitempty"` + Options *types1.Any `protobuf:"bytes,4,opt,name=options,proto3" json:"options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *StartSandboxRequest) Reset() { *m = StartSandboxRequest{} } @@ -69,7 +75,7 @@ func (m *StartSandboxRequest) XXX_DiscardUnknown() { var xxx_messageInfo_StartSandboxRequest proto.InternalMessageInfo type StartSandboxResponse struct { - Pid string `protobuf:"bytes,1,opt,name=pid,proto3" json:"pid,omitempty"` + Pid uint32 `protobuf:"varint,1,opt,name=pid,proto3" json:"pid,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -187,7 +193,7 @@ var xxx_messageInfo_StopSandboxResponse proto.InternalMessageInfo type UpdateSandboxRequest struct { SandboxID string `protobuf:"bytes,1,opt,name=sandbox_id,json=sandboxId,proto3" json:"sandbox_id,omitempty"` - Resources *types.Any `protobuf:"bytes,2,opt,name=resources,proto3" json:"resources,omitempty"` + Resources *types1.Any `protobuf:"bytes,2,opt,name=resources,proto3" json:"resources,omitempty"` Annotations map[string]string `protobuf:"bytes,3,rep,name=annotations,proto3" json:"annotations,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -226,6 +232,85 @@ func (m *UpdateSandboxRequest) XXX_DiscardUnknown() { var xxx_messageInfo_UpdateSandboxRequest proto.InternalMessageInfo +type WaitSandboxRequest struct { + SandboxID string `protobuf:"bytes,1,opt,name=sandbox_id,json=sandboxId,proto3" json:"sandbox_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *WaitSandboxRequest) Reset() { *m = WaitSandboxRequest{} } +func (*WaitSandboxRequest) ProtoMessage() {} +func (*WaitSandboxRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_1a2e6d1f55947a07, []int{5} +} +func (m *WaitSandboxRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *WaitSandboxRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_WaitSandboxRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *WaitSandboxRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_WaitSandboxRequest.Merge(m, src) +} +func (m *WaitSandboxRequest) XXX_Size() int { + return m.Size() +} +func (m *WaitSandboxRequest) XXX_DiscardUnknown() { + xxx_messageInfo_WaitSandboxRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_WaitSandboxRequest proto.InternalMessageInfo + +type WaitSandboxResponse struct { + ExitStatus uint32 `protobuf:"varint,1,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"` + ExitedAt time.Time `protobuf:"bytes,2,opt,name=exited_at,json=exitedAt,proto3,stdtime" json:"exited_at"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *WaitSandboxResponse) Reset() { *m = WaitSandboxResponse{} } +func (*WaitSandboxResponse) ProtoMessage() {} +func (*WaitSandboxResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_1a2e6d1f55947a07, []int{6} +} +func (m *WaitSandboxResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *WaitSandboxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_WaitSandboxResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *WaitSandboxResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_WaitSandboxResponse.Merge(m, src) +} +func (m *WaitSandboxResponse) XXX_Size() int { + return m.Size() +} +func (m *WaitSandboxResponse) XXX_DiscardUnknown() { + xxx_messageInfo_WaitSandboxResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_WaitSandboxResponse proto.InternalMessageInfo + type UpdateSandboxResponse struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -235,7 +320,7 @@ type UpdateSandboxResponse struct { func (m *UpdateSandboxResponse) Reset() { *m = UpdateSandboxResponse{} } func (*UpdateSandboxResponse) ProtoMessage() {} func (*UpdateSandboxResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1a2e6d1f55947a07, []int{5} + return fileDescriptor_1a2e6d1f55947a07, []int{7} } func (m *UpdateSandboxResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -274,7 +359,7 @@ type SandboxStatusRequest struct { func (m *SandboxStatusRequest) Reset() { *m = SandboxStatusRequest{} } func (*SandboxStatusRequest) ProtoMessage() {} func (*SandboxStatusRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1a2e6d1f55947a07, []int{6} + return fileDescriptor_1a2e6d1f55947a07, []int{8} } func (m *SandboxStatusRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -313,7 +398,7 @@ type PauseSandboxRequest struct { func (m *PauseSandboxRequest) Reset() { *m = PauseSandboxRequest{} } func (*PauseSandboxRequest) ProtoMessage() {} func (*PauseSandboxRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1a2e6d1f55947a07, []int{7} + return fileDescriptor_1a2e6d1f55947a07, []int{9} } func (m *PauseSandboxRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -351,7 +436,7 @@ type PauseSandboxResponse struct { func (m *PauseSandboxResponse) Reset() { *m = PauseSandboxResponse{} } func (*PauseSandboxResponse) ProtoMessage() {} func (*PauseSandboxResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1a2e6d1f55947a07, []int{8} + return fileDescriptor_1a2e6d1f55947a07, []int{10} } func (m *PauseSandboxResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -390,7 +475,7 @@ type ResumeSandboxRequest struct { func (m *ResumeSandboxRequest) Reset() { *m = ResumeSandboxRequest{} } func (*ResumeSandboxRequest) ProtoMessage() {} func (*ResumeSandboxRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1a2e6d1f55947a07, []int{9} + return fileDescriptor_1a2e6d1f55947a07, []int{11} } func (m *ResumeSandboxRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -428,7 +513,7 @@ type ResumeSandboxResponse struct { func (m *ResumeSandboxResponse) Reset() { *m = ResumeSandboxResponse{} } func (*ResumeSandboxResponse) ProtoMessage() {} func (*ResumeSandboxResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1a2e6d1f55947a07, []int{10} + return fileDescriptor_1a2e6d1f55947a07, []int{12} } func (m *ResumeSandboxResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -458,16 +543,21 @@ func (m *ResumeSandboxResponse) XXX_DiscardUnknown() { var xxx_messageInfo_ResumeSandboxResponse proto.InternalMessageInfo type SandboxStatusResponse struct { - Status *types.Any `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Pid uint32 `protobuf:"varint,2,opt,name=pid,proto3" json:"pid,omitempty"` + State string `protobuf:"bytes,3,opt,name=state,proto3" json:"state,omitempty"` + ExitStatus uint32 `protobuf:"varint,4,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"` + ExitedAt time.Time `protobuf:"bytes,5,opt,name=exited_at,json=exitedAt,proto3,stdtime" json:"exited_at"` + Extra *types1.Any `protobuf:"bytes,6,opt,name=extra,proto3" json:"extra,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *SandboxStatusResponse) Reset() { *m = SandboxStatusResponse{} } func (*SandboxStatusResponse) ProtoMessage() {} func (*SandboxStatusResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1a2e6d1f55947a07, []int{11} + return fileDescriptor_1a2e6d1f55947a07, []int{13} } func (m *SandboxStatusResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -506,7 +596,7 @@ type PingRequest struct { func (m *PingRequest) Reset() { *m = PingRequest{} } func (*PingRequest) ProtoMessage() {} func (*PingRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1a2e6d1f55947a07, []int{12} + return fileDescriptor_1a2e6d1f55947a07, []int{14} } func (m *PingRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -544,7 +634,7 @@ type PingResponse struct { func (m *PingResponse) Reset() { *m = PingResponse{} } func (*PingResponse) ProtoMessage() {} func (*PingResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1a2e6d1f55947a07, []int{13} + return fileDescriptor_1a2e6d1f55947a07, []int{15} } func (m *PingResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -580,6 +670,8 @@ func init() { proto.RegisterType((*StopSandboxResponse)(nil), "containerd.task.v2.StopSandboxResponse") proto.RegisterType((*UpdateSandboxRequest)(nil), "containerd.task.v2.UpdateSandboxRequest") proto.RegisterMapType((map[string]string)(nil), "containerd.task.v2.UpdateSandboxRequest.AnnotationsEntry") + proto.RegisterType((*WaitSandboxRequest)(nil), "containerd.task.v2.WaitSandboxRequest") + proto.RegisterType((*WaitSandboxResponse)(nil), "containerd.task.v2.WaitSandboxResponse") proto.RegisterType((*UpdateSandboxResponse)(nil), "containerd.task.v2.UpdateSandboxResponse") proto.RegisterType((*SandboxStatusRequest)(nil), "containerd.task.v2.SandboxStatusRequest") proto.RegisterType((*PauseSandboxRequest)(nil), "containerd.task.v2.PauseSandboxRequest") @@ -596,44 +688,57 @@ func init() { } var fileDescriptor_1a2e6d1f55947a07 = []byte{ - // 588 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x4d, 0x6f, 0xda, 0x40, - 0x10, 0x8d, 0x41, 0x49, 0xc5, 0x18, 0xaa, 0x68, 0x63, 0x1a, 0xea, 0x83, 0xa1, 0x3e, 0x34, 0x54, - 0x8a, 0x6c, 0xc9, 0xbd, 0xf4, 0x43, 0x8a, 0x94, 0x34, 0x39, 0xe4, 0x86, 0x8c, 0x7a, 0xaa, 0x54, - 0xb4, 0xe0, 0x2d, 0x58, 0xc0, 0xae, 0xeb, 0x5d, 0xa3, 0x72, 0xeb, 0x9f, 0xe8, 0x2f, 0xe9, 0x9f, - 0xc8, 0xb1, 0xc7, 0x9e, 0xaa, 0x86, 0x5f, 0x52, 0x99, 0x5d, 0x84, 0xa1, 0x1b, 0x25, 0x0a, 0xb7, - 0x65, 0x79, 0xfb, 0xde, 0xcc, 0x9b, 0x37, 0x86, 0xb3, 0x61, 0x2c, 0x46, 0x59, 0xdf, 0x1b, 0xb0, - 0xa9, 0x3f, 0x60, 0x54, 0xe0, 0x98, 0x92, 0x34, 0x2a, 0x1e, 0xd3, 0x8c, 0x8a, 0x78, 0x4a, 0xfc, - 0x59, 0xe0, 0x0b, 0xcc, 0xc7, 0x3e, 0xc7, 0x34, 0xea, 0xb3, 0x6f, 0x5e, 0x92, 0x32, 0xc1, 0x10, - 0x5a, 0x23, 0xbd, 0xfc, 0x6f, 0x6f, 0x16, 0xd8, 0xcf, 0x87, 0x8c, 0x0d, 0x27, 0xc4, 0x5f, 0x22, - 0xfa, 0xd9, 0x17, 0x1f, 0xd3, 0xb9, 0x84, 0xbb, 0x11, 0x1c, 0x75, 0x05, 0x4e, 0x45, 0x57, 0x92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6d, 0xf5, 0x2a, 0xfa, - 0x78, 0x77, 0x64, 0x60, 0x57, 0x9d, 0x34, 0xb5, 0x26, 0xac, 0x13, 0x6d, 0xb7, 0xee, 0x06, 0x48, - 0xc6, 0x8b, 0xc6, 0xcd, 0xad, 0xb3, 0xf7, 0xfb, 0xd6, 0xd9, 0xfb, 0xbe, 0x70, 0x8c, 0x9b, 0x85, - 0x63, 0xfc, 0x5a, 0x38, 0xc6, 0xdf, 0x85, 0x63, 0xf4, 0x0f, 0x96, 0x2b, 0xf3, 0xfa, 0x5f, 0x00, - 0x00, 0x00, 0xff, 0xff, 0xb3, 0x37, 0xc5, 0x44, 0x1c, 0x07, 0x00, 0x00, + // 790 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x4f, 0x6b, 0xfb, 0x46, + 0x10, 0x8d, 0xe4, 0xc4, 0x89, 0x47, 0x76, 0x09, 0x1b, 0x3b, 0x71, 0x75, 0xb0, 0x5c, 0x1d, 0x1a, + 0xb7, 0x14, 0x09, 0x5c, 0x28, 0xfd, 0x03, 0x01, 0xbb, 0xe9, 0x21, 0x87, 0x82, 0x91, 0x5b, 0x5a, + 0x28, 0xd4, 0xac, 0xad, 0x8d, 0x23, 0x12, 0x6b, 0x55, 0xed, 0x2a, 0xc4, 0xb7, 0x7e, 0x84, 0x42, + 0xe9, 0x47, 0x2a, 0xe4, 0xd8, 0x63, 0x4f, 0x69, 0xe3, 0xcb, 0xef, 0x6b, 0xfc, 0x58, 0xef, 0x3a, + 0x96, 0x9d, 0xcd, 0x1f, 0xe2, 0xdb, 0x6a, 0xf5, 0xf6, 0xcd, 0xcc, 0x9b, 0x79, 0x03, 0x27, 0xe3, + 0x88, 0x5f, 0x64, 0x43, 0x6f, 0x44, 0x27, 0xfe, 0x88, 0xc6, 0x1c, 0x47, 0x31, 0x49, 0xc3, 0xfc, + 0x31, 0xcd, 0x62, 0x1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0x39, 0x6f, 0xea, 0xf9, 0x1f, 0x2f, 0x00, 0x3d, + 0xbf, 0xce, 0xe4, 0x21, 0x54, 0x56, 0x0c, 0x88, 0x5a, 0xaf, 0x5d, 0x6c, 0xf6, 0x27, 0xaf, 0x40, + 0xaa, 0x28, 0x18, 0xca, 0x79, 0x0b, 0xe9, 0x1b, 0xa1, 0x71, 0xaa, 0xbe, 0x11, 0x3a, 0x37, 0x8a, + 0x42, 0x56, 0x7c, 0xa4, 0x2f, 0x44, 0x67, 0x58, 0x7d, 0x21, 0x5a, 0x53, 0x8a, 0x28, 0x2b, 0x9e, + 0xd4, 0x47, 0xd1, 0x6d, 0x2e, 0x7d, 0x14, 0xbd, 0xc1, 0x7b, 0xd2, 0x10, 0x8b, 0x4a, 0x1c, 0xad, + 0x08, 0x4b, 0xc7, 0xd8, 0xcd, 0xa7, 0x01, 0x92, 0xb1, 0x5b, 0xbf, 0xbd, 0x6f, 0x6c, 0xfd, 0x7b, + 0xdf, 0xd8, 0xfa, 0x7d, 0xd6, 0x30, 0x6e, 0x67, 0x0d, 0xe3, 0x9f, 0x59, 0xc3, 0xf8, 0x7f, 0xd6, + 0x30, 0x7e, 0x36, 0x87, 0xc5, 0xb9, 0x27, 0x3f, 0x7f, 0x1f, 0x00, 0x00, 0xff, 0xff, 0x6e, 0x96, + 0x09, 0x90, 0xb1, 0x09, 0x00, 0x00, } func (m *StartSandboxRequest) Marshal() (dAtA []byte, err error) { @@ -660,6 +765,32 @@ func (m *StartSandboxRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + if m.Options != nil { + { + size, err := m.Options.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSandbox(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if len(m.Rootfs) > 0 { + for iNdEx := len(m.Rootfs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Rootfs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSandbox(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } if len(m.BundlePath) > 0 { i -= len(m.BundlePath) copy(dAtA[i:], m.BundlePath) @@ -701,12 +832,10 @@ func (m *StartSandboxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if len(m.Pid) > 0 { - i -= len(m.Pid) - copy(dAtA[i:], m.Pid) - i = encodeVarintSandbox(dAtA, i, uint64(len(m.Pid))) + if m.Pid != 0 { + i = encodeVarintSandbox(dAtA, i, uint64(m.Pid)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } return len(dAtA) - i, nil } @@ -842,6 +971,80 @@ func (m *UpdateSandboxRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *WaitSandboxRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WaitSandboxRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WaitSandboxRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.SandboxID) > 0 { + i -= len(m.SandboxID) + copy(dAtA[i:], m.SandboxID) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.SandboxID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *WaitSandboxResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WaitSandboxResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WaitSandboxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExitedAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt):]) + if err3 != nil { + return 0, err3 + } + i -= n3 + i = encodeVarintSandbox(dAtA, i, uint64(n3)) + i-- + dAtA[i] = 0x12 + if m.ExitStatus != 0 { + i = encodeVarintSandbox(dAtA, i, uint64(m.ExitStatus)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func (m *UpdateSandboxResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1049,9 +1252,9 @@ func (m *SandboxStatusResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.Status != nil { + if m.Extra != nil { { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Extra.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1059,6 +1262,38 @@ func (m *SandboxStatusResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintSandbox(dAtA, i, uint64(size)) } i-- + dAtA[i] = 0x32 + } + n5, err5 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExitedAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt):]) + if err5 != nil { + return 0, err5 + } + i -= n5 + i = encodeVarintSandbox(dAtA, i, uint64(n5)) + i-- + dAtA[i] = 0x2a + if m.ExitStatus != 0 { + i = encodeVarintSandbox(dAtA, i, uint64(m.ExitStatus)) + i-- + dAtA[i] = 0x20 + } + if len(m.State) > 0 { + i -= len(m.State) + copy(dAtA[i:], m.State) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.State))) + i-- + dAtA[i] = 0x1a + } + if m.Pid != 0 { + i = encodeVarintSandbox(dAtA, i, uint64(m.Pid)) + i-- + dAtA[i] = 0x10 + } + if len(m.ID) > 0 { + i -= len(m.ID) + copy(dAtA[i:], m.ID) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.ID))) + i-- dAtA[i] = 0xa } return len(dAtA) - i, nil @@ -1150,6 +1385,16 @@ func (m *StartSandboxRequest) Size() (n int) { if l > 0 { n += 1 + l + sovSandbox(uint64(l)) } + if len(m.Rootfs) > 0 { + for _, e := range m.Rootfs { + l = e.Size() + n += 1 + l + sovSandbox(uint64(l)) + } + } + if m.Options != nil { + l = m.Options.Size() + n += 1 + l + sovSandbox(uint64(l)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -1162,9 +1407,8 @@ func (m *StartSandboxResponse) Size() (n int) { } var l int _ = l - l = len(m.Pid) - if l > 0 { - n += 1 + l + sovSandbox(uint64(l)) + if m.Pid != 0 { + n += 1 + sovSandbox(uint64(m.Pid)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) @@ -1231,6 +1475,39 @@ func (m *UpdateSandboxRequest) Size() (n int) { return n } +func (m *WaitSandboxRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SandboxID) + if l > 0 { + n += 1 + l + sovSandbox(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *WaitSandboxResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ExitStatus != 0 { + n += 1 + sovSandbox(uint64(m.ExitStatus)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt) + n += 1 + l + sovSandbox(uint64(l)) + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + func (m *UpdateSandboxResponse) Size() (n int) { if m == nil { return 0 @@ -1321,8 +1598,24 @@ func (m *SandboxStatusResponse) Size() (n int) { } var l int _ = l - if m.Status != nil { - l = m.Status.Size() + l = len(m.ID) + if l > 0 { + n += 1 + l + sovSandbox(uint64(l)) + } + if m.Pid != 0 { + n += 1 + sovSandbox(uint64(m.Pid)) + } + l = len(m.State) + if l > 0 { + n += 1 + l + sovSandbox(uint64(l)) + } + if m.ExitStatus != 0 { + n += 1 + sovSandbox(uint64(m.ExitStatus)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt) + n += 1 + l + sovSandbox(uint64(l)) + if m.Extra != nil { + l = m.Extra.Size() n += 1 + l + sovSandbox(uint64(l)) } if m.XXX_unrecognized != nil { @@ -1369,9 +1662,16 @@ func (this *StartSandboxRequest) String() string { if this == nil { return "nil" } + repeatedStringForRootfs := "[]*Mount{" + for _, f := range this.Rootfs { + repeatedStringForRootfs += strings.Replace(fmt.Sprintf("%v", f), "Mount", "types.Mount", 1) + "," + } + repeatedStringForRootfs += "}" s := strings.Join([]string{`&StartSandboxRequest{`, `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, `BundlePath:` + fmt.Sprintf("%v", this.BundlePath) + `,`, + `Rootfs:` + repeatedStringForRootfs + `,`, + `Options:` + strings.Replace(fmt.Sprintf("%v", this.Options), "Any", "types1.Any", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") @@ -1426,13 +1726,36 @@ func (this *UpdateSandboxRequest) String() string { mapStringForAnnotations += "}" s := strings.Join([]string{`&UpdateSandboxRequest{`, `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, - `Resources:` + strings.Replace(fmt.Sprintf("%v", this.Resources), "Any", "types.Any", 1) + `,`, + `Resources:` + strings.Replace(fmt.Sprintf("%v", this.Resources), "Any", "types1.Any", 1) + `,`, `Annotations:` + mapStringForAnnotations + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } +func (this *WaitSandboxRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&WaitSandboxRequest{`, + `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *WaitSandboxResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&WaitSandboxResponse{`, + `ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`, + `ExitedAt:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ExitedAt), "Timestamp", "types1.Timestamp", 1), `&`, ``, 1) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} func (this *UpdateSandboxResponse) String() string { if this == nil { return "nil" @@ -1501,7 +1824,12 @@ func (this *SandboxStatusResponse) String() string { return "nil" } s := strings.Join([]string{`&SandboxStatusResponse{`, - `Status:` + strings.Replace(fmt.Sprintf("%v", this.Status), "Any", "types.Any", 1) + `,`, + `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, + `State:` + fmt.Sprintf("%v", this.State) + `,`, + `ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`, + `ExitedAt:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ExitedAt), "Timestamp", "types1.Timestamp", 1), `&`, ``, 1) + `,`, + `Extra:` + strings.Replace(fmt.Sprintf("%v", this.Extra), "Any", "types1.Any", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") @@ -1540,6 +1868,7 @@ func valueToStringSandbox(v interface{}) string { type SandboxService interface { StartSandbox(ctx context.Context, req *StartSandboxRequest) (*StartSandboxResponse, error) StopSandbox(ctx context.Context, req *StopSandboxRequest) (*StopSandboxResponse, error) + WaitSandbox(ctx context.Context, req *WaitSandboxRequest) (*WaitSandboxResponse, error) UpdateSandbox(ctx context.Context, req *UpdateSandboxRequest) (*UpdateSandboxResponse, error) PauseSandbox(ctx context.Context, req *PauseSandboxRequest) (*PauseSandboxResponse, error) ResumeSandbox(ctx context.Context, req *ResumeSandboxRequest) (*ResumeSandboxResponse, error) @@ -1563,6 +1892,13 @@ func RegisterSandboxService(srv *github_com_containerd_ttrpc.Server, svc Sandbox } return svc.StopSandbox(ctx, &req) }, + "WaitSandbox": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) { + var req WaitSandboxRequest + if err := unmarshal(&req); err != nil { + return nil, err + } + return svc.WaitSandbox(ctx, &req) + }, "UpdateSandbox": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) { var req UpdateSandboxRequest if err := unmarshal(&req); err != nil { @@ -1627,6 +1963,14 @@ func (c *sandboxClient) StopSandbox(ctx context.Context, req *StopSandboxRequest return &resp, nil } +func (c *sandboxClient) WaitSandbox(ctx context.Context, req *WaitSandboxRequest) (*WaitSandboxResponse, error) { + var resp WaitSandboxResponse + if err := c.client.Call(ctx, "containerd.task.v2.Sandbox", "WaitSandbox", req, &resp); err != nil { + return nil, err + } + return &resp, nil +} + func (c *sandboxClient) UpdateSandbox(ctx context.Context, req *UpdateSandboxRequest) (*UpdateSandboxResponse, error) { var resp UpdateSandboxResponse if err := c.client.Call(ctx, "containerd.task.v2.Sandbox", "UpdateSandbox", req, &resp); err != nil { @@ -1759,6 +2103,76 @@ func (m *StartSandboxRequest) Unmarshal(dAtA []byte) error { } m.BundlePath = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Rootfs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSandbox + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Rootfs = append(m.Rootfs, &types.Mount{}) + if err := m.Rootfs[len(m.Rootfs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSandbox + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Options == nil { + m.Options = &types1.Any{} + } + if err := m.Options.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipSandbox(dAtA[iNdEx:]) @@ -1811,10 +2225,10 @@ func (m *StartSandboxResponse) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType) } - var stringLen uint64 + m.Pid = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowSandbox @@ -1824,24 +2238,11 @@ func (m *StartSandboxResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.Pid |= uint32(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSandbox - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSandbox - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Pid = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipSandbox(dAtA[iNdEx:]) @@ -2108,7 +2509,7 @@ func (m *UpdateSandboxRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Resources == nil { - m.Resources = &types.Any{} + m.Resources = &types1.Any{} } if err := m.Resources.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -2263,6 +2664,192 @@ func (m *UpdateSandboxRequest) Unmarshal(dAtA []byte) error { } return nil } +func (m *WaitSandboxRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: WaitSandboxRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WaitSandboxRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SandboxID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSandbox + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SandboxID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WaitSandboxResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: WaitSandboxResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WaitSandboxResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExitStatus", wireType) + } + m.ExitStatus = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExitStatus |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExitedAt", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSandbox + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.ExitedAt, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *UpdateSandboxResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2696,7 +3283,109 @@ func (m *SandboxStatusResponse) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSandbox + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType) + } + m.Pid = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Pid |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSandbox + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.State = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExitStatus", wireType) + } + m.ExitStatus = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExitStatus |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExitedAt", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2723,10 +3412,43 @@ func (m *SandboxStatusResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Status == nil { - m.Status = &types.Any{} + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.ExitedAt, dAtA[iNdEx:postIndex]); err != nil { + return err } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Extra", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSandbox + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Extra == nil { + m.Extra = &types1.Any{} + } + if err := m.Extra.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/runtime/v2/task/sandbox.proto b/runtime/v2/task/sandbox.proto index cb7caac4e..6ef735391 100644 --- a/runtime/v2/task/sandbox.proto +++ b/runtime/v2/task/sandbox.proto @@ -19,6 +19,10 @@ syntax = "proto3"; package containerd.task.v2; import "google/protobuf/any.proto"; +import "google/protobuf/timestamp.proto"; +import weak "gogoproto/gogo.proto"; + +import "github.com/containerd/containerd/api/types/mount.proto"; // Sandbox is an optional interface that shim may implement to support sandboxes environments. // A typical example of sandbox is microVM or pause container - an entity that groups containers and/or @@ -30,6 +34,9 @@ service Sandbox { // StopSandbox will stop existing sandbox instance rpc StopSandbox(StopSandboxRequest) returns (StopSandboxResponse); + // WaitSandbox blocks until sanbox exits. + rpc WaitSandbox(WaitSandboxRequest) returns (WaitSandboxResponse); + // Update can be used to amend the state of currently running sandbox instance (depending on // implementation this can be used to resize/reacquire needed resources like RAM/CPU). rpc UpdateSandbox(UpdateSandboxRequest) returns (UpdateSandboxResponse); @@ -50,10 +57,12 @@ service Sandbox { message StartSandboxRequest { string sandbox_id = 1; string bundle_path = 2; + repeated containerd.types.Mount rootfs = 3; + google.protobuf.Any options = 4; } message StartSandboxResponse { - string pid = 1; + uint32 pid = 1; } message StopSandboxRequest { @@ -69,6 +78,15 @@ message UpdateSandboxRequest { map annotations = 3; } +message WaitSandboxRequest { + string sandbox_id = 1; +} + +message WaitSandboxResponse { + uint32 exit_status = 1; + google.protobuf.Timestamp exited_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; +} + message UpdateSandboxResponse {} message SandboxStatusRequest { @@ -88,7 +106,12 @@ message ResumeSandboxRequest { message ResumeSandboxResponse {} message SandboxStatusResponse { - google.protobuf.Any status = 1; + string id = 1; + uint32 pid = 2; + string state = 3; + uint32 exit_status = 4; + google.protobuf.Timestamp exited_at = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + google.protobuf.Any extra = 6; } message PingRequest { diff --git a/sandbox.go b/sandbox.go index c3795649f..b6225648c 100644 --- a/sandbox.go +++ b/sandbox.go @@ -18,6 +18,7 @@ package containerd import ( "context" + "fmt" "time" "github.com/containerd/containerd/containers" @@ -32,6 +33,8 @@ import ( type Sandbox interface { // ID is a sandbox identifier ID() string + // PID returns sandbox's process PID or error if its not yet started. + PID() (uint32, error) // NewContainer creates new container that will belong to this sandbox NewContainer(ctx context.Context, id string, opts ...NewContainerOpts) (Container, error) // Labels returns the labels set on the sandbox @@ -40,19 +43,20 @@ type Sandbox interface { Start(ctx context.Context) error // Stop sends stop request to the shim instance. Stop(ctx context.Context) error + // Wait blocks until sandbox process exits. + Wait(ctx context.Context) (<-chan ExitStatus, error) // Delete removes sandbox from the metadata store. Delete(ctx context.Context) error // Pause will freeze running sandbox instance Pause(ctx context.Context) error // Resume will unfreeze previously paused sandbox instance Resume(ctx context.Context) error - // Status will return current sandbox status (provided by shim runtime) - Status(ctx context.Context, status interface{}) error // Ping will check whether existing sandbox instance alive Ping(ctx context.Context) error } type sandboxClient struct { + pid *uint32 client *Client metadata api.Sandbox } @@ -61,6 +65,14 @@ func (s *sandboxClient) ID() string { return s.metadata.ID } +func (s *sandboxClient) PID() (uint32, error) { + if s.pid == nil { + return 0, fmt.Errorf("sandbox not started") + } + + return *s.pid, nil +} + func (s *sandboxClient) NewContainer(ctx context.Context, id string, opts ...NewContainerOpts) (Container, error) { return s.client.NewContainer(ctx, id, append(opts, WithSandbox(s.ID()))...) } @@ -75,7 +87,36 @@ func (s *sandboxClient) Labels(ctx context.Context) (map[string]string, error) { } func (s *sandboxClient) Start(ctx context.Context) error { - return s.client.SandboxController().Start(ctx, s.ID()) + pid, err := s.client.SandboxController().Start(ctx, s.ID()) + if err != nil { + return err + } + + s.pid = &pid + return nil +} + +func (s *sandboxClient) Wait(ctx context.Context) (<-chan ExitStatus, error) { + c := make(chan ExitStatus, 1) + go func() { + defer close(c) + + resp, err := s.client.SandboxController().Wait(ctx, s.ID()) + if err != nil { + c <- ExitStatus{ + code: UnknownExitStatus, + err: err, + } + return + } + + c <- ExitStatus{ + code: resp.ExitStatus, + exitedAt: resp.ExitedAt, + } + }() + + return c, nil } func (s *sandboxClient) Stop(ctx context.Context) error { @@ -98,19 +139,6 @@ func (s *sandboxClient) Ping(ctx context.Context) error { return s.client.SandboxController().Ping(ctx, s.ID()) } -func (s *sandboxClient) Status(ctx context.Context, status interface{}) error { - any, err := s.client.SandboxController().Status(ctx, s.ID()) - if err != nil { - return err - } - - if err := typeurl.UnmarshalTo(any, status); err != nil { - return errors.Wrap(err, "failed to unmarshal sandbox status") - } - - return nil -} - // NewSandbox creates new sandbox client func (c *Client) NewSandbox(ctx context.Context, sandboxID string, opts ...NewSandboxOpts) (Sandbox, error) { if sandboxID == "" { @@ -135,6 +163,7 @@ func (c *Client) NewSandbox(ctx context.Context, sandboxID string, opts ...NewSa } return &sandboxClient{ + pid: nil, // Not yet started client: c, metadata: metadata, }, nil @@ -147,7 +176,13 @@ func (c *Client) LoadSandbox(ctx context.Context, id string) (Sandbox, error) { return nil, err } + status, err := c.SandboxController().Status(ctx, id) + if err != nil { + return nil, fmt.Errorf("failed to load sandbox %s, status request failed: %w", id, err) + } + return &sandboxClient{ + pid: &status.Pid, client: c, metadata: sandbox, }, nil diff --git a/sandbox/controller.go b/sandbox/controller.go index b0c24953f..6b77f3cae 100644 --- a/sandbox/controller.go +++ b/sandbox/controller.go @@ -19,7 +19,7 @@ package sandbox import ( "context" - "github.com/gogo/protobuf/types" + "github.com/containerd/containerd/api/services/sandbox/v1" ) // Controller is an interface to manage sandboxes at runtime. @@ -44,9 +44,11 @@ type Controller interface { // containerd will run new shim runtime instance and will invoke Start to create a sandbox process. // This routine must be invoked before scheduling containers on this instance. // Once started clients may run containers via Task service (additionally specifying sandbox id the container will belong to). - Start(ctx context.Context, sandboxID string) error + Start(ctx context.Context, sandboxID string) (uint32, error) // Shutdown deletes and cleans all tasks and sandbox instance. Shutdown(ctx context.Context, sandboxID string) error + // Wait blocks until sandbox process exits. + Wait(ctx context.Context, sandboxID string) (*sandbox.ControllerWaitResponse, error) // Pause will freeze running sandbox instance. // Shim implementations may return ErrNotImplemented if this is out of scope of a given sandbox. Pause(ctx context.Context, sandboxID string) error @@ -57,5 +59,5 @@ type Controller interface { Ping(ctx context.Context, sandboxID string) error // Status will query sandbox process status. It is heavier than Ping call and must be used whenever you need to // gather metadata about current sandbox state (status, uptime, resource use, etc). - Status(ctx context.Context, sandboxID string) (*types.Any, error) + Status(ctx context.Context, sandboxID string) (*sandbox.ControllerStatusResponse, error) } diff --git a/sandbox_controller.go b/sandbox_controller.go index ecb7e093d..2093783bd 100644 --- a/sandbox_controller.go +++ b/sandbox_controller.go @@ -22,7 +22,6 @@ import ( api "github.com/containerd/containerd/api/services/sandbox/v1" "github.com/containerd/containerd/errdefs" sb "github.com/containerd/containerd/sandbox" - "github.com/gogo/protobuf/types" ) // sandboxRemoteController is a low level GRPC client for containerd's sandbox controller service @@ -37,14 +36,13 @@ func NewSandboxRemoteController(client api.ControllerClient) sb.Controller { return &sandboxRemoteController{client: client} } -func (s *sandboxRemoteController) Start(ctx context.Context, sandboxID string) error { - if _, err := s.client.Start(ctx, &api.ControllerStartRequest{ - SandboxID: sandboxID, - }); err != nil { - return errdefs.FromGRPC(err) +func (s *sandboxRemoteController) Start(ctx context.Context, sandboxID string) (uint32, error) { + resp, err := s.client.Start(ctx, &api.ControllerStartRequest{SandboxID: sandboxID}) + if err != nil { + return 0, errdefs.FromGRPC(err) } - return nil + return resp.Pid, nil } func (s *sandboxRemoteController) Shutdown(ctx context.Context, sandboxID string) error { @@ -56,6 +54,15 @@ func (s *sandboxRemoteController) Shutdown(ctx context.Context, sandboxID string return nil } +func (s *sandboxRemoteController) Wait(ctx context.Context, sandboxID string) (*api.ControllerWaitResponse, error) { + resp, err := s.client.Wait(ctx, &api.ControllerWaitRequest{SandboxID: sandboxID}) + if err != nil { + return nil, errdefs.FromGRPC(err) + } + + return resp, nil +} + func (s *sandboxRemoteController) Pause(ctx context.Context, sandboxID string) error { _, err := s.client.Pause(ctx, &api.ControllerPauseRequest{SandboxID: sandboxID}) if err != nil { @@ -82,11 +89,11 @@ func (s *sandboxRemoteController) Ping(ctx context.Context, sandboxID string) er return nil } -func (s *sandboxRemoteController) Status(ctx context.Context, sandboxID string) (*types.Any, error) { +func (s *sandboxRemoteController) Status(ctx context.Context, sandboxID string) (*api.ControllerStatusResponse, error) { resp, err := s.client.Status(ctx, &api.ControllerStatusRequest{SandboxID: sandboxID}) if err != nil { return nil, errdefs.FromGRPC(err) } - return resp.Status, nil + return resp, nil } diff --git a/services/sandbox/controller_local.go b/services/sandbox/controller_local.go index 0fd448fac..8ea42096f 100644 --- a/services/sandbox/controller_local.go +++ b/services/sandbox/controller_local.go @@ -108,15 +108,21 @@ func (c *controllerLocal) Start(ctx context.Context, in *api.ControllerStartRequ svc := task.NewSandboxClient(shim.Client()) - _, err = svc.StartSandbox(ctx, &proto.StartSandboxRequest{ - SandboxID: in.SandboxID, + resp, err := svc.StartSandbox(ctx, &proto.StartSandboxRequest{ + SandboxID: in.SandboxID, + BundlePath: shim.Bundle(), + Rootfs: in.Rootfs, + Options: in.Options, }) if err != nil { return nil, fmt.Errorf("failed to start sandbox %s: %w", in.SandboxID, err) } - return &api.ControllerStartResponse{}, nil + return &api.ControllerStartResponse{ + SandboxID: in.SandboxID, + Pid: resp.Pid, + }, nil } func (c *controllerLocal) Shutdown(ctx context.Context, in *api.ControllerShutdownRequest, opts ...grpc.CallOption) (*api.ControllerShutdownResponse, error) { @@ -127,7 +133,7 @@ func (c *controllerLocal) Shutdown(ctx context.Context, in *api.ControllerShutdo if _, err := svc.StopSandbox(ctx, &proto.StopSandboxRequest{ SandboxID: in.SandboxID, - TimeoutSecs: 0, + TimeoutSecs: in.TimeoutSecs, }); err != nil { return nil, fmt.Errorf("failed to stop sandbox: %w", err) } @@ -139,6 +145,26 @@ func (c *controllerLocal) Shutdown(ctx context.Context, in *api.ControllerShutdo return &api.ControllerShutdownResponse{}, nil } +func (c *controllerLocal) Wait(ctx context.Context, in *api.ControllerWaitRequest, opts ...grpc.CallOption) (*api.ControllerWaitResponse, error) { + svc, err := c.getSandbox(ctx, in.SandboxID) + if err != nil { + return nil, err + } + + resp, err := svc.WaitSandbox(ctx, &proto.WaitSandboxRequest{ + SandboxID: in.SandboxID, + }) + + if err != nil { + return nil, fmt.Errorf("failed to wait sandbox %s: %w", in.SandboxID, err) + } + + return &api.ControllerWaitResponse{ + ExitStatus: resp.ExitStatus, + ExitedAt: resp.ExitedAt, + }, nil +} + func (c *controllerLocal) Pause(ctx context.Context, in *api.ControllerPauseRequest, opts ...grpc.CallOption) (*api.ControllerPauseResponse, error) { svc, err := c.getSandbox(ctx, in.SandboxID) if err != nil { @@ -195,7 +221,14 @@ func (c *controllerLocal) Status(ctx context.Context, in *api.ControllerStatusRe return nil, fmt.Errorf("failed to query sandbox %s status: %w", in.SandboxID, err) } - return &api.ControllerStatusResponse{Status: resp.Status}, nil + return &api.ControllerStatusResponse{ + ID: resp.ID, + Pid: resp.Pid, + State: resp.State, + ExitStatus: resp.ExitStatus, + ExitedAt: resp.ExitedAt, + Extra: resp.Extra, + }, nil } func (c *controllerLocal) getSandbox(ctx context.Context, id string) (task.SandboxService, error) { diff --git a/services/sandbox/controller_service.go b/services/sandbox/controller_service.go index b959a370b..47270e5a9 100644 --- a/services/sandbox/controller_service.go +++ b/services/sandbox/controller_service.go @@ -78,6 +78,11 @@ func (s *controllerService) Shutdown(ctx context.Context, req *api.ControllerShu return s.local.Shutdown(ctx, req) } +func (s *controllerService) Wait(ctx context.Context, req *api.ControllerWaitRequest) (*api.ControllerWaitResponse, error) { + log.G(ctx).WithField("req", req).Debug("wait sandbox") + return s.local.Wait(ctx, req) +} + func (s *controllerService) Pause(ctx context.Context, req *api.ControllerPauseRequest) (*api.ControllerPauseResponse, error) { log.G(ctx).WithField("req", req).Debug("pause sandbox") return s.local.Pause(ctx, req)