From 4445d0a8da4fde83804a533fe815847234ff109e Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Mon, 19 Apr 2021 15:08:31 -0700 Subject: [PATCH 01/22] [sandbox] Add protobuf definitions Signed-off-by: Maksym Pavlenko --- api/next.pb.txt | 442 ++- api/services/sandbox/v1/sandbox.pb.go | 4609 +++++++++++++++++++++++++ api/services/sandbox/v1/sandbox.proto | 132 + api/types/sandbox.pb.go | 1147 ++++++ api/types/sandbox.proto | 51 + runtime/v2/task/sandbox.pb.go | 2972 ++++++++++++++++ runtime/v2/task/sandbox.proto | 98 + 7 files changed, 9447 insertions(+), 4 deletions(-) create mode 100644 api/services/sandbox/v1/sandbox.pb.go create mode 100644 api/services/sandbox/v1/sandbox.proto create mode 100644 api/types/sandbox.pb.go create mode 100644 api/types/sandbox.proto create mode 100644 runtime/v2/task/sandbox.pb.go create mode 100644 runtime/v2/task/sandbox.proto diff --git a/api/next.pb.txt b/api/next.pb.txt index 4e8b3041c..98b74e017 100644 --- a/api/next.pb.txt +++ b/api/next.pb.txt @@ -22,7 +22,7 @@ file { java_package: "com.google.protobuf" java_outer_classname: "AnyProto" java_multiple_files: true - go_package: "github.com/golang/protobuf/ptypes/any" + go_package: "google.golang.org/protobuf/types/known/anypb" objc_class_prefix: "GPB" csharp_namespace: "Google.Protobuf.WellKnownTypes" } @@ -458,7 +458,7 @@ file { java_package: "com.google.protobuf" java_outer_classname: "TimestampProto" java_multiple_files: true - go_package: "github.com/golang/protobuf/ptypes/timestamp" + go_package: "google.golang.org/protobuf/types/known/timestamppb" cc_enable_arenas: true objc_class_prefix: "GPB" csharp_namespace: "Google.Protobuf.WellKnownTypes" @@ -800,7 +800,7 @@ file { java_package: "com.google.protobuf" java_outer_classname: "EmptyProto" java_multiple_files: true - go_package: "github.com/golang/protobuf/ptypes/empty" + go_package: "google.golang.org/protobuf/types/known/emptypb" cc_enable_arenas: true objc_class_prefix: "GPB" csharp_namespace: "Google.Protobuf.WellKnownTypes" @@ -824,7 +824,7 @@ file { java_package: "com.google.protobuf" java_outer_classname: "FieldMaskProto" java_multiple_files: true - go_package: "google.golang.org/genproto/protobuf/field_mask;field_mask" + go_package: "google.golang.org/protobuf/types/known/fieldmaskpb" cc_enable_arenas: true objc_class_prefix: "GPB" csharp_namespace: "Google.Protobuf.WellKnownTypes" @@ -2929,6 +2929,440 @@ file { } syntax: "proto3" } +file { + name: "github.com/containerd/containerd/api/types/sandbox.proto" + package: "containerd.types" + dependency: "gogoproto/gogo.proto" + dependency: "google/protobuf/any.proto" + dependency: "google/protobuf/timestamp.proto" + message_type { + name: "Sandbox" + field { + name: "sandbox_id" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "sandboxId" + } + field { + name: "runtime" + number: 2 + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: ".containerd.types.Sandbox.Runtime" + options { + 65001: 0 + } + json_name: "runtime" + } + field { + name: "spec" + number: 3 + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: ".google.protobuf.Any" + json_name: "spec" + } + field { + name: "labels" + number: 4 + label: LABEL_REPEATED + type: TYPE_MESSAGE + type_name: ".containerd.types.Sandbox.LabelsEntry" + options { + 65001: 0 + } + json_name: "labels" + } + field { + name: "created_at" + number: 5 + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: ".google.protobuf.Timestamp" + options { + 65001: 0 + 65010: 1 + } + json_name: "createdAt" + } + field { + name: "updated_at" + number: 6 + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: ".google.protobuf.Timestamp" + options { + 65001: 0 + 65010: 1 + } + json_name: "updatedAt" + } + field { + name: "extensions" + number: 7 + label: LABEL_REPEATED + type: TYPE_MESSAGE + type_name: ".containerd.types.Sandbox.ExtensionsEntry" + options { + 65001: 0 + } + json_name: "extensions" + } + nested_type { + name: "Runtime" + field { + name: "name" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "name" + } + field { + name: "options" + number: 2 + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: ".google.protobuf.Any" + json_name: "options" + } + } + nested_type { + name: "LabelsEntry" + field { + name: "key" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "key" + } + field { + name: "value" + number: 2 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "value" + } + options { + map_entry: true + } + } + nested_type { + name: "ExtensionsEntry" + field { + name: "key" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "key" + } + field { + name: "value" + number: 2 + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: ".google.protobuf.Any" + json_name: "value" + } + options { + map_entry: true + } + } + } + options { + go_package: "github.com/containerd/containerd/api/types;types" + } + weak_dependency: 0 + syntax: "proto3" +} +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: "github.com/containerd/containerd/api/types/sandbox.proto" + message_type { + name: "StoreCreateRequest" + field { + name: "sandbox" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: ".containerd.types.Sandbox" + options { + 65001: 0 + } + json_name: "sandbox" + } + } + message_type { + name: "StoreCreateResponse" + field { + name: "sandbox" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: ".containerd.types.Sandbox" + options { + 65001: 0 + } + json_name: "sandbox" + } + } + message_type { + name: "StoreUpdateRequest" + field { + name: "sandbox" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: ".containerd.types.Sandbox" + options { + 65001: 0 + } + json_name: "sandbox" + } + field { + name: "fields" + number: 2 + label: LABEL_REPEATED + type: TYPE_STRING + json_name: "fields" + } + } + message_type { + name: "StoreUpdateResponse" + field { + name: "sandbox" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: ".containerd.types.Sandbox" + options { + 65001: 0 + } + json_name: "sandbox" + } + } + message_type { + name: "StoreDeleteRequest" + field { + name: "sandbox_id" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "sandboxId" + } + } + message_type { + name: "StoreDeleteResponse" + } + message_type { + name: "StoreListRequest" + field { + name: "filters" + number: 1 + label: LABEL_REPEATED + type: TYPE_STRING + json_name: "filters" + } + } + message_type { + name: "StoreListResponse" + field { + name: "list" + number: 1 + label: LABEL_REPEATED + type: TYPE_MESSAGE + type_name: ".containerd.types.Sandbox" + options { + 65001: 0 + } + json_name: "list" + } + } + message_type { + name: "StoreGetRequest" + field { + name: "sandbox_id" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "sandboxId" + } + } + message_type { + name: "StoreGetResponse" + field { + name: "sandbox" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: ".containerd.types.Sandbox" + json_name: "sandbox" + } + } + message_type { + name: "ControllerStartRequest" + field { + name: "sandbox_id" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "sandboxId" + } + field { + name: "spec" + number: 4 + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: ".google.protobuf.Any" + json_name: "spec" + } + } + message_type { + name: "ControllerStartResponse" + } + message_type { + name: "ControllerShutdownRequest" + field { + name: "sandbox_id" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "sandboxId" + } + } + message_type { + name: "ControllerShutdownResponse" + } + message_type { + name: "ControllerPauseRequest" + field { + name: "sandbox_id" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "sandboxId" + } + } + message_type { + name: "ControllerPauseResponse" + } + message_type { + name: "ControllerResumeRequest" + field { + name: "sandbox_id" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "sandboxId" + } + } + message_type { + name: "ControllerResumeResponse" + } + message_type { + name: "ControllerPingRequest" + field { + name: "sandbox_id" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "sandboxId" + } + } + message_type { + name: "ControllerPingResponse" + } + message_type { + name: "ControllerStatusRequest" + field { + name: "sandbox_id" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "sandboxId" + } + } + message_type { + name: "ControllerStatusResponse" + field { + name: "status" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: ".google.protobuf.Any" + json_name: "status" + } + } + service { + name: "Store" + method { + name: "Create" + input_type: ".containerd.services.sandbox.v1.StoreCreateRequest" + output_type: ".containerd.services.sandbox.v1.StoreCreateResponse" + } + method { + name: "Update" + input_type: ".containerd.services.sandbox.v1.StoreUpdateRequest" + output_type: ".containerd.services.sandbox.v1.StoreUpdateResponse" + } + method { + name: "Delete" + input_type: ".containerd.services.sandbox.v1.StoreDeleteRequest" + output_type: ".containerd.services.sandbox.v1.StoreDeleteResponse" + } + method { + name: "List" + input_type: ".containerd.services.sandbox.v1.StoreListRequest" + output_type: ".containerd.services.sandbox.v1.StoreListResponse" + } + method { + name: "Get" + input_type: ".containerd.services.sandbox.v1.StoreGetRequest" + output_type: ".containerd.services.sandbox.v1.StoreGetResponse" + } + } + service { + name: "Controller" + method { + name: "Start" + input_type: ".containerd.services.sandbox.v1.ControllerStartRequest" + output_type: ".containerd.services.sandbox.v1.ControllerStartResponse" + } + method { + name: "Shutdown" + input_type: ".containerd.services.sandbox.v1.ControllerShutdownRequest" + output_type: ".containerd.services.sandbox.v1.ControllerShutdownResponse" + } + method { + name: "Pause" + input_type: ".containerd.services.sandbox.v1.ControllerPauseRequest" + output_type: ".containerd.services.sandbox.v1.ControllerPauseResponse" + } + method { + name: "Resume" + input_type: ".containerd.services.sandbox.v1.ControllerResumeRequest" + output_type: ".containerd.services.sandbox.v1.ControllerResumeResponse" + } + method { + name: "Ping" + input_type: ".containerd.services.sandbox.v1.ControllerPingRequest" + output_type: ".containerd.services.sandbox.v1.ControllerPingResponse" + } + method { + name: "Status" + input_type: ".containerd.services.sandbox.v1.ControllerStatusRequest" + output_type: ".containerd.services.sandbox.v1.ControllerStatusResponse" + } + } + options { + go_package: "github.com/containerd/containerd/api/services/sandbox/v1;sandbox" + } + weak_dependency: 0 + syntax: "proto3" +} file { name: "github.com/containerd/containerd/api/services/snapshots/v1/snapshots.proto" package: "containerd.services.snapshots.v1" diff --git a/api/services/sandbox/v1/sandbox.pb.go b/api/services/sandbox/v1/sandbox.pb.go new file mode 100644 index 000000000..76f099aea --- /dev/null +++ b/api/services/sandbox/v1/sandbox.pb.go @@ -0,0 +1,4609 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: github.com/containerd/containerd/api/services/sandbox/v1/sandbox.proto + +// Sandbox is a v2 runtime extension that allows more complex execution environments for containers. +// This adds a notion of groups of containers that share same lifecycle and/or resources. +// A few good fits for sandbox can be: +// - A "pause" container in k8s, that acts as a parent process for child containers to hold network namespace. +// - (micro)VMs that launch a VM process and executes containers inside guest OS. +// containerd in this case remains implementation agnostic and delegates sandbox handling to runtimes. +// See proposal and discussion here: https://github.com/containerd/containerd/issues/4131 + +package sandbox + +import ( + context "context" + fmt "fmt" + types "github.com/containerd/containerd/api/types" + proto "github.com/gogo/protobuf/proto" + types1 "github.com/gogo/protobuf/types" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" + reflect "reflect" + strings "strings" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type StoreCreateRequest struct { + Sandbox types.Sandbox `protobuf:"bytes,1,opt,name=sandbox,proto3" json:"sandbox"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StoreCreateRequest) Reset() { *m = StoreCreateRequest{} } +func (*StoreCreateRequest) ProtoMessage() {} +func (*StoreCreateRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{0} +} +func (m *StoreCreateRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StoreCreateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StoreCreateRequest.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 *StoreCreateRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_StoreCreateRequest.Merge(m, src) +} +func (m *StoreCreateRequest) XXX_Size() int { + return m.Size() +} +func (m *StoreCreateRequest) XXX_DiscardUnknown() { + xxx_messageInfo_StoreCreateRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_StoreCreateRequest proto.InternalMessageInfo + +type StoreCreateResponse struct { + Sandbox types.Sandbox `protobuf:"bytes,1,opt,name=sandbox,proto3" json:"sandbox"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StoreCreateResponse) Reset() { *m = StoreCreateResponse{} } +func (*StoreCreateResponse) ProtoMessage() {} +func (*StoreCreateResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{1} +} +func (m *StoreCreateResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StoreCreateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StoreCreateResponse.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 *StoreCreateResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_StoreCreateResponse.Merge(m, src) +} +func (m *StoreCreateResponse) XXX_Size() int { + return m.Size() +} +func (m *StoreCreateResponse) XXX_DiscardUnknown() { + xxx_messageInfo_StoreCreateResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_StoreCreateResponse proto.InternalMessageInfo + +type StoreUpdateRequest struct { + Sandbox types.Sandbox `protobuf:"bytes,1,opt,name=sandbox,proto3" json:"sandbox"` + Fields []string `protobuf:"bytes,2,rep,name=fields,proto3" json:"fields,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StoreUpdateRequest) Reset() { *m = StoreUpdateRequest{} } +func (*StoreUpdateRequest) ProtoMessage() {} +func (*StoreUpdateRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{2} +} +func (m *StoreUpdateRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StoreUpdateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StoreUpdateRequest.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 *StoreUpdateRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_StoreUpdateRequest.Merge(m, src) +} +func (m *StoreUpdateRequest) XXX_Size() int { + return m.Size() +} +func (m *StoreUpdateRequest) XXX_DiscardUnknown() { + xxx_messageInfo_StoreUpdateRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_StoreUpdateRequest proto.InternalMessageInfo + +type StoreUpdateResponse struct { + Sandbox types.Sandbox `protobuf:"bytes,1,opt,name=sandbox,proto3" json:"sandbox"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StoreUpdateResponse) Reset() { *m = StoreUpdateResponse{} } +func (*StoreUpdateResponse) ProtoMessage() {} +func (*StoreUpdateResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{3} +} +func (m *StoreUpdateResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StoreUpdateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StoreUpdateResponse.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 *StoreUpdateResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_StoreUpdateResponse.Merge(m, src) +} +func (m *StoreUpdateResponse) XXX_Size() int { + return m.Size() +} +func (m *StoreUpdateResponse) XXX_DiscardUnknown() { + xxx_messageInfo_StoreUpdateResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_StoreUpdateResponse proto.InternalMessageInfo + +type StoreDeleteRequest 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 *StoreDeleteRequest) Reset() { *m = StoreDeleteRequest{} } +func (*StoreDeleteRequest) ProtoMessage() {} +func (*StoreDeleteRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{4} +} +func (m *StoreDeleteRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StoreDeleteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StoreDeleteRequest.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 *StoreDeleteRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_StoreDeleteRequest.Merge(m, src) +} +func (m *StoreDeleteRequest) XXX_Size() int { + return m.Size() +} +func (m *StoreDeleteRequest) XXX_DiscardUnknown() { + xxx_messageInfo_StoreDeleteRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_StoreDeleteRequest proto.InternalMessageInfo + +type StoreDeleteResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StoreDeleteResponse) Reset() { *m = StoreDeleteResponse{} } +func (*StoreDeleteResponse) ProtoMessage() {} +func (*StoreDeleteResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{5} +} +func (m *StoreDeleteResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StoreDeleteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StoreDeleteResponse.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 *StoreDeleteResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_StoreDeleteResponse.Merge(m, src) +} +func (m *StoreDeleteResponse) XXX_Size() int { + return m.Size() +} +func (m *StoreDeleteResponse) XXX_DiscardUnknown() { + xxx_messageInfo_StoreDeleteResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_StoreDeleteResponse proto.InternalMessageInfo + +type StoreListRequest struct { + Filters []string `protobuf:"bytes,1,rep,name=filters,proto3" json:"filters,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StoreListRequest) Reset() { *m = StoreListRequest{} } +func (*StoreListRequest) ProtoMessage() {} +func (*StoreListRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{6} +} +func (m *StoreListRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StoreListRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StoreListRequest.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 *StoreListRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_StoreListRequest.Merge(m, src) +} +func (m *StoreListRequest) XXX_Size() int { + return m.Size() +} +func (m *StoreListRequest) XXX_DiscardUnknown() { + xxx_messageInfo_StoreListRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_StoreListRequest proto.InternalMessageInfo + +type StoreListResponse struct { + List []types.Sandbox `protobuf:"bytes,1,rep,name=list,proto3" json:"list"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StoreListResponse) Reset() { *m = StoreListResponse{} } +func (*StoreListResponse) ProtoMessage() {} +func (*StoreListResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{7} +} +func (m *StoreListResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StoreListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StoreListResponse.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 *StoreListResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_StoreListResponse.Merge(m, src) +} +func (m *StoreListResponse) XXX_Size() int { + return m.Size() +} +func (m *StoreListResponse) XXX_DiscardUnknown() { + xxx_messageInfo_StoreListResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_StoreListResponse proto.InternalMessageInfo + +type StoreGetRequest 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 *StoreGetRequest) Reset() { *m = StoreGetRequest{} } +func (*StoreGetRequest) ProtoMessage() {} +func (*StoreGetRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{8} +} +func (m *StoreGetRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StoreGetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StoreGetRequest.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 *StoreGetRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_StoreGetRequest.Merge(m, src) +} +func (m *StoreGetRequest) XXX_Size() int { + return m.Size() +} +func (m *StoreGetRequest) XXX_DiscardUnknown() { + xxx_messageInfo_StoreGetRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_StoreGetRequest proto.InternalMessageInfo + +type StoreGetResponse struct { + Sandbox *types.Sandbox `protobuf:"bytes,1,opt,name=sandbox,proto3" json:"sandbox,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StoreGetResponse) Reset() { *m = StoreGetResponse{} } +func (*StoreGetResponse) ProtoMessage() {} +func (*StoreGetResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{9} +} +func (m *StoreGetResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StoreGetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StoreGetResponse.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 *StoreGetResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_StoreGetResponse.Merge(m, src) +} +func (m *StoreGetResponse) XXX_Size() int { + return m.Size() +} +func (m *StoreGetResponse) XXX_DiscardUnknown() { + xxx_messageInfo_StoreGetResponse.DiscardUnknown(m) +} + +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:"-"` +} + +func (m *ControllerStartRequest) Reset() { *m = ControllerStartRequest{} } +func (*ControllerStartRequest) ProtoMessage() {} +func (*ControllerStartRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{10} +} +func (m *ControllerStartRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ControllerStartRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ControllerStartRequest.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 *ControllerStartRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ControllerStartRequest.Merge(m, src) +} +func (m *ControllerStartRequest) XXX_Size() int { + return m.Size() +} +func (m *ControllerStartRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ControllerStartRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ControllerStartRequest proto.InternalMessageInfo + +type ControllerStartResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ControllerStartResponse) Reset() { *m = ControllerStartResponse{} } +func (*ControllerStartResponse) ProtoMessage() {} +func (*ControllerStartResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{11} +} +func (m *ControllerStartResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ControllerStartResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ControllerStartResponse.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 *ControllerStartResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ControllerStartResponse.Merge(m, src) +} +func (m *ControllerStartResponse) XXX_Size() int { + return m.Size() +} +func (m *ControllerStartResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ControllerStartResponse.DiscardUnknown(m) +} + +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"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ControllerShutdownRequest) Reset() { *m = ControllerShutdownRequest{} } +func (*ControllerShutdownRequest) ProtoMessage() {} +func (*ControllerShutdownRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{12} +} +func (m *ControllerShutdownRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ControllerShutdownRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ControllerShutdownRequest.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 *ControllerShutdownRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ControllerShutdownRequest.Merge(m, src) +} +func (m *ControllerShutdownRequest) XXX_Size() int { + return m.Size() +} +func (m *ControllerShutdownRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ControllerShutdownRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ControllerShutdownRequest proto.InternalMessageInfo + +type ControllerShutdownResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ControllerShutdownResponse) Reset() { *m = ControllerShutdownResponse{} } +func (*ControllerShutdownResponse) ProtoMessage() {} +func (*ControllerShutdownResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{13} +} +func (m *ControllerShutdownResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ControllerShutdownResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ControllerShutdownResponse.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 *ControllerShutdownResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ControllerShutdownResponse.Merge(m, src) +} +func (m *ControllerShutdownResponse) XXX_Size() int { + return m.Size() +} +func (m *ControllerShutdownResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ControllerShutdownResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ControllerShutdownResponse 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:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ControllerPauseRequest) Reset() { *m = ControllerPauseRequest{} } +func (*ControllerPauseRequest) ProtoMessage() {} +func (*ControllerPauseRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{14} +} +func (m *ControllerPauseRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ControllerPauseRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ControllerPauseRequest.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 *ControllerPauseRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ControllerPauseRequest.Merge(m, src) +} +func (m *ControllerPauseRequest) XXX_Size() int { + return m.Size() +} +func (m *ControllerPauseRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ControllerPauseRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ControllerPauseRequest proto.InternalMessageInfo + +type ControllerPauseResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ControllerPauseResponse) Reset() { *m = ControllerPauseResponse{} } +func (*ControllerPauseResponse) ProtoMessage() {} +func (*ControllerPauseResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{15} +} +func (m *ControllerPauseResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ControllerPauseResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ControllerPauseResponse.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 *ControllerPauseResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ControllerPauseResponse.Merge(m, src) +} +func (m *ControllerPauseResponse) XXX_Size() int { + return m.Size() +} +func (m *ControllerPauseResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ControllerPauseResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ControllerPauseResponse proto.InternalMessageInfo + +type ControllerResumeRequest 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 *ControllerResumeRequest) Reset() { *m = ControllerResumeRequest{} } +func (*ControllerResumeRequest) ProtoMessage() {} +func (*ControllerResumeRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{16} +} +func (m *ControllerResumeRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ControllerResumeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ControllerResumeRequest.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 *ControllerResumeRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ControllerResumeRequest.Merge(m, src) +} +func (m *ControllerResumeRequest) XXX_Size() int { + return m.Size() +} +func (m *ControllerResumeRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ControllerResumeRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ControllerResumeRequest proto.InternalMessageInfo + +type ControllerResumeResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ControllerResumeResponse) Reset() { *m = ControllerResumeResponse{} } +func (*ControllerResumeResponse) ProtoMessage() {} +func (*ControllerResumeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{17} +} +func (m *ControllerResumeResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ControllerResumeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ControllerResumeResponse.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 *ControllerResumeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ControllerResumeResponse.Merge(m, src) +} +func (m *ControllerResumeResponse) XXX_Size() int { + return m.Size() +} +func (m *ControllerResumeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ControllerResumeResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ControllerResumeResponse proto.InternalMessageInfo + +type ControllerPingRequest 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 *ControllerPingRequest) Reset() { *m = ControllerPingRequest{} } +func (*ControllerPingRequest) ProtoMessage() {} +func (*ControllerPingRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{18} +} +func (m *ControllerPingRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ControllerPingRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ControllerPingRequest.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 *ControllerPingRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ControllerPingRequest.Merge(m, src) +} +func (m *ControllerPingRequest) XXX_Size() int { + return m.Size() +} +func (m *ControllerPingRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ControllerPingRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ControllerPingRequest proto.InternalMessageInfo + +type ControllerPingResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ControllerPingResponse) Reset() { *m = ControllerPingResponse{} } +func (*ControllerPingResponse) ProtoMessage() {} +func (*ControllerPingResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{19} +} +func (m *ControllerPingResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ControllerPingResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ControllerPingResponse.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 *ControllerPingResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ControllerPingResponse.Merge(m, src) +} +func (m *ControllerPingResponse) XXX_Size() int { + return m.Size() +} +func (m *ControllerPingResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ControllerPingResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ControllerPingResponse proto.InternalMessageInfo + +type ControllerStatusRequest 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 *ControllerStatusRequest) Reset() { *m = ControllerStatusRequest{} } +func (*ControllerStatusRequest) ProtoMessage() {} +func (*ControllerStatusRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{20} +} +func (m *ControllerStatusRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ControllerStatusRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ControllerStatusRequest.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 *ControllerStatusRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ControllerStatusRequest.Merge(m, src) +} +func (m *ControllerStatusRequest) XXX_Size() int { + return m.Size() +} +func (m *ControllerStatusRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ControllerStatusRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ControllerStatusRequest proto.InternalMessageInfo + +type ControllerStatusResponse struct { + Status *types1.Any `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ControllerStatusResponse) Reset() { *m = ControllerStatusResponse{} } +func (*ControllerStatusResponse) ProtoMessage() {} +func (*ControllerStatusResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{21} +} +func (m *ControllerStatusResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ControllerStatusResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ControllerStatusResponse.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 *ControllerStatusResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ControllerStatusResponse.Merge(m, src) +} +func (m *ControllerStatusResponse) XXX_Size() int { + return m.Size() +} +func (m *ControllerStatusResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ControllerStatusResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ControllerStatusResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*StoreCreateRequest)(nil), "containerd.services.sandbox.v1.StoreCreateRequest") + proto.RegisterType((*StoreCreateResponse)(nil), "containerd.services.sandbox.v1.StoreCreateResponse") + proto.RegisterType((*StoreUpdateRequest)(nil), "containerd.services.sandbox.v1.StoreUpdateRequest") + proto.RegisterType((*StoreUpdateResponse)(nil), "containerd.services.sandbox.v1.StoreUpdateResponse") + proto.RegisterType((*StoreDeleteRequest)(nil), "containerd.services.sandbox.v1.StoreDeleteRequest") + proto.RegisterType((*StoreDeleteResponse)(nil), "containerd.services.sandbox.v1.StoreDeleteResponse") + proto.RegisterType((*StoreListRequest)(nil), "containerd.services.sandbox.v1.StoreListRequest") + proto.RegisterType((*StoreListResponse)(nil), "containerd.services.sandbox.v1.StoreListResponse") + proto.RegisterType((*StoreGetRequest)(nil), "containerd.services.sandbox.v1.StoreGetRequest") + proto.RegisterType((*StoreGetResponse)(nil), "containerd.services.sandbox.v1.StoreGetResponse") + proto.RegisterType((*ControllerStartRequest)(nil), "containerd.services.sandbox.v1.ControllerStartRequest") + 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((*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") + proto.RegisterType((*ControllerResumeResponse)(nil), "containerd.services.sandbox.v1.ControllerResumeResponse") + proto.RegisterType((*ControllerPingRequest)(nil), "containerd.services.sandbox.v1.ControllerPingRequest") + proto.RegisterType((*ControllerPingResponse)(nil), "containerd.services.sandbox.v1.ControllerPingResponse") + proto.RegisterType((*ControllerStatusRequest)(nil), "containerd.services.sandbox.v1.ControllerStatusRequest") + proto.RegisterType((*ControllerStatusResponse)(nil), "containerd.services.sandbox.v1.ControllerStatusResponse") +} + +func init() { + proto.RegisterFile("github.com/containerd/containerd/api/services/sandbox/v1/sandbox.proto", fileDescriptor_d6eb1ebcbc2879f1) +} + +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, 0x90, + 0x16, 0x96, 0x88, 0xa0, 0x07, 0x75, 0x41, 0x16, 0x12, 0x13, 0xc9, 0x6e, 0x4c, 0x0c, 0x17, 0xd3, + 0xdd, 0x0e, 0xa5, 0xb1, 0x74, 0xba, 0x9d, 0x29, 0x42, 0xbc, 0xe8, 0xaf, 0xf2, 0x2f, 0x70, 0xf4, + 0xe8, 0x89, 0xc8, 0xfe, 0x07, 0xef, 0x66, 0xa7, 0x53, 0xda, 0xca, 0x46, 0xdb, 0xe2, 0x6d, 0xba, + 0x7d, 0xde, 0xe7, 0x63, 0x78, 0xf7, 0x61, 0x61, 0xc7, 0x71, 0xd9, 0x51, 0xd4, 0x37, 0x06, 0xe4, + 0xd8, 0x1c, 0x10, 0x9f, 0x59, 0xae, 0x8f, 0x43, 0x3b, 0x7b, 0xb4, 0x02, 0xd7, 0xa4, 0x38, 0x3c, + 0x71, 0x07, 0x98, 0x9a, 0xd4, 0xf2, 0xed, 0x3e, 0x39, 0x35, 0x4f, 0x56, 0x93, 0xa3, 0x11, 0x84, + 0x84, 0x11, 0xa4, 0xa5, 0x13, 0x46, 0x82, 0x36, 0x12, 0xc8, 0xc9, 0xaa, 0x3a, 0xeb, 0x10, 0x87, + 0x70, 0xa8, 0x39, 0x3e, 0xc5, 0x53, 0x6a, 0xd3, 0x21, 0xc4, 0xf1, 0xb0, 0xc9, 0x9f, 0xfa, 0xd1, + 0xa1, 0x69, 0xf9, 0x67, 0xe2, 0xd5, 0x46, 0x21, 0x63, 0xec, 0x2c, 0x48, 0x5d, 0xc5, 0x93, 0xfa, + 0x5b, 0x40, 0x3d, 0x46, 0x42, 0xbc, 0x15, 0x62, 0x8b, 0xe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70, 0xd8, + 0x63, 0x56, 0x58, 0xcd, 0x10, 0x5a, 0x82, 0x3a, 0x0d, 0xf0, 0x40, 0xa9, 0x73, 0xe5, 0x59, 0x23, + 0xfe, 0x9a, 0x19, 0xc9, 0xd7, 0xcc, 0x78, 0xe5, 0x9f, 0x75, 0x39, 0x42, 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, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// StoreClient is the client API for Store service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type StoreClient interface { + Create(ctx context.Context, in *StoreCreateRequest, opts ...grpc.CallOption) (*StoreCreateResponse, error) + Update(ctx context.Context, in *StoreUpdateRequest, opts ...grpc.CallOption) (*StoreUpdateResponse, error) + Delete(ctx context.Context, in *StoreDeleteRequest, opts ...grpc.CallOption) (*StoreDeleteResponse, error) + List(ctx context.Context, in *StoreListRequest, opts ...grpc.CallOption) (*StoreListResponse, error) + Get(ctx context.Context, in *StoreGetRequest, opts ...grpc.CallOption) (*StoreGetResponse, error) +} + +type storeClient struct { + cc *grpc.ClientConn +} + +func NewStoreClient(cc *grpc.ClientConn) StoreClient { + return &storeClient{cc} +} + +func (c *storeClient) Create(ctx context.Context, in *StoreCreateRequest, opts ...grpc.CallOption) (*StoreCreateResponse, error) { + out := new(StoreCreateResponse) + err := c.cc.Invoke(ctx, "/containerd.services.sandbox.v1.Store/Create", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storeClient) Update(ctx context.Context, in *StoreUpdateRequest, opts ...grpc.CallOption) (*StoreUpdateResponse, error) { + out := new(StoreUpdateResponse) + err := c.cc.Invoke(ctx, "/containerd.services.sandbox.v1.Store/Update", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storeClient) Delete(ctx context.Context, in *StoreDeleteRequest, opts ...grpc.CallOption) (*StoreDeleteResponse, error) { + out := new(StoreDeleteResponse) + err := c.cc.Invoke(ctx, "/containerd.services.sandbox.v1.Store/Delete", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storeClient) List(ctx context.Context, in *StoreListRequest, opts ...grpc.CallOption) (*StoreListResponse, error) { + out := new(StoreListResponse) + err := c.cc.Invoke(ctx, "/containerd.services.sandbox.v1.Store/List", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storeClient) Get(ctx context.Context, in *StoreGetRequest, opts ...grpc.CallOption) (*StoreGetResponse, error) { + out := new(StoreGetResponse) + err := c.cc.Invoke(ctx, "/containerd.services.sandbox.v1.Store/Get", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// StoreServer is the server API for Store service. +type StoreServer interface { + Create(context.Context, *StoreCreateRequest) (*StoreCreateResponse, error) + Update(context.Context, *StoreUpdateRequest) (*StoreUpdateResponse, error) + Delete(context.Context, *StoreDeleteRequest) (*StoreDeleteResponse, error) + List(context.Context, *StoreListRequest) (*StoreListResponse, error) + Get(context.Context, *StoreGetRequest) (*StoreGetResponse, error) +} + +// UnimplementedStoreServer can be embedded to have forward compatible implementations. +type UnimplementedStoreServer struct { +} + +func (*UnimplementedStoreServer) Create(ctx context.Context, req *StoreCreateRequest) (*StoreCreateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Create not implemented") +} +func (*UnimplementedStoreServer) Update(ctx context.Context, req *StoreUpdateRequest) (*StoreUpdateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Update not implemented") +} +func (*UnimplementedStoreServer) Delete(ctx context.Context, req *StoreDeleteRequest) (*StoreDeleteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") +} +func (*UnimplementedStoreServer) List(ctx context.Context, req *StoreListRequest) (*StoreListResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method List not implemented") +} +func (*UnimplementedStoreServer) Get(ctx context.Context, req *StoreGetRequest) (*StoreGetResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Get not implemented") +} + +func RegisterStoreServer(s *grpc.Server, srv StoreServer) { + s.RegisterService(&_Store_serviceDesc, srv) +} + +func _Store_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StoreCreateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoreServer).Create(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.services.sandbox.v1.Store/Create", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoreServer).Create(ctx, req.(*StoreCreateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Store_Update_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StoreUpdateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoreServer).Update(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.services.sandbox.v1.Store/Update", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoreServer).Update(ctx, req.(*StoreUpdateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Store_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StoreDeleteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoreServer).Delete(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.services.sandbox.v1.Store/Delete", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoreServer).Delete(ctx, req.(*StoreDeleteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Store_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StoreListRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoreServer).List(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.services.sandbox.v1.Store/List", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoreServer).List(ctx, req.(*StoreListRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Store_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StoreGetRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoreServer).Get(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.services.sandbox.v1.Store/Get", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoreServer).Get(ctx, req.(*StoreGetRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Store_serviceDesc = grpc.ServiceDesc{ + ServiceName: "containerd.services.sandbox.v1.Store", + HandlerType: (*StoreServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Create", + Handler: _Store_Create_Handler, + }, + { + MethodName: "Update", + Handler: _Store_Update_Handler, + }, + { + MethodName: "Delete", + Handler: _Store_Delete_Handler, + }, + { + MethodName: "List", + Handler: _Store_List_Handler, + }, + { + MethodName: "Get", + Handler: _Store_Get_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "github.com/containerd/containerd/api/services/sandbox/v1/sandbox.proto", +} + +// ControllerClient is the client API for Controller service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +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) + 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) + Status(ctx context.Context, in *ControllerStatusRequest, opts ...grpc.CallOption) (*ControllerStatusResponse, error) +} + +type controllerClient struct { + cc *grpc.ClientConn +} + +func NewControllerClient(cc *grpc.ClientConn) ControllerClient { + return &controllerClient{cc} +} + +func (c *controllerClient) Start(ctx context.Context, in *ControllerStartRequest, opts ...grpc.CallOption) (*ControllerStartResponse, error) { + out := new(ControllerStartResponse) + err := c.cc.Invoke(ctx, "/containerd.services.sandbox.v1.Controller/Start", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *controllerClient) Shutdown(ctx context.Context, in *ControllerShutdownRequest, opts ...grpc.CallOption) (*ControllerShutdownResponse, error) { + out := new(ControllerShutdownResponse) + err := c.cc.Invoke(ctx, "/containerd.services.sandbox.v1.Controller/Shutdown", 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...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *controllerClient) Resume(ctx context.Context, in *ControllerResumeRequest, opts ...grpc.CallOption) (*ControllerResumeResponse, error) { + out := new(ControllerResumeResponse) + err := c.cc.Invoke(ctx, "/containerd.services.sandbox.v1.Controller/Resume", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *controllerClient) Ping(ctx context.Context, in *ControllerPingRequest, opts ...grpc.CallOption) (*ControllerPingResponse, error) { + out := new(ControllerPingResponse) + err := c.cc.Invoke(ctx, "/containerd.services.sandbox.v1.Controller/Ping", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *controllerClient) Status(ctx context.Context, in *ControllerStatusRequest, opts ...grpc.CallOption) (*ControllerStatusResponse, error) { + out := new(ControllerStatusResponse) + err := c.cc.Invoke(ctx, "/containerd.services.sandbox.v1.Controller/Status", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ControllerServer is the server API for Controller service. +type ControllerServer interface { + Start(context.Context, *ControllerStartRequest) (*ControllerStartResponse, error) + Shutdown(context.Context, *ControllerShutdownRequest) (*ControllerShutdownResponse, error) + Pause(context.Context, *ControllerPauseRequest) (*ControllerPauseResponse, error) + Resume(context.Context, *ControllerResumeRequest) (*ControllerResumeResponse, error) + Ping(context.Context, *ControllerPingRequest) (*ControllerPingResponse, error) + Status(context.Context, *ControllerStatusRequest) (*ControllerStatusResponse, error) +} + +// UnimplementedControllerServer can be embedded to have forward compatible implementations. +type UnimplementedControllerServer struct { +} + +func (*UnimplementedControllerServer) Start(ctx context.Context, req *ControllerStartRequest) (*ControllerStartResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Start not implemented") +} +func (*UnimplementedControllerServer) Shutdown(ctx context.Context, req *ControllerShutdownRequest) (*ControllerShutdownResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Shutdown not implemented") +} +func (*UnimplementedControllerServer) Pause(ctx context.Context, req *ControllerPauseRequest) (*ControllerPauseResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Pause not implemented") +} +func (*UnimplementedControllerServer) Resume(ctx context.Context, req *ControllerResumeRequest) (*ControllerResumeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Resume not implemented") +} +func (*UnimplementedControllerServer) Ping(ctx context.Context, req *ControllerPingRequest) (*ControllerPingResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented") +} +func (*UnimplementedControllerServer) Status(ctx context.Context, req *ControllerStatusRequest) (*ControllerStatusResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Status not implemented") +} + +func RegisterControllerServer(s *grpc.Server, srv ControllerServer) { + s.RegisterService(&_Controller_serviceDesc, srv) +} + +func _Controller_Start_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ControllerStartRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ControllerServer).Start(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.services.sandbox.v1.Controller/Start", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ControllerServer).Start(ctx, req.(*ControllerStartRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Controller_Shutdown_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ControllerShutdownRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ControllerServer).Shutdown(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.services.sandbox.v1.Controller/Shutdown", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ControllerServer).Shutdown(ctx, req.(*ControllerShutdownRequest)) + } + 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 { + return nil, err + } + if interceptor == nil { + return srv.(ControllerServer).Pause(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.services.sandbox.v1.Controller/Pause", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ControllerServer).Pause(ctx, req.(*ControllerPauseRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Controller_Resume_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ControllerResumeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ControllerServer).Resume(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.services.sandbox.v1.Controller/Resume", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ControllerServer).Resume(ctx, req.(*ControllerResumeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Controller_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ControllerPingRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ControllerServer).Ping(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.services.sandbox.v1.Controller/Ping", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ControllerServer).Ping(ctx, req.(*ControllerPingRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Controller_Status_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ControllerStatusRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ControllerServer).Status(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.services.sandbox.v1.Controller/Status", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ControllerServer).Status(ctx, req.(*ControllerStatusRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Controller_serviceDesc = grpc.ServiceDesc{ + ServiceName: "containerd.services.sandbox.v1.Controller", + HandlerType: (*ControllerServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Start", + Handler: _Controller_Start_Handler, + }, + { + MethodName: "Shutdown", + Handler: _Controller_Shutdown_Handler, + }, + { + MethodName: "Pause", + Handler: _Controller_Pause_Handler, + }, + { + MethodName: "Resume", + Handler: _Controller_Resume_Handler, + }, + { + MethodName: "Ping", + Handler: _Controller_Ping_Handler, + }, + { + MethodName: "Status", + Handler: _Controller_Status_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "github.com/containerd/containerd/api/services/sandbox/v1/sandbox.proto", +} + +func (m *StoreCreateRequest) 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 *StoreCreateRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StoreCreateRequest) 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) + } + { + size, err := m.Sandbox.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSandbox(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *StoreCreateResponse) 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 *StoreCreateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StoreCreateResponse) 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) + } + { + size, err := m.Sandbox.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSandbox(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *StoreUpdateRequest) 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 *StoreUpdateRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StoreUpdateRequest) 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.Fields) > 0 { + for iNdEx := len(m.Fields) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Fields[iNdEx]) + copy(dAtA[i:], m.Fields[iNdEx]) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.Fields[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.Sandbox.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSandbox(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *StoreUpdateResponse) 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 *StoreUpdateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StoreUpdateResponse) 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) + } + { + size, err := m.Sandbox.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSandbox(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *StoreDeleteRequest) 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 *StoreDeleteRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StoreDeleteRequest) 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 *StoreDeleteResponse) 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 *StoreDeleteResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StoreDeleteResponse) 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) + } + return len(dAtA) - i, nil +} + +func (m *StoreListRequest) 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 *StoreListRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StoreListRequest) 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.Filters) > 0 { + for iNdEx := len(m.Filters) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Filters[iNdEx]) + copy(dAtA[i:], m.Filters[iNdEx]) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.Filters[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *StoreListResponse) 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 *StoreListResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StoreListResponse) 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.List) > 0 { + for iNdEx := len(m.List) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.List[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSandbox(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *StoreGetRequest) 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 *StoreGetRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StoreGetRequest) 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 *StoreGetResponse) 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 *StoreGetResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StoreGetResponse) 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 m.Sandbox != nil { + { + size, err := m.Sandbox.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSandbox(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ControllerStartRequest) 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 *ControllerStartRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ControllerStartRequest) 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 m.Spec != nil { + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSandbox(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + 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 *ControllerStartResponse) 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 *ControllerStartResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ControllerStartResponse) 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) + } + return len(dAtA) - i, nil +} + +func (m *ControllerShutdownRequest) 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 *ControllerShutdownRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ControllerShutdownRequest) 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 *ControllerShutdownResponse) 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 *ControllerShutdownResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ControllerShutdownResponse) 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) + } + return len(dAtA) - i, nil +} + +func (m *ControllerPauseRequest) 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 *ControllerPauseRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ControllerPauseRequest) 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 *ControllerPauseResponse) 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 *ControllerPauseResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ControllerPauseResponse) 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) + } + return len(dAtA) - i, nil +} + +func (m *ControllerResumeRequest) 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 *ControllerResumeRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ControllerResumeRequest) 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 *ControllerResumeResponse) 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 *ControllerResumeResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ControllerResumeResponse) 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) + } + return len(dAtA) - i, nil +} + +func (m *ControllerPingRequest) 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 *ControllerPingRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ControllerPingRequest) 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 *ControllerPingResponse) 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 *ControllerPingResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ControllerPingResponse) 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) + } + return len(dAtA) - i, nil +} + +func (m *ControllerStatusRequest) 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 *ControllerStatusRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ControllerStatusRequest) 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 *ControllerStatusResponse) 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 *ControllerStatusResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ControllerStatusResponse) 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 m.Status != nil { + { + size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSandbox(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintSandbox(dAtA []byte, offset int, v uint64) int { + offset -= sovSandbox(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *StoreCreateRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Sandbox.Size() + n += 1 + l + sovSandbox(uint64(l)) + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *StoreCreateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Sandbox.Size() + n += 1 + l + sovSandbox(uint64(l)) + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *StoreUpdateRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Sandbox.Size() + n += 1 + l + sovSandbox(uint64(l)) + if len(m.Fields) > 0 { + for _, s := range m.Fields { + l = len(s) + n += 1 + l + sovSandbox(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *StoreUpdateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Sandbox.Size() + n += 1 + l + sovSandbox(uint64(l)) + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *StoreDeleteRequest) 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 *StoreDeleteResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *StoreListRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Filters) > 0 { + for _, s := range m.Filters { + l = len(s) + n += 1 + l + sovSandbox(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *StoreListResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.List) > 0 { + for _, e := range m.List { + l = e.Size() + n += 1 + l + sovSandbox(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *StoreGetRequest) 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 *StoreGetResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Sandbox != nil { + l = m.Sandbox.Size() + n += 1 + l + sovSandbox(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ControllerStartRequest) 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.Spec != nil { + l = m.Spec.Size() + n += 1 + l + sovSandbox(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ControllerStartResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ControllerShutdownRequest) 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 *ControllerShutdownResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ControllerPauseRequest) 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 *ControllerPauseResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ControllerResumeRequest) 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 *ControllerResumeResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ControllerPingRequest) 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 *ControllerPingResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ControllerStatusRequest) 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 *ControllerStatusResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Status != nil { + l = m.Status.Size() + n += 1 + l + sovSandbox(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovSandbox(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozSandbox(x uint64) (n int) { + return sovSandbox(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *StoreCreateRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&StoreCreateRequest{`, + `Sandbox:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Sandbox), "Sandbox", "types.Sandbox", 1), `&`, ``, 1) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *StoreCreateResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&StoreCreateResponse{`, + `Sandbox:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Sandbox), "Sandbox", "types.Sandbox", 1), `&`, ``, 1) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *StoreUpdateRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&StoreUpdateRequest{`, + `Sandbox:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Sandbox), "Sandbox", "types.Sandbox", 1), `&`, ``, 1) + `,`, + `Fields:` + fmt.Sprintf("%v", this.Fields) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *StoreUpdateResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&StoreUpdateResponse{`, + `Sandbox:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Sandbox), "Sandbox", "types.Sandbox", 1), `&`, ``, 1) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *StoreDeleteRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&StoreDeleteRequest{`, + `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *StoreDeleteResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&StoreDeleteResponse{`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *StoreListRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&StoreListRequest{`, + `Filters:` + fmt.Sprintf("%v", this.Filters) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *StoreListResponse) String() string { + if this == nil { + return "nil" + } + repeatedStringForList := "[]Sandbox{" + for _, f := range this.List { + repeatedStringForList += fmt.Sprintf("%v", f) + "," + } + repeatedStringForList += "}" + s := strings.Join([]string{`&StoreListResponse{`, + `List:` + repeatedStringForList + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *StoreGetRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&StoreGetRequest{`, + `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *StoreGetResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&StoreGetResponse{`, + `Sandbox:` + strings.Replace(fmt.Sprintf("%v", this.Sandbox), "Sandbox", "types.Sandbox", 1) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *ControllerStartRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ControllerStartRequest{`, + `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, + `Spec:` + strings.Replace(fmt.Sprintf("%v", this.Spec), "Any", "types1.Any", 1) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *ControllerStartResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ControllerStartResponse{`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *ControllerShutdownRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ControllerShutdownRequest{`, + `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *ControllerShutdownResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ControllerShutdownResponse{`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *ControllerPauseRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ControllerPauseRequest{`, + `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *ControllerPauseResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ControllerPauseResponse{`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *ControllerResumeRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ControllerResumeRequest{`, + `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *ControllerResumeResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ControllerResumeResponse{`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *ControllerPingRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ControllerPingRequest{`, + `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *ControllerPingResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ControllerPingResponse{`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *ControllerStatusRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ControllerStatusRequest{`, + `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *ControllerStatusResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ControllerStatusResponse{`, + `Status:` + strings.Replace(fmt.Sprintf("%v", this.Status), "Any", "types1.Any", 1) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func valueToStringSandbox(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *StoreCreateRequest) 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: StoreCreateRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StoreCreateRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sandbox", 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 := m.Sandbox.Unmarshal(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 *StoreCreateResponse) 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: StoreCreateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StoreCreateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sandbox", 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 := m.Sandbox.Unmarshal(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 *StoreUpdateRequest) 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: StoreUpdateRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StoreUpdateRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sandbox", 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 := m.Sandbox.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Fields", 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.Fields = append(m.Fields, 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 *StoreUpdateResponse) 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: StoreUpdateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StoreUpdateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sandbox", 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 := m.Sandbox.Unmarshal(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 *StoreDeleteRequest) 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: StoreDeleteRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StoreDeleteRequest: 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 *StoreDeleteResponse) 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: StoreDeleteResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StoreDeleteResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 *StoreListRequest) 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: StoreListRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StoreListRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Filters", 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.Filters = append(m.Filters, 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 *StoreListResponse) 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: StoreListResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StoreListResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field List", 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.List = append(m.List, types.Sandbox{}) + if err := m.List[len(m.List)-1].Unmarshal(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 *StoreGetRequest) 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: StoreGetRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StoreGetRequest: 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 *StoreGetResponse) 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: StoreGetResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StoreGetResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sandbox", 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.Sandbox == nil { + m.Sandbox = &types.Sandbox{} + } + if err := m.Sandbox.Unmarshal(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 *ControllerStartRequest) 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: ControllerStartRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ControllerStartRequest: 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 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", 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.Spec == nil { + m.Spec = &types1.Any{} + } + if err := m.Spec.Unmarshal(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 *ControllerStartResponse) 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: ControllerStartResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ControllerStartResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 *ControllerShutdownRequest) 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: ControllerShutdownRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ControllerShutdownRequest: 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 *ControllerShutdownResponse) 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: ControllerShutdownResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ControllerShutdownResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 + 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: ControllerPauseRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ControllerPauseRequest: 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 *ControllerPauseResponse) 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: ControllerPauseResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ControllerPauseResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 *ControllerResumeRequest) 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: ControllerResumeRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ControllerResumeRequest: 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 *ControllerResumeResponse) 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: ControllerResumeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ControllerResumeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 *ControllerPingRequest) 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: ControllerPingRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ControllerPingRequest: 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 *ControllerPingResponse) 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: ControllerPingResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ControllerPingResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 *ControllerStatusRequest) 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: ControllerStatusRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ControllerStatusRequest: 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 *ControllerStatusResponse) 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: ControllerStatusResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ControllerStatusResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", 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.Status == nil { + m.Status = &types1.Any{} + } + if err := m.Status.Unmarshal(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 skipSandbox(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSandbox + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSandbox + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSandbox + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthSandbox + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupSandbox + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthSandbox + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthSandbox = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowSandbox = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupSandbox = fmt.Errorf("proto: unexpected end of group") +) diff --git a/api/services/sandbox/v1/sandbox.proto b/api/services/sandbox/v1/sandbox.proto new file mode 100644 index 000000000..be9d938ed --- /dev/null +++ b/api/services/sandbox/v1/sandbox.proto @@ -0,0 +1,132 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +syntax = "proto3"; + +// Sandbox is a v2 runtime extension that allows more complex execution environments for containers. +// This adds a notion of groups of containers that share same lifecycle and/or resources. +// A few good fits for sandbox can be: +// - A "pause" container in k8s, that acts as a parent process for child containers to hold network namespace. +// - (micro)VMs that launch a VM process and executes containers inside guest OS. +// containerd in this case remains implementation agnostic and delegates sandbox handling to runtimes. +// 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 "github.com/containerd/containerd/api/types/sandbox.proto"; + +option go_package = "github.com/containerd/containerd/api/services/sandbox/v1;sandbox"; + +// Store provides a metadata storage interface for sandboxes. Similarly to `Containers`, +// sandbox object includes info required to start a new instance, but no runtime state. +// When running a new sandbox instance, store objects are used as base type to create from. +service Store { + rpc Create(StoreCreateRequest) returns (StoreCreateResponse); + rpc Update(StoreUpdateRequest) returns (StoreUpdateResponse); + rpc Delete(StoreDeleteRequest) returns (StoreDeleteResponse); + rpc List(StoreListRequest) returns (StoreListResponse); + rpc Get(StoreGetRequest) returns (StoreGetResponse); +} + +message StoreCreateRequest { + containerd.types.Sandbox sandbox = 1 [(gogoproto.nullable) = false]; +} + +message StoreCreateResponse { + containerd.types.Sandbox sandbox = 1 [(gogoproto.nullable) = false]; +} + +message StoreUpdateRequest { + containerd.types.Sandbox sandbox = 1 [(gogoproto.nullable) = false]; + repeated string fields = 2; +} + +message StoreUpdateResponse { + containerd.types.Sandbox sandbox = 1 [(gogoproto.nullable) = false]; +} + +message StoreDeleteRequest { + string sandbox_id = 1; +} + +message StoreDeleteResponse {} + +message StoreListRequest { + repeated string filters = 1; +} + +message StoreListResponse { + repeated containerd.types.Sandbox list = 1 [(gogoproto.nullable) = false]; +} + +message StoreGetRequest { + string sandbox_id = 1; +} + +message StoreGetResponse { + containerd.types.Sandbox sandbox = 1; +} + +// Controller is an interface to manage runtime sandbox instances. +service Controller { + rpc Start(ControllerStartRequest) returns (ControllerStartResponse); + rpc Shutdown(ControllerShutdownRequest) returns (ControllerShutdownResponse); + rpc Pause(ControllerPauseRequest) returns (ControllerPauseResponse); + rpc Resume(ControllerResumeRequest) returns (ControllerResumeResponse); + rpc Ping(ControllerPingRequest) returns (ControllerPingResponse); + rpc Status(ControllerStatusRequest) returns (ControllerStatusResponse); +} + +message ControllerStartRequest { + string sandbox_id = 1; + google.protobuf.Any spec = 4; +} + +message ControllerStartResponse { +} + +message ControllerShutdownRequest { + string sandbox_id = 1; +} + +message ControllerShutdownResponse {} + +message ControllerPauseRequest { + string sandbox_id = 1; +} + +message ControllerPauseResponse {} + +message ControllerResumeRequest { + string sandbox_id = 1; +} + +message ControllerResumeResponse {} + +message ControllerPingRequest { + string sandbox_id = 1; +} + +message ControllerPingResponse {} + +message ControllerStatusRequest { + string sandbox_id = 1; +} + +message ControllerStatusResponse { + google.protobuf.Any status = 1; +} diff --git a/api/types/sandbox.pb.go b/api/types/sandbox.pb.go new file mode 100644 index 000000000..d44a3587d --- /dev/null +++ b/api/types/sandbox.pb.go @@ -0,0 +1,1147 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: github.com/containerd/containerd/api/types/sandbox.proto + +package types + +import ( + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + types "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. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Sandbox represents a sandbox metadata object that keeps all info required by controller to +// work with a particular instance. containerd keeps this in metadata store and sends it to a controller with +// each request, so they can reflect sandbox state changes (by updating the corresponding fields). +type Sandbox struct { + // SandboxID is a unique instance identifier within namespace + SandboxID string `protobuf:"bytes,1,opt,name=sandbox_id,json=sandboxId,proto3" json:"sandbox_id,omitempty"` + // Runtime specifies which runtime to use for executing this container. + Runtime Sandbox_Runtime `protobuf:"bytes,2,opt,name=runtime,proto3" json:"runtime"` + // Spec is sandbox configuration (kin of OCI runtime spec, but for VM) + Spec *types.Any `protobuf:"bytes,3,opt,name=spec,proto3" json:"spec,omitempty"` + // Labels provides an area to include arbitrary data on containers. + Labels map[string]string `protobuf:"bytes,4,rep,name=labels,proto3" json:"labels" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // CreatedAt is the time the container was first created. + CreatedAt time.Time `protobuf:"bytes,5,opt,name=created_at,json=createdAt,proto3,stdtime" json:"created_at"` + // UpdatedAt is the last time the container was mutated. + UpdatedAt time.Time `protobuf:"bytes,6,opt,name=updated_at,json=updatedAt,proto3,stdtime" json:"updated_at"` + // Extensions allow clients to provide optional blobs that can be handled by runtime. + Extensions map[string]types.Any `protobuf:"bytes,7,rep,name=extensions,proto3" json:"extensions" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Sandbox) Reset() { *m = Sandbox{} } +func (*Sandbox) ProtoMessage() {} +func (*Sandbox) Descriptor() ([]byte, []int) { + return fileDescriptor_f2257af6cf851f1c, []int{0} +} +func (m *Sandbox) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Sandbox) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Sandbox.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 *Sandbox) XXX_Merge(src proto.Message) { + xxx_messageInfo_Sandbox.Merge(m, src) +} +func (m *Sandbox) XXX_Size() int { + return m.Size() +} +func (m *Sandbox) XXX_DiscardUnknown() { + xxx_messageInfo_Sandbox.DiscardUnknown(m) +} + +var xxx_messageInfo_Sandbox proto.InternalMessageInfo + +type Sandbox_Runtime struct { + // Name is the name of the runtime. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Options specify additional runtime initialization options. + Options *types.Any `protobuf:"bytes,2,opt,name=options,proto3" json:"options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Sandbox_Runtime) Reset() { *m = Sandbox_Runtime{} } +func (*Sandbox_Runtime) ProtoMessage() {} +func (*Sandbox_Runtime) Descriptor() ([]byte, []int) { + return fileDescriptor_f2257af6cf851f1c, []int{0, 0} +} +func (m *Sandbox_Runtime) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Sandbox_Runtime) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Sandbox_Runtime.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 *Sandbox_Runtime) XXX_Merge(src proto.Message) { + xxx_messageInfo_Sandbox_Runtime.Merge(m, src) +} +func (m *Sandbox_Runtime) XXX_Size() int { + return m.Size() +} +func (m *Sandbox_Runtime) XXX_DiscardUnknown() { + xxx_messageInfo_Sandbox_Runtime.DiscardUnknown(m) +} + +var xxx_messageInfo_Sandbox_Runtime proto.InternalMessageInfo + +func init() { + proto.RegisterType((*Sandbox)(nil), "containerd.types.Sandbox") + proto.RegisterMapType((map[string]types.Any)(nil), "containerd.types.Sandbox.ExtensionsEntry") + proto.RegisterMapType((map[string]string)(nil), "containerd.types.Sandbox.LabelsEntry") + proto.RegisterType((*Sandbox_Runtime)(nil), "containerd.types.Sandbox.Runtime") +} + +func init() { + proto.RegisterFile("github.com/containerd/containerd/api/types/sandbox.proto", fileDescriptor_f2257af6cf851f1c) +} + +var fileDescriptor_f2257af6cf851f1c = []byte{ + // 454 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0x4f, 0x8b, 0xd3, 0x40, + 0x14, 0xef, 0xf4, 0x5f, 0xcc, 0x2b, 0xe2, 0x32, 0xf4, 0x10, 0x73, 0x48, 0xab, 0x20, 0x54, 0x91, + 0x89, 0xac, 0x97, 0x55, 0x4f, 0xed, 0xba, 0x87, 0x15, 0x45, 0xc8, 0x7a, 0x10, 0x2f, 0xcb, 0xa4, + 0x19, 0x63, 0xb0, 0x9d, 0x09, 0xc9, 0x44, 0x36, 0x37, 0x3f, 0x82, 0xdf, 0xc1, 0x2f, 0xd3, 0xa3, + 0x47, 0x4f, 0xab, 0x9b, 0x4f, 0x22, 0x99, 0x99, 0xd8, 0x50, 0xad, 0xb8, 0x97, 0xf0, 0x86, 0xf7, + 0xfb, 0xf7, 0xde, 0x23, 0x70, 0x14, 0x27, 0xf2, 0x43, 0x11, 0x92, 0xa5, 0x58, 0xfb, 0x4b, 0xc1, + 0x25, 0x4d, 0x38, 0xcb, 0xa2, 0x76, 0x49, 0xd3, 0xc4, 0x97, 0x65, 0xca, 0x72, 0x3f, 0xa7, 0x3c, + 0x0a, 0xc5, 0x05, 0x49, 0x33, 0x21, 0x05, 0x3e, 0xd8, 0x62, 0x88, 0xea, 0xbb, 0xe3, 0x58, 0xc4, + 0x42, 0x35, 0xfd, 0xba, 0xd2, 0x38, 0xf7, 0x76, 0x2c, 0x44, 0xbc, 0x62, 0xbe, 0x7a, 0x85, 0xc5, + 0x7b, 0x9f, 0xf2, 0xd2, 0xb4, 0x26, 0xbb, 0x2d, 0x99, 0xac, 0x59, 0x2e, 0xe9, 0x3a, 0xd5, 0x80, + 0xbb, 0x5f, 0x07, 0x60, 0x9d, 0x69, 0x57, 0xfc, 0x10, 0xc0, 0x04, 0x38, 0x4f, 0x22, 0x07, 0x4d, + 0xd1, 0xcc, 0x5e, 0xdc, 0xac, 0x2e, 0x27, 0xb6, 0x01, 0x9c, 0x3e, 0x0f, 0x6c, 0x03, 0x38, 0x8d, + 0xf0, 0x1c, 0xac, 0xac, 0xe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 0x7c, 0xa2, 0xab, 0x42, 0x9f, 0xde, 0x0e, + 0xf4, 0xe3, 0x69, 0xf7, 0x08, 0xb9, 0x67, 0x70, 0x6b, 0x27, 0xee, 0x5f, 0xe8, 0x0f, 0xda, 0xf4, + 0x7d, 0x69, 0xb6, 0xa2, 0x8b, 0x17, 0x9b, 0x2b, 0xaf, 0xf3, 0xfd, 0xca, 0xeb, 0x7c, 0xae, 0x3c, + 0xb4, 0xa9, 0x3c, 0xf4, 0xad, 0xf2, 0xd0, 0xcf, 0xca, 0x43, 0xef, 0x1e, 0xfd, 0xff, 0xdf, 0xf5, + 0x4c, 0x7d, 0xdf, 0x76, 0xc2, 0xa1, 0xb2, 0x79, 0xfc, 0x2b, 0x00, 0x00, 0xff, 0xff, 0x90, 0x58, + 0x3c, 0xe1, 0x9a, 0x03, 0x00, 0x00, +} + +func (m *Sandbox) 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 *Sandbox) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Sandbox) 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.Extensions) > 0 { + for k := range m.Extensions { + v := m.Extensions[k] + baseI := i + { + size, err := (&v).MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSandbox(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarintSandbox(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarintSandbox(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x3a + } + } + n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.UpdatedAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.UpdatedAt):]) + if err2 != nil { + return 0, err2 + } + i -= n2 + i = encodeVarintSandbox(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0x32 + n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CreatedAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CreatedAt):]) + if err3 != nil { + return 0, err3 + } + i -= n3 + i = encodeVarintSandbox(dAtA, i, uint64(n3)) + i-- + dAtA[i] = 0x2a + if len(m.Labels) > 0 { + for k := range m.Labels { + v := m.Labels[k] + baseI := i + i -= len(v) + copy(dAtA[i:], v) + i = encodeVarintSandbox(dAtA, i, uint64(len(v))) + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarintSandbox(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarintSandbox(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x22 + } + } + if m.Spec != nil { + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSandbox(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + { + size, err := m.Runtime.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) + copy(dAtA[i:], m.SandboxID) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.SandboxID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Sandbox_Runtime) 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 *Sandbox_Runtime) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Sandbox_Runtime) 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 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] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintSandbox(dAtA []byte, offset int, v uint64) int { + offset -= sovSandbox(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Sandbox) 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)) + } + l = m.Runtime.Size() + n += 1 + l + sovSandbox(uint64(l)) + if m.Spec != nil { + l = m.Spec.Size() + n += 1 + l + sovSandbox(uint64(l)) + } + if len(m.Labels) > 0 { + for k, v := range m.Labels { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovSandbox(uint64(len(k))) + 1 + len(v) + sovSandbox(uint64(len(v))) + n += mapEntrySize + 1 + sovSandbox(uint64(mapEntrySize)) + } + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CreatedAt) + n += 1 + l + sovSandbox(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.UpdatedAt) + n += 1 + l + sovSandbox(uint64(l)) + if len(m.Extensions) > 0 { + for k, v := range m.Extensions { + _ = k + _ = v + l = v.Size() + mapEntrySize := 1 + len(k) + sovSandbox(uint64(len(k))) + 1 + l + sovSandbox(uint64(l)) + n += mapEntrySize + 1 + sovSandbox(uint64(mapEntrySize)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Sandbox_Runtime) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + 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) + } + return n +} + +func sovSandbox(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozSandbox(x uint64) (n int) { + return sovSandbox(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *Sandbox) String() string { + if this == nil { + return "nil" + } + keysForLabels := make([]string, 0, len(this.Labels)) + for k, _ := range this.Labels { + keysForLabels = append(keysForLabels, k) + } + github_com_gogo_protobuf_sortkeys.Strings(keysForLabels) + mapStringForLabels := "map[string]string{" + for _, k := range keysForLabels { + mapStringForLabels += fmt.Sprintf("%v: %v,", k, this.Labels[k]) + } + mapStringForLabels += "}" + keysForExtensions := make([]string, 0, len(this.Extensions)) + for k, _ := range this.Extensions { + keysForExtensions = append(keysForExtensions, k) + } + github_com_gogo_protobuf_sortkeys.Strings(keysForExtensions) + mapStringForExtensions := "map[string]types.Any{" + for _, k := range keysForExtensions { + mapStringForExtensions += fmt.Sprintf("%v: %v,", k, this.Extensions[k]) + } + mapStringForExtensions += "}" + s := strings.Join([]string{`&Sandbox{`, + `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, + `Runtime:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Runtime), "Sandbox_Runtime", "Sandbox_Runtime", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(fmt.Sprintf("%v", this.Spec), "Any", "types.Any", 1) + `,`, + `Labels:` + mapStringForLabels + `,`, + `CreatedAt:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.CreatedAt), "Timestamp", "types.Timestamp", 1), `&`, ``, 1) + `,`, + `UpdatedAt:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.UpdatedAt), "Timestamp", "types.Timestamp", 1), `&`, ``, 1) + `,`, + `Extensions:` + mapStringForExtensions + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *Sandbox_Runtime) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Sandbox_Runtime{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `Options:` + strings.Replace(fmt.Sprintf("%v", this.Options), "Any", "types.Any", 1) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func valueToStringSandbox(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *Sandbox) 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: Sandbox: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Sandbox: 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 != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Runtime", 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 := m.Runtime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", 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.Spec == nil { + m.Spec = &types.Any{} + } + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Labels", 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.Labels == nil { + m.Labels = make(map[string]string) + } + var mapkey string + var mapvalue string + for iNdEx < postIndex { + entryPreIndex := 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) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthSandbox + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthSandbox + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLengthSandbox + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue < 0 { + return ErrInvalidLengthSandbox + } + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + } else { + iNdEx = entryPreIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Labels[mapkey] = mapvalue + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", 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.CreatedAt, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UpdatedAt", 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.UpdatedAt, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Extensions", 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.Extensions == nil { + m.Extensions = make(map[string]types.Any) + } + var mapkey string + mapvalue := &types.Any{} + for iNdEx < postIndex { + entryPreIndex := 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) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthSandbox + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthSandbox + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return ErrInvalidLengthSandbox + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return ErrInvalidLengthSandbox + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &types.Any{} + if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Extensions[mapkey] = *mapvalue + 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 *Sandbox_Runtime) 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: Runtime: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Runtime: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", 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.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + 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 = &types.Any{} + } + if err := m.Options.Unmarshal(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 skipSandbox(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSandbox + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSandbox + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSandbox + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthSandbox + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupSandbox + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthSandbox + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthSandbox = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowSandbox = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupSandbox = fmt.Errorf("proto: unexpected end of group") +) diff --git a/api/types/sandbox.proto b/api/types/sandbox.proto new file mode 100644 index 000000000..b40e84bf4 --- /dev/null +++ b/api/types/sandbox.proto @@ -0,0 +1,51 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +syntax = "proto3"; + +package containerd.types; + +import weak "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "github.com/containerd/containerd/api/types;types"; + +// Sandbox represents a sandbox metadata object that keeps all info required by controller to +// work with a particular instance. containerd keeps this in metadata store and sends it to a controller with +// each request, so they can reflect sandbox state changes (by updating the corresponding fields). +message Sandbox { + // SandboxID is a unique instance identifier within namespace + string sandbox_id = 1; + message Runtime { + // Name is the name of the runtime. + string name = 1; + // Options specify additional runtime initialization options. + google.protobuf.Any options = 2; + } + // Runtime specifies which runtime to use for executing this container. + Runtime runtime = 2 [(gogoproto.nullable) = false]; + // Spec is sandbox configuration (kin of OCI runtime spec, but for VM) + google.protobuf.Any spec = 3; + // Labels provides an area to include arbitrary data on containers. + map labels = 4 [(gogoproto.nullable) = false]; + // CreatedAt is the time the container was first created. + google.protobuf.Timestamp created_at = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + // UpdatedAt is the last time the container was mutated. + google.protobuf.Timestamp updated_at = 6 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + // Extensions allow clients to provide optional blobs that can be handled by runtime. + map extensions = 7 [(gogoproto.nullable) = false]; +} diff --git a/runtime/v2/task/sandbox.pb.go b/runtime/v2/task/sandbox.pb.go new file mode 100644 index 000000000..23cb6402c --- /dev/null +++ b/runtime/v2/task/sandbox.pb.go @@ -0,0 +1,2972 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: github.com/containerd/containerd/runtime/v2/task/sandbox.proto + +package task + +import ( + context "context" + fmt "fmt" + 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" + io "io" + math "math" + math_bits "math/bits" + reflect "reflect" + strings "strings" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +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:"-"` +} + +func (m *StartSandboxRequest) Reset() { *m = StartSandboxRequest{} } +func (*StartSandboxRequest) ProtoMessage() {} +func (*StartSandboxRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_1a2e6d1f55947a07, []int{0} +} +func (m *StartSandboxRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StartSandboxRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StartSandboxRequest.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 *StartSandboxRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_StartSandboxRequest.Merge(m, src) +} +func (m *StartSandboxRequest) XXX_Size() int { + return m.Size() +} +func (m *StartSandboxRequest) XXX_DiscardUnknown() { + xxx_messageInfo_StartSandboxRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_StartSandboxRequest proto.InternalMessageInfo + +type StartSandboxResponse struct { + Pid string `protobuf:"bytes,1,opt,name=pid,proto3" json:"pid,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StartSandboxResponse) Reset() { *m = StartSandboxResponse{} } +func (*StartSandboxResponse) ProtoMessage() {} +func (*StartSandboxResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_1a2e6d1f55947a07, []int{1} +} +func (m *StartSandboxResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StartSandboxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StartSandboxResponse.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 *StartSandboxResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_StartSandboxResponse.Merge(m, src) +} +func (m *StartSandboxResponse) XXX_Size() int { + return m.Size() +} +func (m *StartSandboxResponse) XXX_DiscardUnknown() { + xxx_messageInfo_StartSandboxResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_StartSandboxResponse proto.InternalMessageInfo + +type StopSandboxRequest 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:"-"` +} + +func (m *StopSandboxRequest) Reset() { *m = StopSandboxRequest{} } +func (*StopSandboxRequest) ProtoMessage() {} +func (*StopSandboxRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_1a2e6d1f55947a07, []int{2} +} +func (m *StopSandboxRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StopSandboxRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StopSandboxRequest.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 *StopSandboxRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_StopSandboxRequest.Merge(m, src) +} +func (m *StopSandboxRequest) XXX_Size() int { + return m.Size() +} +func (m *StopSandboxRequest) XXX_DiscardUnknown() { + xxx_messageInfo_StopSandboxRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_StopSandboxRequest proto.InternalMessageInfo + +type StopSandboxResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StopSandboxResponse) Reset() { *m = StopSandboxResponse{} } +func (*StopSandboxResponse) ProtoMessage() {} +func (*StopSandboxResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_1a2e6d1f55947a07, []int{3} +} +func (m *StopSandboxResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StopSandboxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StopSandboxResponse.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 *StopSandboxResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_StopSandboxResponse.Merge(m, src) +} +func (m *StopSandboxResponse) XXX_Size() int { + return m.Size() +} +func (m *StopSandboxResponse) XXX_DiscardUnknown() { + xxx_messageInfo_StopSandboxResponse.DiscardUnknown(m) +} + +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"` + 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:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UpdateSandboxRequest) Reset() { *m = UpdateSandboxRequest{} } +func (*UpdateSandboxRequest) ProtoMessage() {} +func (*UpdateSandboxRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_1a2e6d1f55947a07, []int{4} +} +func (m *UpdateSandboxRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UpdateSandboxRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_UpdateSandboxRequest.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 *UpdateSandboxRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_UpdateSandboxRequest.Merge(m, src) +} +func (m *UpdateSandboxRequest) XXX_Size() int { + return m.Size() +} +func (m *UpdateSandboxRequest) XXX_DiscardUnknown() { + xxx_messageInfo_UpdateSandboxRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_UpdateSandboxRequest proto.InternalMessageInfo + +type UpdateSandboxResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UpdateSandboxResponse) Reset() { *m = UpdateSandboxResponse{} } +func (*UpdateSandboxResponse) ProtoMessage() {} +func (*UpdateSandboxResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_1a2e6d1f55947a07, []int{5} +} +func (m *UpdateSandboxResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UpdateSandboxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_UpdateSandboxResponse.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 *UpdateSandboxResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_UpdateSandboxResponse.Merge(m, src) +} +func (m *UpdateSandboxResponse) XXX_Size() int { + return m.Size() +} +func (m *UpdateSandboxResponse) XXX_DiscardUnknown() { + xxx_messageInfo_UpdateSandboxResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_UpdateSandboxResponse proto.InternalMessageInfo + +type SandboxStatusRequest 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 *SandboxStatusRequest) Reset() { *m = SandboxStatusRequest{} } +func (*SandboxStatusRequest) ProtoMessage() {} +func (*SandboxStatusRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_1a2e6d1f55947a07, []int{6} +} +func (m *SandboxStatusRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SandboxStatusRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SandboxStatusRequest.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 *SandboxStatusRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SandboxStatusRequest.Merge(m, src) +} +func (m *SandboxStatusRequest) XXX_Size() int { + return m.Size() +} +func (m *SandboxStatusRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SandboxStatusRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_SandboxStatusRequest proto.InternalMessageInfo + +type PauseSandboxRequest 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 *PauseSandboxRequest) Reset() { *m = PauseSandboxRequest{} } +func (*PauseSandboxRequest) ProtoMessage() {} +func (*PauseSandboxRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_1a2e6d1f55947a07, []int{7} +} +func (m *PauseSandboxRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PauseSandboxRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PauseSandboxRequest.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 *PauseSandboxRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_PauseSandboxRequest.Merge(m, src) +} +func (m *PauseSandboxRequest) XXX_Size() int { + return m.Size() +} +func (m *PauseSandboxRequest) XXX_DiscardUnknown() { + xxx_messageInfo_PauseSandboxRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_PauseSandboxRequest proto.InternalMessageInfo + +type PauseSandboxResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PauseSandboxResponse) Reset() { *m = PauseSandboxResponse{} } +func (*PauseSandboxResponse) ProtoMessage() {} +func (*PauseSandboxResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_1a2e6d1f55947a07, []int{8} +} +func (m *PauseSandboxResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PauseSandboxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PauseSandboxResponse.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 *PauseSandboxResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_PauseSandboxResponse.Merge(m, src) +} +func (m *PauseSandboxResponse) XXX_Size() int { + return m.Size() +} +func (m *PauseSandboxResponse) XXX_DiscardUnknown() { + xxx_messageInfo_PauseSandboxResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_PauseSandboxResponse proto.InternalMessageInfo + +type ResumeSandboxRequest 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 *ResumeSandboxRequest) Reset() { *m = ResumeSandboxRequest{} } +func (*ResumeSandboxRequest) ProtoMessage() {} +func (*ResumeSandboxRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_1a2e6d1f55947a07, []int{9} +} +func (m *ResumeSandboxRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResumeSandboxRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ResumeSandboxRequest.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 *ResumeSandboxRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResumeSandboxRequest.Merge(m, src) +} +func (m *ResumeSandboxRequest) XXX_Size() int { + return m.Size() +} +func (m *ResumeSandboxRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ResumeSandboxRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ResumeSandboxRequest proto.InternalMessageInfo + +type ResumeSandboxResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ResumeSandboxResponse) Reset() { *m = ResumeSandboxResponse{} } +func (*ResumeSandboxResponse) ProtoMessage() {} +func (*ResumeSandboxResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_1a2e6d1f55947a07, []int{10} +} +func (m *ResumeSandboxResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResumeSandboxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ResumeSandboxResponse.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 *ResumeSandboxResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResumeSandboxResponse.Merge(m, src) +} +func (m *ResumeSandboxResponse) XXX_Size() int { + return m.Size() +} +func (m *ResumeSandboxResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ResumeSandboxResponse.DiscardUnknown(m) +} + +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:"-"` +} + +func (m *SandboxStatusResponse) Reset() { *m = SandboxStatusResponse{} } +func (*SandboxStatusResponse) ProtoMessage() {} +func (*SandboxStatusResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_1a2e6d1f55947a07, []int{11} +} +func (m *SandboxStatusResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SandboxStatusResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SandboxStatusResponse.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 *SandboxStatusResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_SandboxStatusResponse.Merge(m, src) +} +func (m *SandboxStatusResponse) XXX_Size() int { + return m.Size() +} +func (m *SandboxStatusResponse) XXX_DiscardUnknown() { + xxx_messageInfo_SandboxStatusResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_SandboxStatusResponse proto.InternalMessageInfo + +type PingRequest 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 *PingRequest) Reset() { *m = PingRequest{} } +func (*PingRequest) ProtoMessage() {} +func (*PingRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_1a2e6d1f55947a07, []int{12} +} +func (m *PingRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PingRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PingRequest.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 *PingRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_PingRequest.Merge(m, src) +} +func (m *PingRequest) XXX_Size() int { + return m.Size() +} +func (m *PingRequest) XXX_DiscardUnknown() { + xxx_messageInfo_PingRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_PingRequest proto.InternalMessageInfo + +type PingResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PingResponse) Reset() { *m = PingResponse{} } +func (*PingResponse) ProtoMessage() {} +func (*PingResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_1a2e6d1f55947a07, []int{13} +} +func (m *PingResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PingResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PingResponse.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 *PingResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_PingResponse.Merge(m, src) +} +func (m *PingResponse) XXX_Size() int { + return m.Size() +} +func (m *PingResponse) XXX_DiscardUnknown() { + xxx_messageInfo_PingResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_PingResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*StartSandboxRequest)(nil), "containerd.task.v2.StartSandboxRequest") + proto.RegisterType((*StartSandboxResponse)(nil), "containerd.task.v2.StartSandboxResponse") + proto.RegisterType((*StopSandboxRequest)(nil), "containerd.task.v2.StopSandboxRequest") + 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((*UpdateSandboxResponse)(nil), "containerd.task.v2.UpdateSandboxResponse") + proto.RegisterType((*SandboxStatusRequest)(nil), "containerd.task.v2.SandboxStatusRequest") + proto.RegisterType((*PauseSandboxRequest)(nil), "containerd.task.v2.PauseSandboxRequest") + proto.RegisterType((*PauseSandboxResponse)(nil), "containerd.task.v2.PauseSandboxResponse") + proto.RegisterType((*ResumeSandboxRequest)(nil), "containerd.task.v2.ResumeSandboxRequest") + proto.RegisterType((*ResumeSandboxResponse)(nil), "containerd.task.v2.ResumeSandboxResponse") + proto.RegisterType((*SandboxStatusResponse)(nil), "containerd.task.v2.SandboxStatusResponse") + proto.RegisterType((*PingRequest)(nil), "containerd.task.v2.PingRequest") + proto.RegisterType((*PingResponse)(nil), "containerd.task.v2.PingResponse") +} + +func init() { + proto.RegisterFile("github.com/containerd/containerd/runtime/v2/task/sandbox.proto", fileDescriptor_1a2e6d1f55947a07) +} + +var fileDescriptor_1a2e6d1f55947a07 = []byte{ + // 588 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x4d, 0x6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x85, + 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, +} + +func (m *StartSandboxRequest) 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 *StartSandboxRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StartSandboxRequest) 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.BundlePath) > 0 { + i -= len(m.BundlePath) + copy(dAtA[i:], m.BundlePath) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.BundlePath))) + i-- + dAtA[i] = 0x12 + } + 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 *StartSandboxResponse) 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 *StartSandboxResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StartSandboxResponse) 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.Pid) > 0 { + i -= len(m.Pid) + copy(dAtA[i:], m.Pid) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.Pid))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *StopSandboxRequest) 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 *StopSandboxRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StopSandboxRequest) 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 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) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.SandboxID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *StopSandboxResponse) 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 *StopSandboxResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StopSandboxResponse) 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) + } + return len(dAtA) - i, nil +} + +func (m *UpdateSandboxRequest) 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 *UpdateSandboxRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *UpdateSandboxRequest) 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.Annotations) > 0 { + for k := range m.Annotations { + v := m.Annotations[k] + baseI := i + i -= len(v) + copy(dAtA[i:], v) + i = encodeVarintSandbox(dAtA, i, uint64(len(v))) + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarintSandbox(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarintSandbox(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x1a + } + } + if m.Resources != nil { + { + size, err := m.Resources.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) + copy(dAtA[i:], m.SandboxID) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.SandboxID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *UpdateSandboxResponse) 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 *UpdateSandboxResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *UpdateSandboxResponse) 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) + } + return len(dAtA) - i, nil +} + +func (m *SandboxStatusRequest) 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 *SandboxStatusRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SandboxStatusRequest) 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 *PauseSandboxRequest) 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 *PauseSandboxRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PauseSandboxRequest) 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 *PauseSandboxResponse) 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 *PauseSandboxResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PauseSandboxResponse) 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) + } + return len(dAtA) - i, nil +} + +func (m *ResumeSandboxRequest) 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 *ResumeSandboxRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResumeSandboxRequest) 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 *ResumeSandboxResponse) 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 *ResumeSandboxResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResumeSandboxResponse) 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) + } + return len(dAtA) - i, nil +} + +func (m *SandboxStatusResponse) 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 *SandboxStatusResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SandboxStatusResponse) 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 m.Status != nil { + { + size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSandbox(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *PingRequest) 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 *PingRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PingRequest) 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 *PingResponse) 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 *PingResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PingResponse) 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) + } + return len(dAtA) - i, nil +} + +func encodeVarintSandbox(dAtA []byte, offset int, v uint64) int { + offset -= sovSandbox(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *StartSandboxRequest) 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)) + } + l = len(m.BundlePath) + if l > 0 { + n += 1 + l + sovSandbox(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *StartSandboxResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Pid) + if l > 0 { + n += 1 + l + sovSandbox(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *StopSandboxRequest) 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.TimeoutSecs != 0 { + n += 1 + sovSandbox(uint64(m.TimeoutSecs)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *StopSandboxResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *UpdateSandboxRequest) 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.Resources != nil { + l = m.Resources.Size() + n += 1 + l + sovSandbox(uint64(l)) + } + if len(m.Annotations) > 0 { + for k, v := range m.Annotations { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovSandbox(uint64(len(k))) + 1 + len(v) + sovSandbox(uint64(len(v))) + n += mapEntrySize + 1 + sovSandbox(uint64(mapEntrySize)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *UpdateSandboxResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *SandboxStatusRequest) 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 *PauseSandboxRequest) 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 *PauseSandboxResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ResumeSandboxRequest) 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 *ResumeSandboxResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *SandboxStatusResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Status != nil { + l = m.Status.Size() + n += 1 + l + sovSandbox(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *PingRequest) 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 *PingResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovSandbox(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozSandbox(x uint64) (n int) { + return sovSandbox(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *StartSandboxRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&StartSandboxRequest{`, + `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, + `BundlePath:` + fmt.Sprintf("%v", this.BundlePath) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *StartSandboxResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&StartSandboxResponse{`, + `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *StopSandboxRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&StopSandboxRequest{`, + `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, + `TimeoutSecs:` + fmt.Sprintf("%v", this.TimeoutSecs) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *StopSandboxResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&StopSandboxResponse{`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *UpdateSandboxRequest) String() string { + if this == nil { + return "nil" + } + keysForAnnotations := make([]string, 0, len(this.Annotations)) + for k, _ := range this.Annotations { + keysForAnnotations = append(keysForAnnotations, k) + } + github_com_gogo_protobuf_sortkeys.Strings(keysForAnnotations) + mapStringForAnnotations := "map[string]string{" + for _, k := range keysForAnnotations { + mapStringForAnnotations += fmt.Sprintf("%v: %v,", k, this.Annotations[k]) + } + mapStringForAnnotations += "}" + s := strings.Join([]string{`&UpdateSandboxRequest{`, + `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, + `Resources:` + strings.Replace(fmt.Sprintf("%v", this.Resources), "Any", "types.Any", 1) + `,`, + `Annotations:` + mapStringForAnnotations + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *UpdateSandboxResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&UpdateSandboxResponse{`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *SandboxStatusRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&SandboxStatusRequest{`, + `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *PauseSandboxRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PauseSandboxRequest{`, + `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *PauseSandboxResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PauseSandboxResponse{`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *ResumeSandboxRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ResumeSandboxRequest{`, + `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *ResumeSandboxResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ResumeSandboxResponse{`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *SandboxStatusResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&SandboxStatusResponse{`, + `Status:` + strings.Replace(fmt.Sprintf("%v", this.Status), "Any", "types.Any", 1) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *PingRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PingRequest{`, + `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *PingResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PingResponse{`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func valueToStringSandbox(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} + +type SandboxService interface { + StartSandbox(ctx context.Context, req *StartSandboxRequest) (*StartSandboxResponse, error) + StopSandbox(ctx context.Context, req *StopSandboxRequest) (*StopSandboxResponse, 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) + SandboxStatus(ctx context.Context, req *SandboxStatusRequest) (*SandboxStatusResponse, error) + PingSandbox(ctx context.Context, req *PingRequest) (*PingResponse, error) +} + +func RegisterSandboxService(srv *github_com_containerd_ttrpc.Server, svc SandboxService) { + srv.Register("containerd.task.v2.Sandbox", map[string]github_com_containerd_ttrpc.Method{ + "StartSandbox": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) { + var req StartSandboxRequest + if err := unmarshal(&req); err != nil { + return nil, err + } + return svc.StartSandbox(ctx, &req) + }, + "StopSandbox": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) { + var req StopSandboxRequest + if err := unmarshal(&req); err != nil { + return nil, err + } + return svc.StopSandbox(ctx, &req) + }, + "UpdateSandbox": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) { + var req UpdateSandboxRequest + if err := unmarshal(&req); err != nil { + return nil, err + } + return svc.UpdateSandbox(ctx, &req) + }, + "PauseSandbox": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) { + var req PauseSandboxRequest + if err := unmarshal(&req); err != nil { + return nil, err + } + return svc.PauseSandbox(ctx, &req) + }, + "ResumeSandbox": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) { + var req ResumeSandboxRequest + if err := unmarshal(&req); err != nil { + return nil, err + } + return svc.ResumeSandbox(ctx, &req) + }, + "SandboxStatus": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) { + var req SandboxStatusRequest + if err := unmarshal(&req); err != nil { + return nil, err + } + return svc.SandboxStatus(ctx, &req) + }, + "PingSandbox": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) { + var req PingRequest + if err := unmarshal(&req); err != nil { + return nil, err + } + return svc.PingSandbox(ctx, &req) + }, + }) +} + +type sandboxClient struct { + client *github_com_containerd_ttrpc.Client +} + +func NewSandboxClient(client *github_com_containerd_ttrpc.Client) SandboxService { + return &sandboxClient{ + client: client, + } +} + +func (c *sandboxClient) StartSandbox(ctx context.Context, req *StartSandboxRequest) (*StartSandboxResponse, error) { + var resp StartSandboxResponse + if err := c.client.Call(ctx, "containerd.task.v2.Sandbox", "StartSandbox", req, &resp); err != nil { + return nil, err + } + return &resp, nil +} + +func (c *sandboxClient) StopSandbox(ctx context.Context, req *StopSandboxRequest) (*StopSandboxResponse, error) { + var resp StopSandboxResponse + if err := c.client.Call(ctx, "containerd.task.v2.Sandbox", "StopSandbox", 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 { + return nil, err + } + return &resp, nil +} + +func (c *sandboxClient) PauseSandbox(ctx context.Context, req *PauseSandboxRequest) (*PauseSandboxResponse, error) { + var resp PauseSandboxResponse + if err := c.client.Call(ctx, "containerd.task.v2.Sandbox", "PauseSandbox", req, &resp); err != nil { + return nil, err + } + return &resp, nil +} + +func (c *sandboxClient) ResumeSandbox(ctx context.Context, req *ResumeSandboxRequest) (*ResumeSandboxResponse, error) { + var resp ResumeSandboxResponse + if err := c.client.Call(ctx, "containerd.task.v2.Sandbox", "ResumeSandbox", req, &resp); err != nil { + return nil, err + } + return &resp, nil +} + +func (c *sandboxClient) SandboxStatus(ctx context.Context, req *SandboxStatusRequest) (*SandboxStatusResponse, error) { + var resp SandboxStatusResponse + if err := c.client.Call(ctx, "containerd.task.v2.Sandbox", "SandboxStatus", req, &resp); err != nil { + return nil, err + } + return &resp, nil +} + +func (c *sandboxClient) PingSandbox(ctx context.Context, req *PingRequest) (*PingResponse, error) { + var resp PingResponse + if err := c.client.Call(ctx, "containerd.task.v2.Sandbox", "PingSandbox", req, &resp); err != nil { + return nil, err + } + return &resp, nil +} +func (m *StartSandboxRequest) 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: StartSandboxRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StartSandboxRequest: 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 != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BundlePath", 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.BundlePath = 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 *StartSandboxResponse) 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: StartSandboxResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StartSandboxResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pid", 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.Pid = 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 *StopSandboxRequest) 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: StopSandboxRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StopSandboxRequest: 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 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:]) + 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 *StopSandboxResponse) 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: StopSandboxResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StopSandboxResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 *UpdateSandboxRequest) 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: UpdateSandboxRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UpdateSandboxRequest: 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 != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Resources", 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.Resources == nil { + m.Resources = &types.Any{} + } + if err := m.Resources.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Annotations", 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.Annotations == nil { + m.Annotations = make(map[string]string) + } + var mapkey string + var mapvalue string + for iNdEx < postIndex { + entryPreIndex := 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) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthSandbox + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthSandbox + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLengthSandbox + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue < 0 { + return ErrInvalidLengthSandbox + } + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + } else { + iNdEx = entryPreIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Annotations[mapkey] = mapvalue + 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 + 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: UpdateSandboxResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UpdateSandboxResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 *SandboxStatusRequest) 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: SandboxStatusRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SandboxStatusRequest: 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 *PauseSandboxRequest) 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: PauseSandboxRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PauseSandboxRequest: 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 *PauseSandboxResponse) 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: PauseSandboxResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PauseSandboxResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 *ResumeSandboxRequest) 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: ResumeSandboxRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResumeSandboxRequest: 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 *ResumeSandboxResponse) 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: ResumeSandboxResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResumeSandboxResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 *SandboxStatusResponse) 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: SandboxStatusResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SandboxStatusResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", 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.Status == nil { + m.Status = &types.Any{} + } + if err := m.Status.Unmarshal(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 *PingRequest) 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: PingRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PingRequest: 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 *PingResponse) 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: PingResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PingResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 skipSandbox(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSandbox + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSandbox + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSandbox + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthSandbox + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupSandbox + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthSandbox + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthSandbox = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowSandbox = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupSandbox = fmt.Errorf("proto: unexpected end of group") +) diff --git a/runtime/v2/task/sandbox.proto b/runtime/v2/task/sandbox.proto new file mode 100644 index 000000000..cb7caac4e --- /dev/null +++ b/runtime/v2/task/sandbox.proto @@ -0,0 +1,98 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +syntax = "proto3"; + +package containerd.task.v2; + +import "google/protobuf/any.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 +// holds resources relevant for this group. +service Sandbox { + // StartSandbox will create/start a new sandbox instance + rpc StartSandbox(StartSandboxRequest) returns (StartSandboxResponse); + + // StopSandbox will stop existing sandbox instance + rpc StopSandbox(StopSandboxRequest) returns (StopSandboxResponse); + + // 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); + + // PauseSandbox will suspend currently running sandbox instance. + rpc PauseSandbox(PauseSandboxRequest) returns (PauseSandboxResponse); + + // ResumeSandbox will resuyme previously suspended sandbox instance. + rpc ResumeSandbox(ResumeSandboxRequest) returns (ResumeSandboxResponse); + + // SandboxStatus will return current status of the running sandbox instance + rpc SandboxStatus(SandboxStatusRequest) returns (SandboxStatusResponse); + + // PingSandbox is a lightweight API call to check whether sandbox alive. + rpc PingSandbox(PingRequest) returns (PingResponse); +} + +message StartSandboxRequest { + string sandbox_id = 1; + string bundle_path = 2; +} + +message StartSandboxResponse { + string pid = 1; +} + +message StopSandboxRequest { + string sandbox_id = 1; + uint32 timeout_secs = 2; +} + +message StopSandboxResponse {} + +message UpdateSandboxRequest { + string sandbox_id = 1; + google.protobuf.Any resources = 2; + map annotations = 3; +} + +message UpdateSandboxResponse {} + +message SandboxStatusRequest { + string sandbox_id = 1; +} + +message PauseSandboxRequest { + string sandbox_id = 1; +} + +message PauseSandboxResponse {} + +message ResumeSandboxRequest { + string sandbox_id = 1; +} + +message ResumeSandboxResponse {} + +message SandboxStatusResponse { + google.protobuf.Any status = 1; +} + +message PingRequest { + string sandbox_id = 1; +} + +message PingResponse {} From 87d4c8923e1c36c88f3985db493bc39184f8e2de Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Mon, 19 Apr 2021 15:09:55 -0700 Subject: [PATCH 02/22] [sandbox] Add basic sandbox structures and interfaces Signed-off-by: Maksym Pavlenko --- sandbox/controller.go | 60 +++++++++++++++++++++++++++++++++++++++ sandbox/helpers.go | 53 ++++++++++++++++++++++++++++++++++ sandbox/store.go | 66 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 179 insertions(+) create mode 100644 sandbox/controller.go create mode 100644 sandbox/helpers.go create mode 100644 sandbox/store.go diff --git a/sandbox/controller.go b/sandbox/controller.go new file mode 100644 index 000000000..dd5f11547 --- /dev/null +++ b/sandbox/controller.go @@ -0,0 +1,60 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package sandbox + +import ( + "context" + + "github.com/gogo/protobuf/types" +) + +// Controller is an interface to manage a runtime sandbox instance (runtimes's SandboxManager) +// SandboxRuntime is responsible for the sandbox instances lifecycle management. +// When running the traditional containerd shim, the workflow looks as follows: +// For each new task we're about to run: +// 1. Invoke `shim_binary --start` to obtain `TaskService` address (printed in stdout) +// 2. Call TaskService.RunContainer(id=1) +// 3. Exec `shim_binary --delete` to stop shim +// 4. Exec `shim_binary --start` again to obtain another `TaskService` address +// 5. TaskService.RunContainer(id=2) +// 6. Exec `shim_binary --delete` to stop shim +// +// When running in sandbox mode, shim must implement `SandboxService`. In sandbox mode shim lifetimes are managed manually. +// 1. Client calls `client.Controller.Start()` to launch new shim and create sandbox process +// 2. Run containers with `shim.TaskService.RunContainer(id=1)` and another one `shim.TaskService.RunContainer(id=2)` +// 3. ... usual container lifecycle calls to `shim.TaskService` +// 4. Client calls shim to stop the VM with `client.SandboxService.Shutdown()` +// 5. Shim implementation will perform cleanup similar to regular task service (e.g. shutdown, clean, and `shim_binary --delete`) +type Controller interface { + // Start will start new sandbox instance. + // 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 + // Shutdown deletes and cleans all tasks and sandbox instance. + Shutdown(ctx context.Context, sandboxID string) 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 + // Resume will unfreeze previously paused sandbox instance + Resume(ctx context.Context, sandboxID string) error + // Ping is a lightweight API call to check whether sandbox instance is still alive. + // This should not involve any complex logic and containerd will not debug log it as it might be called quite often. + Ping(ctx context.Context, sandboxID string) error + // Status will query sandbox process status + Status(ctx context.Context, sandboxID string) (*types.Any, error) +} diff --git a/sandbox/helpers.go b/sandbox/helpers.go new file mode 100644 index 000000000..420589cca --- /dev/null +++ b/sandbox/helpers.go @@ -0,0 +1,53 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package sandbox + +import ( + "github.com/containerd/containerd/api/types" +) + +// ToProto will map Sandbox struct to it's protobuf definition +func ToProto(s *Sandbox) types.Sandbox { + return types.Sandbox{ + SandboxID: s.ID, + Runtime: types.Sandbox_Runtime{ + Name: s.Runtime.Name, + Options: s.Runtime.Options, + }, + Labels: s.Labels, + CreatedAt: s.CreatedAt, + UpdatedAt: s.UpdatedAt, + Extensions: s.Extensions, + } +} + +// FromProto map protobuf sandbox definition to Sandbox struct +func FromProto(p *types.Sandbox) Sandbox { + runtime := RuntimeOpts{ + Name: p.Runtime.Name, + Options: p.Runtime.Options, + } + + return Sandbox{ + ID: p.SandboxID, + Labels: p.Labels, + Runtime: runtime, + CreatedAt: p.CreatedAt, + UpdatedAt: p.UpdatedAt, + Extensions: p.Extensions, + } +} diff --git a/sandbox/store.go b/sandbox/store.go new file mode 100644 index 000000000..fd467aadb --- /dev/null +++ b/sandbox/store.go @@ -0,0 +1,66 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package sandbox + +import ( + "context" + "time" + + "github.com/gogo/protobuf/types" +) + +// Sandbox is an object stored in metadata database +type Sandbox struct { + // ID uniquely identifies the sandbox in a namespace + ID string + // Labels provide metadata extension for a sandbox + Labels map[string]string + // Runtime shim to use for this sandbox + Runtime RuntimeOpts + // Spec carries the runtime specification used to implement the sandbox + Spec *types.Any + // CreatedAt is the time at which the sandbox was created + CreatedAt time.Time + // UpdatedAt is the time at which the sandbox was updated + UpdatedAt time.Time + // Extensions stores client-specified metadata + Extensions map[string]types.Any +} + +// RuntimeOpts holds runtime specific information +type RuntimeOpts struct { + Name string + Options *types.Any +} + +// Store is a storage interface for sandbox metadata objects +type Store interface { + // Create a sandbox record in the store + Create(ctx context.Context, sandbox Sandbox) (Sandbox, error) + + // Update the sandbox with the provided sandbox object and fields + Update(ctx context.Context, sandbox Sandbox, fieldpaths ...string) (Sandbox, error) + + // Get sandbox metadata using the id + Get(ctx context.Context, id string) (Sandbox, error) + + // List returns sandboxes that match one or more of the provided filters + List(ctx context.Context, filters ...string) ([]Sandbox, error) + + // Delete a sandbox from metadata store using the id + Delete(ctx context.Context, id string) error +} From cab7d5b3d29858d948fa965c46eaff49269523e8 Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Mon, 19 Apr 2021 15:10:50 -0700 Subject: [PATCH 03/22] [sandbox] Implement metadata store Signed-off-by: Maksym Pavlenko --- metadata/adaptors.go | 18 ++ metadata/buckets.go | 18 ++ metadata/sandbox.go | 374 +++++++++++++++++++++++++++++++++++++++ metadata/sandbox_test.go | 290 ++++++++++++++++++++++++++++++ 4 files changed, 700 insertions(+) create mode 100644 metadata/sandbox.go create mode 100644 metadata/sandbox_test.go diff --git a/metadata/adaptors.go b/metadata/adaptors.go index c5d576f84..dbff7bacd 100644 --- a/metadata/adaptors.go +++ b/metadata/adaptors.go @@ -24,6 +24,7 @@ import ( "github.com/containerd/containerd/filters" "github.com/containerd/containerd/images" "github.com/containerd/containerd/leases" + "github.com/containerd/containerd/sandbox" "github.com/containerd/containerd/snapshots" ) @@ -149,6 +150,23 @@ func adaptSnapshot(info snapshots.Info) filters.Adaptor { }) } +func adaptSandbox(instance *sandbox.Sandbox) filters.Adaptor { + return filters.AdapterFunc(func(fieldpath []string) (string, bool) { + if len(fieldpath) == 0 { + return "", false + } + + switch fieldpath[0] { + case "id": + return instance.ID, true + case "labels": + return checkMap(fieldpath[1:], instance.Labels) + default: + return "", false + } + }) +} + func checkMap(fieldpath []string, m map[string]string) (string, bool) { if len(m) == 0 { return "", false diff --git a/metadata/buckets.go b/metadata/buckets.go index d23be84fe..af3318306 100644 --- a/metadata/buckets.go +++ b/metadata/buckets.go @@ -130,6 +130,7 @@ var ( bucketKeyObjectBlob = []byte("blob") // stores content links bucketKeyObjectIngests = []byte("ingests") // stores ingest objects bucketKeyObjectLeases = []byte("leases") // stores leases + bucketKeyObjectSandboxes = []byte("sandboxes") // stores sandboxes bucketKeyDigest = []byte("digest") bucketKeyMediaType = []byte("mediatype") @@ -149,6 +150,7 @@ var ( bucketKeyExpected = []byte("expected") bucketKeyRef = []byte("ref") bucketKeyExpireAt = []byte("expireat") + bucketKeySandboxID = []byte("sandboxid") deprecatedBucketKeyObjectIngest = []byte("ingest") // stores ingest links, deprecated in v1.2 ) @@ -270,3 +272,19 @@ func createIngestBucket(tx *bolt.Tx, namespace, ref string) (*bolt.Bucket, error func getIngestBucket(tx *bolt.Tx, namespace, ref string) *bolt.Bucket { return getBucket(tx, bucketKeyVersion, []byte(namespace), bucketKeyObjectContent, bucketKeyObjectIngests, []byte(ref)) } + +func createSandboxBucket(tx *bolt.Tx, namespace string) (*bolt.Bucket, error) { + return createBucketIfNotExists( + tx, + []byte(namespace), + bucketKeyObjectSandboxes, + ) +} + +func getSandboxBucket(tx *bolt.Tx, namespace string) *bolt.Bucket { + return getBucket( + tx, + []byte(namespace), + bucketKeyObjectSandboxes, + ) +} diff --git a/metadata/sandbox.go b/metadata/sandbox.go new file mode 100644 index 000000000..158e7ba6e --- /dev/null +++ b/metadata/sandbox.go @@ -0,0 +1,374 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package metadata + +import ( + "context" + "strings" + "time" + + "github.com/containerd/containerd/errdefs" + "github.com/containerd/containerd/filters" + "github.com/containerd/containerd/metadata/boltutil" + "github.com/containerd/containerd/namespaces" + api "github.com/containerd/containerd/sandbox" + "github.com/gogo/protobuf/types" + "github.com/pkg/errors" + "go.etcd.io/bbolt" +) + +type sandboxStore struct { + db *DB +} + +var _ api.Store = (*sandboxStore)(nil) + +// NewSandboxStore creates a datababase client for sandboxes +func NewSandboxStore(db *DB) api.Store { + return &sandboxStore{db: db} +} + +// Create a sandbox record in the store +func (s *sandboxStore) Create(ctx context.Context, sandbox api.Sandbox) (api.Sandbox, error) { + ns, err := namespaces.NamespaceRequired(ctx) + if err != nil { + return api.Sandbox{}, err + } + + sandbox.CreatedAt = time.Now().UTC() + sandbox.UpdatedAt = sandbox.CreatedAt + + if err := s.validate(&sandbox); err != nil { + return api.Sandbox{}, errors.Wrap(err, "failed to validate sandbox") + } + + if err := s.db.Update(func(tx *bbolt.Tx) error { + parent, err := createSandboxBucket(tx, ns) + if err != nil { + return err + } + + if err := s.write(parent, &sandbox, false); err != nil { + return err + } + + return nil + }); err != nil { + return api.Sandbox{}, err + } + + return sandbox, nil +} + +// Update the sandbox with the provided sandbox object and fields +func (s *sandboxStore) Update(ctx context.Context, sandbox api.Sandbox, fieldpaths ...string) (api.Sandbox, error) { + ns, err := namespaces.NamespaceRequired(ctx) + if err != nil { + return api.Sandbox{}, err + } + + ret := api.Sandbox{} + if err := update(ctx, s.db, func(tx *bbolt.Tx) error { + parent := getSandboxBucket(tx, ns) + if parent == nil { + return errors.Wrap(errdefs.ErrNotFound, "no sandbox buckets") + } + + updated, err := s.read(parent, []byte(sandbox.ID)) + if err != nil { + return err + } + + if len(fieldpaths) == 0 { + fieldpaths = []string{"labels", "extensions", "spec", "runtime"} + + if updated.Runtime.Name != sandbox.Runtime.Name { + return errors.Wrapf(errdefs.ErrInvalidArgument, "sandbox.Runtime.Name field is immutable") + } + } + + for _, path := range fieldpaths { + if strings.HasPrefix(path, "labels.") { + if updated.Labels == nil { + updated.Labels = map[string]string{} + } + + key := strings.TrimPrefix(path, "labels.") + updated.Labels[key] = sandbox.Labels[key] + continue + } else if strings.HasPrefix(path, "extensions.") { + if updated.Extensions == nil { + updated.Extensions = map[string]types.Any{} + } + + key := strings.TrimPrefix(path, "extensions.") + updated.Extensions[key] = sandbox.Extensions[key] + continue + } + + switch path { + case "labels": + updated.Labels = sandbox.Labels + case "extensions": + updated.Extensions = sandbox.Extensions + case "runtime": + updated.Runtime = sandbox.Runtime + case "spec": + updated.Spec = sandbox.Spec + default: + return errors.Wrapf(errdefs.ErrInvalidArgument, "cannot update %q field on sandbox %q", path, sandbox.ID) + } + } + + updated.UpdatedAt = time.Now().UTC() + + if err := s.validate(&updated); err != nil { + return err + } + + if err := s.write(parent, &updated, true); err != nil { + return err + } + + ret = updated + return nil + }); err != nil { + return api.Sandbox{}, err + } + + return ret, nil +} + +// Get sandbox metadata using the id +func (s *sandboxStore) Get(ctx context.Context, id string) (api.Sandbox, error) { + ns, err := namespaces.NamespaceRequired(ctx) + if err != nil { + return api.Sandbox{}, err + } + + ret := api.Sandbox{} + if err := view(ctx, s.db, func(tx *bbolt.Tx) error { + bucket := getSandboxBucket(tx, ns) + if bucket == nil { + return errors.Wrap(errdefs.ErrNotFound, "no sandbox buckets") + } + + out, err := s.read(bucket, []byte(id)) + if err != nil { + return err + } + + ret = out + return nil + }); err != nil { + return api.Sandbox{}, err + } + + return ret, nil +} + +// List returns sandboxes that match one or more of the provided filters +func (s *sandboxStore) List(ctx context.Context, fields ...string) ([]api.Sandbox, error) { + ns, err := namespaces.NamespaceRequired(ctx) + if err != nil { + return nil, err + } + + filter, err := filters.ParseAll(fields...) + if err != nil { + return nil, errors.Wrap(errdefs.ErrInvalidArgument, err.Error()) + } + + var ( + list []api.Sandbox + ) + + if err := view(ctx, s.db, func(tx *bbolt.Tx) error { + bucket := getSandboxBucket(tx, ns) + if bucket == nil { + return errors.Wrap(errdefs.ErrNotFound, "not sandbox buckets") + } + + if err := bucket.ForEach(func(k, v []byte) error { + info, err := s.read(bucket, k) + if err != nil { + return errors.Wrapf(err, "failed to read bucket %q", string(k)) + } + + if filter.Match(adaptSandbox(&info)) { + list = append(list, info) + } + + return nil + }); err != nil { + return err + } + + return nil + }); err != nil { + return nil, err + } + + return list, nil +} + +// Delete a sandbox from metadata store using the id +func (s *sandboxStore) Delete(ctx context.Context, id string) error { + ns, err := namespaces.NamespaceRequired(ctx) + if err != nil { + return err + } + + if err := update(ctx, s.db, func(tx *bbolt.Tx) error { + buckets := getSandboxBucket(tx, ns) + if buckets == nil { + return errors.Wrap(errdefs.ErrNotFound, "no sandbox buckets") + } + + if err := buckets.DeleteBucket([]byte(id)); err != nil { + return errors.Wrapf(err, "failed to delete sandbox %q", id) + } + + return nil + }); err != nil { + return err + } + + return nil +} + +func (s *sandboxStore) write(parent *bbolt.Bucket, instance *api.Sandbox, overwrite bool) error { + var ( + bucket *bbolt.Bucket + err error + id = []byte(instance.ID) + ) + + if overwrite { + bucket, err = parent.CreateBucketIfNotExists(id) + if err != nil { + return err + } + } else { + bucket = parent.Bucket(id) + if bucket != nil { + return errors.Wrapf(errdefs.ErrAlreadyExists, "sandbox bucket %q already exists", instance.ID) + } + + bucket, err = parent.CreateBucket(id) + if err != nil { + return err + } + } + + if err := boltutil.WriteTimestamps(bucket, instance.CreatedAt, instance.UpdatedAt); err != nil { + return err + } + + if err := boltutil.WriteLabels(bucket, instance.Labels); err != nil { + return err + } + + if err := boltutil.WriteExtensions(bucket, instance.Extensions); err != nil { + return err + } + + if err := boltutil.WriteAny(bucket, bucketKeySpec, instance.Spec); err != nil { + return err + } + + runtimeBucket, err := bucket.CreateBucketIfNotExists(bucketKeyRuntime) + if err != nil { + return err + } + + if err := runtimeBucket.Put(bucketKeyName, []byte(instance.Runtime.Name)); err != nil { + return err + } + + if err := boltutil.WriteAny(runtimeBucket, bucketKeyOptions, instance.Runtime.Options); err != nil { + return err + } + + return nil +} + +func (s *sandboxStore) read(parent *bbolt.Bucket, id []byte) (api.Sandbox, error) { + var ( + inst api.Sandbox + err error + ) + + bucket := parent.Bucket(id) + if bucket == nil { + return api.Sandbox{}, errors.Wrapf(errdefs.ErrNotFound, "bucket %q not found", id) + } + + inst.ID = string(id) + + inst.Labels, err = boltutil.ReadLabels(bucket) + if err != nil { + return api.Sandbox{}, err + } + + if err := boltutil.ReadTimestamps(bucket, &inst.CreatedAt, &inst.UpdatedAt); err != nil { + return api.Sandbox{}, err + } + + inst.Spec, err = boltutil.ReadAny(bucket, bucketKeySpec) + if err != nil { + return api.Sandbox{}, err + } + + runtimeBucket := bucket.Bucket(bucketKeyRuntime) + if runtimeBucket == nil { + return api.Sandbox{}, errors.New("no runtime bucket") + } + + inst.Runtime.Name = string(runtimeBucket.Get(bucketKeyName)) + inst.Runtime.Options, err = boltutil.ReadAny(runtimeBucket, bucketKeyOptions) + if err != nil { + return api.Sandbox{}, err + } + + inst.Extensions, err = boltutil.ReadExtensions(bucket) + if err != nil { + return api.Sandbox{}, err + } + + return inst, nil +} + +func (s *sandboxStore) validate(new *api.Sandbox) error { + if new.ID == "" { + return errors.Wrap(errdefs.ErrInvalidArgument, "instance ID must not be empty") + } + + if new.CreatedAt.IsZero() { + return errors.Wrap(errdefs.ErrInvalidArgument, "creation date must not be zero") + } + + if new.UpdatedAt.IsZero() { + return errors.Wrap(errdefs.ErrInvalidArgument, "updated date must not be zero") + } + + if new.Runtime.Name == "" { + return errors.Wrapf(errdefs.ErrInvalidArgument, "sandbox.Runtime.Name must be set") + } + + return nil +} diff --git a/metadata/sandbox_test.go b/metadata/sandbox_test.go new file mode 100644 index 000000000..0a6d82a59 --- /dev/null +++ b/metadata/sandbox_test.go @@ -0,0 +1,290 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package metadata + +import ( + "reflect" + "testing" + + "github.com/containerd/containerd/errdefs" + api "github.com/containerd/containerd/sandbox" + "github.com/gogo/protobuf/types" +) + +func TestSandboxCreate(t *testing.T) { + ctx, db, done := testDB(t) + defer done() + + store := NewSandboxStore(db) + + in := api.Sandbox{ + ID: "1", + Labels: map[string]string{"a": "1", "b": "2"}, + Spec: &types.Any{TypeUrl: "1", Value: []byte{1, 2, 3}}, + Extensions: map[string]types.Any{ + "ext1": {TypeUrl: "url/1", Value: []byte{1, 2, 3}}, + "ext2": {TypeUrl: "url/2", Value: []byte{3, 2, 1}}, + }, + Runtime: api.RuntimeOpts{ + Name: "test", + Options: &types.Any{TypeUrl: "url/3", Value: []byte{4, 5, 6}}, + }, + } + + _, err := store.Create(ctx, in) + if err != nil { + t.Fatal(err) + } + + out, err := store.Get(ctx, "1") + if err != nil { + t.Fatal(err) + } + + assertEqualInstances(t, in, out) +} + +func TestSandboxCreateDup(t *testing.T) { + ctx, db, done := testDB(t) + defer done() + + store := NewSandboxStore(db) + + in := api.Sandbox{ + ID: "1", + Spec: &types.Any{TypeUrl: "1", Value: []byte{1, 2, 3}}, + Runtime: api.RuntimeOpts{Name: "test"}, + } + + _, err := store.Create(ctx, in) + if err != nil { + t.Fatal(err) + } + + _, err = store.Create(ctx, in) + if !errdefs.IsAlreadyExists(err) { + t.Fatalf("expected %+v, got %+v", errdefs.ErrAlreadyExists, err) + } +} + +func TestSandboxUpdate(t *testing.T) { + ctx, db, done := testDB(t) + defer done() + + store := NewSandboxStore(db) + + if _, err := store.Create(ctx, api.Sandbox{ + ID: "2", + Labels: map[string]string{"lbl1": "existing"}, + Spec: &types.Any{TypeUrl: "1", Value: []byte{1}}, // will replace + Extensions: map[string]types.Any{ + "ext2": {TypeUrl: "url2", Value: []byte{4, 5, 6}}, // will append `ext1` + }, + Runtime: api.RuntimeOpts{Name: "test"}, // no change + }); err != nil { + t.Fatal(err) + } + + expectedSpec := types.Any{TypeUrl: "2", Value: []byte{3, 2, 1}} + + out, err := store.Update(ctx, api.Sandbox{ + ID: "2", + Labels: map[string]string{"lbl1": "new"}, + Spec: &expectedSpec, + Extensions: map[string]types.Any{ + "ext1": {TypeUrl: "url1", Value: []byte{1, 2}}, + }, + }, "labels.lbl1", "extensions.ext1", "spec") + if err != nil { + t.Fatal(err) + } + + expected := api.Sandbox{ + ID: "2", + Spec: &expectedSpec, + Labels: map[string]string{ + "lbl1": "new", + }, + Extensions: map[string]types.Any{ + "ext1": {TypeUrl: "url1", Value: []byte{1, 2}}, + "ext2": {TypeUrl: "url2", Value: []byte{4, 5, 6}}, + }, + Runtime: api.RuntimeOpts{Name: "test"}, + } + + assertEqualInstances(t, out, expected) +} + +func TestSandboxGetInvalid(t *testing.T) { + ctx, db, done := testDB(t) + defer done() + + store := NewSandboxStore(db) + + _, err := store.Get(ctx, "invalid_id") + if err == nil { + t.Fatalf("expected %+v error for invalid ID", errdefs.ErrNotFound) + } else if !errdefs.IsNotFound(err) { + t.Fatalf("unexpected error %T type", err) + } +} + +func TestSandboxList(t *testing.T) { + ctx, db, done := testDB(t) + defer done() + + store := NewSandboxStore(db) + + in := []api.Sandbox{ + { + ID: "1", + Labels: map[string]string{"test": "1"}, + Spec: &types.Any{TypeUrl: "1", Value: []byte{1, 2, 3}}, + Extensions: map[string]types.Any{"ext": {}}, + Runtime: api.RuntimeOpts{Name: "test"}, + }, + { + ID: "2", + Labels: map[string]string{"test": "2"}, + Spec: &types.Any{TypeUrl: "2", Value: []byte{3, 2, 1}}, + Extensions: map[string]types.Any{"ext": { + TypeUrl: "test", + Value: []byte{9}, + }}, + Runtime: api.RuntimeOpts{Name: "test"}, + }, + } + + for _, inst := range in { + _, err := store.Create(ctx, inst) + if err != nil { + t.Fatal(err) + } + } + + out, err := store.List(ctx) + if err != nil { + t.Fatal(err) + } + + if len(in) != len(out) { + t.Fatalf("expected list size: %d != %d", len(in), len(out)) + } + + for i := range out { + assertEqualInstances(t, out[i], in[i]) + } +} + +func TestSandboxListWithFilter(t *testing.T) { + ctx, db, done := testDB(t) + defer done() + + store := NewSandboxStore(db) + + in := []api.Sandbox{ + { + ID: "1", + Labels: map[string]string{"test": "1"}, + Spec: &types.Any{TypeUrl: "1", Value: []byte{1, 2, 3}}, + Extensions: map[string]types.Any{"ext": {}}, + Runtime: api.RuntimeOpts{Name: "test"}, + }, + { + ID: "2", + Labels: map[string]string{"test": "2"}, + Spec: &types.Any{TypeUrl: "2", Value: []byte{3, 2, 1}}, + Extensions: map[string]types.Any{"ext": { + TypeUrl: "test", + Value: []byte{9}, + }}, + Runtime: api.RuntimeOpts{Name: "test"}, + }, + } + + for _, inst := range in { + _, err := store.Create(ctx, inst) + if err != nil { + t.Fatal(err) + } + } + + out, err := store.List(ctx, "id==1") + if err != nil { + t.Fatal(err) + } + + if len(out) != 1 { + t.Fatalf("expected list to contain 1 element, got %d", len(out)) + } + + assertEqualInstances(t, out[0], in[0]) +} + +func TestSandboxDelete(t *testing.T) { + ctx, db, done := testDB(t) + defer done() + + store := NewSandboxStore(db) + + in := api.Sandbox{ + ID: "2", + Spec: &types.Any{TypeUrl: "1", Value: []byte{1, 2, 3}}, + Runtime: api.RuntimeOpts{Name: "test"}, + } + + _, err := store.Create(ctx, in) + if err != nil { + t.Fatal(err) + } + + err = store.Delete(ctx, "2") + if err != nil { + t.Fatalf("deleted failed %+v", err) + } + + _, err = store.Get(ctx, "2") + if !errdefs.IsNotFound(err) { + t.Fatalf("unexpected err result: %+v != %+v", err, errdefs.ErrNotFound) + } +} + +func assertEqualInstances(t *testing.T, x, y api.Sandbox) { + if x.ID != y.ID { + t.Fatalf("ids are not equal: %q != %q", x.ID, y.ID) + } + + if !reflect.DeepEqual(x.Labels, y.Labels) { + t.Fatalf("labels are not equal: %+v != %+v", x.Labels, y.Labels) + } + + if !reflect.DeepEqual(x.Spec, y.Spec) { + t.Fatalf("specs are not equal: %+v != %+v", x.Spec, y.Spec) + } + + if !reflect.DeepEqual(x.Extensions, y.Extensions) { + t.Fatalf("extensions are not equal: %+v != %+v", x.Extensions, y.Extensions) + } + + if x.Runtime.Name != y.Runtime.Name { + t.Fatalf("runtime names are not equal: %q != %q", x.Runtime.Name, y.Runtime.Name) + } + + if !reflect.DeepEqual(x.Runtime.Options, y.Runtime.Options) { + t.Fatalf("runtime options are not equal: %+v != %+v", x.Runtime.Options, y.Runtime.Options) + } +} From d7ece87243c2c2086676bdbb5b3331948f90cf93 Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Mon, 19 Apr 2021 15:11:20 -0700 Subject: [PATCH 04/22] [sandbox] Save sandbox ID to container's store Signed-off-by: Maksym Pavlenko --- containers/containers.go | 3 +++ metadata/containers.go | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/containers/containers.go b/containers/containers.go index 275f8069e..c343a64a9 100644 --- a/containers/containers.go +++ b/containers/containers.go @@ -76,6 +76,9 @@ type Container struct { // Extensions stores client-specified metadata Extensions map[string]typeurl.Any + + // SandboxID is an identifier of sandbox this container belongs to. + SandboxID string } // RuntimeInfo holds runtime specific information diff --git a/metadata/containers.go b/metadata/containers.go index b27dc0f87..d6517ce47 100644 --- a/metadata/containers.go +++ b/metadata/containers.go @@ -359,6 +359,8 @@ func readContainer(container *containers.Container, bkt *bolt.Bucket) error { } container.Extensions = extensions + case string(bucketKeySandboxID): + container.SandboxID = string(v) } return nil @@ -407,5 +409,9 @@ func writeContainer(bkt *bolt.Bucket, container *containers.Container) error { return err } + if err := bkt.Put(bucketKeySandboxID, []byte(container.SandboxID)); err != nil { + return err + } + return boltutil.WriteLabels(bkt, container.Labels) } From 13eb1a4bb0d34adc7a67f8f7d5e361e7abaa0ad7 Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Sun, 7 Nov 2021 16:16:08 -0800 Subject: [PATCH 05/22] [sandbox] Revendor API changes Signed-off-by: Maksym Pavlenko --- .../containerd/api/types/sandbox.pb.go | 1147 +++++++++++++++++ .../containerd/api/types/sandbox.proto | 51 + 2 files changed, 1198 insertions(+) create mode 100644 vendor/github.com/containerd/containerd/api/types/sandbox.pb.go create mode 100644 vendor/github.com/containerd/containerd/api/types/sandbox.proto diff --git a/vendor/github.com/containerd/containerd/api/types/sandbox.pb.go b/vendor/github.com/containerd/containerd/api/types/sandbox.pb.go new file mode 100644 index 000000000..d44a3587d --- /dev/null +++ b/vendor/github.com/containerd/containerd/api/types/sandbox.pb.go @@ -0,0 +1,1147 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: github.com/containerd/containerd/api/types/sandbox.proto + +package types + +import ( + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + types "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. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Sandbox represents a sandbox metadata object that keeps all info required by controller to +// work with a particular instance. containerd keeps this in metadata store and sends it to a controller with +// each request, so they can reflect sandbox state changes (by updating the corresponding fields). +type Sandbox struct { + // SandboxID is a unique instance identifier within namespace + SandboxID string `protobuf:"bytes,1,opt,name=sandbox_id,json=sandboxId,proto3" json:"sandbox_id,omitempty"` + // Runtime specifies which runtime to use for executing this container. + Runtime Sandbox_Runtime `protobuf:"bytes,2,opt,name=runtime,proto3" json:"runtime"` + // Spec is sandbox configuration (kin of OCI runtime spec, but for VM) + Spec *types.Any `protobuf:"bytes,3,opt,name=spec,proto3" json:"spec,omitempty"` + // Labels provides an area to include arbitrary data on containers. + Labels map[string]string `protobuf:"bytes,4,rep,name=labels,proto3" json:"labels" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // CreatedAt is the time the container was first created. + CreatedAt time.Time `protobuf:"bytes,5,opt,name=created_at,json=createdAt,proto3,stdtime" json:"created_at"` + // UpdatedAt is the last time the container was mutated. + UpdatedAt time.Time `protobuf:"bytes,6,opt,name=updated_at,json=updatedAt,proto3,stdtime" json:"updated_at"` + // Extensions allow clients to provide optional blobs that can be handled by runtime. + Extensions map[string]types.Any `protobuf:"bytes,7,rep,name=extensions,proto3" json:"extensions" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Sandbox) Reset() { *m = Sandbox{} } +func (*Sandbox) ProtoMessage() {} +func (*Sandbox) Descriptor() ([]byte, []int) { + return fileDescriptor_f2257af6cf851f1c, []int{0} +} +func (m *Sandbox) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Sandbox) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Sandbox.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 *Sandbox) XXX_Merge(src proto.Message) { + xxx_messageInfo_Sandbox.Merge(m, src) +} +func (m *Sandbox) XXX_Size() int { + return m.Size() +} +func (m *Sandbox) XXX_DiscardUnknown() { + xxx_messageInfo_Sandbox.DiscardUnknown(m) +} + +var xxx_messageInfo_Sandbox proto.InternalMessageInfo + +type Sandbox_Runtime struct { + // Name is the name of the runtime. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Options specify additional runtime initialization options. + Options *types.Any `protobuf:"bytes,2,opt,name=options,proto3" json:"options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Sandbox_Runtime) Reset() { *m = Sandbox_Runtime{} } +func (*Sandbox_Runtime) ProtoMessage() {} +func (*Sandbox_Runtime) Descriptor() ([]byte, []int) { + return fileDescriptor_f2257af6cf851f1c, []int{0, 0} +} +func (m *Sandbox_Runtime) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Sandbox_Runtime) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Sandbox_Runtime.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 *Sandbox_Runtime) XXX_Merge(src proto.Message) { + xxx_messageInfo_Sandbox_Runtime.Merge(m, src) +} +func (m *Sandbox_Runtime) XXX_Size() int { + return m.Size() +} +func (m *Sandbox_Runtime) XXX_DiscardUnknown() { + xxx_messageInfo_Sandbox_Runtime.DiscardUnknown(m) +} + +var xxx_messageInfo_Sandbox_Runtime proto.InternalMessageInfo + +func init() { + proto.RegisterType((*Sandbox)(nil), "containerd.types.Sandbox") + proto.RegisterMapType((map[string]types.Any)(nil), "containerd.types.Sandbox.ExtensionsEntry") + proto.RegisterMapType((map[string]string)(nil), "containerd.types.Sandbox.LabelsEntry") + proto.RegisterType((*Sandbox_Runtime)(nil), "containerd.types.Sandbox.Runtime") +} + +func init() { + proto.RegisterFile("github.com/containerd/containerd/api/types/sandbox.proto", fileDescriptor_f2257af6cf851f1c) +} + +var fileDescriptor_f2257af6cf851f1c = []byte{ + // 454 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0x4f, 0x8b, 0xd3, 0x40, + 0x14, 0xef, 0xf4, 0x5f, 0xcc, 0x2b, 0xe2, 0x32, 0xf4, 0x10, 0x73, 0x48, 0xab, 0x20, 0x54, 0x91, + 0x89, 0xac, 0x97, 0x55, 0x4f, 0xed, 0xba, 0x87, 0x15, 0x45, 0xc8, 0x7a, 0x10, 0x2f, 0xcb, 0xa4, + 0x19, 0x63, 0xb0, 0x9d, 0x09, 0xc9, 0x44, 0x36, 0x37, 0x3f, 0x82, 0xdf, 0xc1, 0x2f, 0xd3, 0xa3, + 0x47, 0x4f, 0xab, 0x9b, 0x4f, 0x22, 0x99, 0x99, 0xd8, 0x50, 0xad, 0xb8, 0x97, 0xf0, 0x86, 0xf7, + 0xfb, 0xf7, 0xde, 0x23, 0x70, 0x14, 0x27, 0xf2, 0x43, 0x11, 0x92, 0xa5, 0x58, 0xfb, 0x4b, 0xc1, + 0x25, 0x4d, 0x38, 0xcb, 0xa2, 0x76, 0x49, 0xd3, 0xc4, 0x97, 0x65, 0xca, 0x72, 0x3f, 0xa7, 0x3c, + 0x0a, 0xc5, 0x05, 0x49, 0x33, 0x21, 0x05, 0x3e, 0xd8, 0x62, 0x88, 0xea, 0xbb, 0xe3, 0x58, 0xc4, + 0x42, 0x35, 0xfd, 0xba, 0xd2, 0x38, 0xf7, 0x76, 0x2c, 0x44, 0xbc, 0x62, 0xbe, 0x7a, 0x85, 0xc5, + 0x7b, 0x9f, 0xf2, 0xd2, 0xb4, 0x26, 0xbb, 0x2d, 0x99, 0xac, 0x59, 0x2e, 0xe9, 0x3a, 0xd5, 0x80, + 0xbb, 0x5f, 0x07, 0x60, 0x9d, 0x69, 0x57, 0xfc, 0x10, 0xc0, 0x04, 0x38, 0x4f, 0x22, 0x07, 0x4d, + 0xd1, 0xcc, 0x5e, 0xdc, 0x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b9, 0x4f, 0x60, 0xd4, 0x5a, 0x23, 0x3e, 0x80, + 0xde, 0x47, 0x56, 0x1a, 0xc5, 0xba, 0xc4, 0x63, 0x18, 0x7c, 0xa2, 0xab, 0x42, 0x9f, 0xde, 0x0e, + 0xf4, 0xe3, 0x69, 0xf7, 0x08, 0xb9, 0x67, 0x70, 0x6b, 0x27, 0xee, 0x5f, 0xe8, 0x0f, 0xda, 0xf4, + 0x7d, 0x69, 0xb6, 0xa2, 0x8b, 0x17, 0x9b, 0x2b, 0xaf, 0xf3, 0xfd, 0xca, 0xeb, 0x7c, 0xae, 0x3c, + 0xb4, 0xa9, 0x3c, 0xf4, 0xad, 0xf2, 0xd0, 0xcf, 0xca, 0x43, 0xef, 0x1e, 0xfd, 0xff, 0xdf, 0xf5, + 0x4c, 0x7d, 0xdf, 0x76, 0xc2, 0xa1, 0xb2, 0x79, 0xfc, 0x2b, 0x00, 0x00, 0xff, 0xff, 0x90, 0x58, + 0x3c, 0xe1, 0x9a, 0x03, 0x00, 0x00, +} + +func (m *Sandbox) 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 *Sandbox) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Sandbox) 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.Extensions) > 0 { + for k := range m.Extensions { + v := m.Extensions[k] + baseI := i + { + size, err := (&v).MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSandbox(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarintSandbox(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarintSandbox(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x3a + } + } + n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.UpdatedAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.UpdatedAt):]) + if err2 != nil { + return 0, err2 + } + i -= n2 + i = encodeVarintSandbox(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0x32 + n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CreatedAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CreatedAt):]) + if err3 != nil { + return 0, err3 + } + i -= n3 + i = encodeVarintSandbox(dAtA, i, uint64(n3)) + i-- + dAtA[i] = 0x2a + if len(m.Labels) > 0 { + for k := range m.Labels { + v := m.Labels[k] + baseI := i + i -= len(v) + copy(dAtA[i:], v) + i = encodeVarintSandbox(dAtA, i, uint64(len(v))) + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarintSandbox(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarintSandbox(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x22 + } + } + if m.Spec != nil { + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSandbox(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + { + size, err := m.Runtime.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) + copy(dAtA[i:], m.SandboxID) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.SandboxID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Sandbox_Runtime) 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 *Sandbox_Runtime) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Sandbox_Runtime) 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 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] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintSandbox(dAtA []byte, offset int, v uint64) int { + offset -= sovSandbox(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Sandbox) 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)) + } + l = m.Runtime.Size() + n += 1 + l + sovSandbox(uint64(l)) + if m.Spec != nil { + l = m.Spec.Size() + n += 1 + l + sovSandbox(uint64(l)) + } + if len(m.Labels) > 0 { + for k, v := range m.Labels { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovSandbox(uint64(len(k))) + 1 + len(v) + sovSandbox(uint64(len(v))) + n += mapEntrySize + 1 + sovSandbox(uint64(mapEntrySize)) + } + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CreatedAt) + n += 1 + l + sovSandbox(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.UpdatedAt) + n += 1 + l + sovSandbox(uint64(l)) + if len(m.Extensions) > 0 { + for k, v := range m.Extensions { + _ = k + _ = v + l = v.Size() + mapEntrySize := 1 + len(k) + sovSandbox(uint64(len(k))) + 1 + l + sovSandbox(uint64(l)) + n += mapEntrySize + 1 + sovSandbox(uint64(mapEntrySize)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Sandbox_Runtime) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + 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) + } + return n +} + +func sovSandbox(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozSandbox(x uint64) (n int) { + return sovSandbox(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *Sandbox) String() string { + if this == nil { + return "nil" + } + keysForLabels := make([]string, 0, len(this.Labels)) + for k, _ := range this.Labels { + keysForLabels = append(keysForLabels, k) + } + github_com_gogo_protobuf_sortkeys.Strings(keysForLabels) + mapStringForLabels := "map[string]string{" + for _, k := range keysForLabels { + mapStringForLabels += fmt.Sprintf("%v: %v,", k, this.Labels[k]) + } + mapStringForLabels += "}" + keysForExtensions := make([]string, 0, len(this.Extensions)) + for k, _ := range this.Extensions { + keysForExtensions = append(keysForExtensions, k) + } + github_com_gogo_protobuf_sortkeys.Strings(keysForExtensions) + mapStringForExtensions := "map[string]types.Any{" + for _, k := range keysForExtensions { + mapStringForExtensions += fmt.Sprintf("%v: %v,", k, this.Extensions[k]) + } + mapStringForExtensions += "}" + s := strings.Join([]string{`&Sandbox{`, + `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, + `Runtime:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Runtime), "Sandbox_Runtime", "Sandbox_Runtime", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(fmt.Sprintf("%v", this.Spec), "Any", "types.Any", 1) + `,`, + `Labels:` + mapStringForLabels + `,`, + `CreatedAt:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.CreatedAt), "Timestamp", "types.Timestamp", 1), `&`, ``, 1) + `,`, + `UpdatedAt:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.UpdatedAt), "Timestamp", "types.Timestamp", 1), `&`, ``, 1) + `,`, + `Extensions:` + mapStringForExtensions + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *Sandbox_Runtime) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Sandbox_Runtime{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `Options:` + strings.Replace(fmt.Sprintf("%v", this.Options), "Any", "types.Any", 1) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func valueToStringSandbox(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *Sandbox) 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: Sandbox: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Sandbox: 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 != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Runtime", 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 := m.Runtime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", 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.Spec == nil { + m.Spec = &types.Any{} + } + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Labels", 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.Labels == nil { + m.Labels = make(map[string]string) + } + var mapkey string + var mapvalue string + for iNdEx < postIndex { + entryPreIndex := 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) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthSandbox + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthSandbox + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLengthSandbox + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue < 0 { + return ErrInvalidLengthSandbox + } + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + } else { + iNdEx = entryPreIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Labels[mapkey] = mapvalue + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", 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.CreatedAt, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UpdatedAt", 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.UpdatedAt, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Extensions", 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.Extensions == nil { + m.Extensions = make(map[string]types.Any) + } + var mapkey string + mapvalue := &types.Any{} + for iNdEx < postIndex { + entryPreIndex := 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) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthSandbox + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthSandbox + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return ErrInvalidLengthSandbox + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return ErrInvalidLengthSandbox + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &types.Any{} + if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Extensions[mapkey] = *mapvalue + 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 *Sandbox_Runtime) 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: Runtime: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Runtime: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", 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.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + 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 = &types.Any{} + } + if err := m.Options.Unmarshal(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 skipSandbox(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSandbox + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSandbox + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSandbox + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthSandbox + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupSandbox + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthSandbox + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthSandbox = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowSandbox = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupSandbox = fmt.Errorf("proto: unexpected end of group") +) diff --git a/vendor/github.com/containerd/containerd/api/types/sandbox.proto b/vendor/github.com/containerd/containerd/api/types/sandbox.proto new file mode 100644 index 000000000..b40e84bf4 --- /dev/null +++ b/vendor/github.com/containerd/containerd/api/types/sandbox.proto @@ -0,0 +1,51 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +syntax = "proto3"; + +package containerd.types; + +import weak "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "github.com/containerd/containerd/api/types;types"; + +// Sandbox represents a sandbox metadata object that keeps all info required by controller to +// work with a particular instance. containerd keeps this in metadata store and sends it to a controller with +// each request, so they can reflect sandbox state changes (by updating the corresponding fields). +message Sandbox { + // SandboxID is a unique instance identifier within namespace + string sandbox_id = 1; + message Runtime { + // Name is the name of the runtime. + string name = 1; + // Options specify additional runtime initialization options. + google.protobuf.Any options = 2; + } + // Runtime specifies which runtime to use for executing this container. + Runtime runtime = 2 [(gogoproto.nullable) = false]; + // Spec is sandbox configuration (kin of OCI runtime spec, but for VM) + google.protobuf.Any spec = 3; + // Labels provides an area to include arbitrary data on containers. + map labels = 4 [(gogoproto.nullable) = false]; + // CreatedAt is the time the container was first created. + google.protobuf.Timestamp created_at = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + // UpdatedAt is the last time the container was mutated. + google.protobuf.Timestamp updated_at = 6 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + // Extensions allow clients to provide optional blobs that can be handled by runtime. + map extensions = 7 [(gogoproto.nullable) = false]; +} From 0e77f758a400522b47bb76ad75d4f28606d8be03 Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Mon, 19 Apr 2021 15:17:19 -0700 Subject: [PATCH 06/22] [sandbox] Implement store service Signed-off-by: Maksym Pavlenko --- services/sandbox/store_local.go | 111 ++++++++++++++++++++++++++++++ services/sandbox/store_service.go | 90 ++++++++++++++++++++++++ 2 files changed, 201 insertions(+) create mode 100644 services/sandbox/store_local.go create mode 100644 services/sandbox/store_service.go diff --git a/services/sandbox/store_local.go b/services/sandbox/store_local.go new file mode 100644 index 000000000..508924008 --- /dev/null +++ b/services/sandbox/store_local.go @@ -0,0 +1,111 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package sandbox + +import ( + "context" + + "github.com/containerd/containerd/services" + "google.golang.org/grpc" + + api "github.com/containerd/containerd/api/services/sandbox/v1" + "github.com/containerd/containerd/api/types" + "github.com/containerd/containerd/errdefs" + "github.com/containerd/containerd/events" + "github.com/containerd/containerd/metadata" + "github.com/containerd/containerd/plugin" + "github.com/containerd/containerd/sandbox" +) + +func init() { + plugin.Register(&plugin.Registration{ + Type: plugin.ServicePlugin, + ID: services.SandboxStoreService, + Requires: []plugin.Type{ + plugin.MetadataPlugin, + }, + InitFn: func(ic *plugin.InitContext) (interface{}, error) { + m, err := ic.Get(plugin.MetadataPlugin) + if err != nil { + return nil, err + } + + db := m.(*metadata.DB) + return &sandboxLocal{ + store: metadata.NewSandboxStore(db), + publisher: ic.Events, + }, nil + }, + }) +} + +type sandboxLocal struct { + store sandbox.Store + publisher events.Publisher +} + +var _ = (api.StoreClient)(&sandboxLocal{}) + +func (s *sandboxLocal) Create(ctx context.Context, in *api.StoreCreateRequest, _ ...grpc.CallOption) (*api.StoreCreateResponse, error) { + sb, err := s.store.Create(ctx, sandbox.FromProto(&in.Sandbox)) + if err != nil { + return nil, errdefs.ToGRPC(err) + } + + return &api.StoreCreateResponse{Sandbox: sandbox.ToProto(&sb)}, nil +} + +func (s *sandboxLocal) Update(ctx context.Context, in *api.StoreUpdateRequest, _ ...grpc.CallOption) (*api.StoreUpdateResponse, error) { + sb, err := s.store.Update(ctx, sandbox.FromProto(&in.Sandbox), in.Fields...) + if err != nil { + return nil, errdefs.ToGRPC(err) + } + + return &api.StoreUpdateResponse{Sandbox: sandbox.ToProto(&sb)}, nil +} + +func (s *sandboxLocal) Get(ctx context.Context, in *api.StoreGetRequest, _ ...grpc.CallOption) (*api.StoreGetResponse, error) { + resp, err := s.store.Get(ctx, in.SandboxID) + if err != nil { + return nil, errdefs.ToGRPC(err) + } + + desc := sandbox.ToProto(&resp) + return &api.StoreGetResponse{Sandbox: &desc}, nil +} + +func (s *sandboxLocal) List(ctx context.Context, in *api.StoreListRequest, _ ...grpc.CallOption) (*api.StoreListResponse, error) { + resp, err := s.store.List(ctx, in.Filters...) + if err != nil { + return nil, errdefs.ToGRPC(err) + } + + list := make([]types.Sandbox, len(resp)) + for i, item := range resp { + list[i] = sandbox.ToProto(&item) + } + + return &api.StoreListResponse{List: list}, nil +} + +func (s *sandboxLocal) Delete(ctx context.Context, in *api.StoreDeleteRequest, _ ...grpc.CallOption) (*api.StoreDeleteResponse, error) { + if err := s.store.Delete(ctx, in.SandboxID); err != nil { + return nil, errdefs.ToGRPC(err) + } + + return &api.StoreDeleteResponse{}, nil +} diff --git a/services/sandbox/store_service.go b/services/sandbox/store_service.go new file mode 100644 index 000000000..45bb65519 --- /dev/null +++ b/services/sandbox/store_service.go @@ -0,0 +1,90 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package sandbox + +import ( + "context" + "errors" + + "google.golang.org/grpc" + + api "github.com/containerd/containerd/api/services/sandbox/v1" + "github.com/containerd/containerd/log" + "github.com/containerd/containerd/plugin" + "github.com/containerd/containerd/services" +) + +func init() { + plugin.Register(&plugin.Registration{ + Type: plugin.GRPCPlugin, + ID: "sandboxes", + Requires: []plugin.Type{ + plugin.ServicePlugin, + }, + InitFn: func(ic *plugin.InitContext) (interface{}, error) { + plugins, err := ic.GetByType(plugin.ServicePlugin) + if err != nil { + return nil, err + } + p, ok := plugins[services.SandboxStoreService] + if !ok { + return nil, errors.New("sandbox store service not found") + } + i, err := p.Instance() + if err != nil { + return nil, err + } + return &sandboxService{local: i.(api.StoreClient)}, nil + }, + }) +} + +type sandboxService struct { + local api.StoreClient +} + +var _ api.StoreServer = (*sandboxService)(nil) + +func (s *sandboxService) Register(server *grpc.Server) error { + api.RegisterStoreServer(server, s) + return nil +} + +func (s *sandboxService) Create(ctx context.Context, req *api.StoreCreateRequest) (*api.StoreCreateResponse, error) { + log.G(ctx).WithField("req", req).Debug("create sandbox") + return s.local.Create(ctx, req) +} + +func (s *sandboxService) Update(ctx context.Context, req *api.StoreUpdateRequest) (*api.StoreUpdateResponse, error) { + log.G(ctx).WithField("req", req).Debug("update sandbox") + return s.local.Update(ctx, req) +} + +func (s *sandboxService) List(ctx context.Context, req *api.StoreListRequest) (*api.StoreListResponse, error) { + log.G(ctx).WithField("req", req).Debug("list sandboxes") + return s.local.List(ctx, req) +} + +func (s *sandboxService) Get(ctx context.Context, req *api.StoreGetRequest) (*api.StoreGetResponse, error) { + log.G(ctx).WithField("req", req).Debug("get sandbox") + return s.local.Get(ctx, req) +} + +func (s *sandboxService) Delete(ctx context.Context, req *api.StoreDeleteRequest) (*api.StoreDeleteResponse, error) { + log.G(ctx).WithField("req", req).Debug("delete sandbox") + return s.local.Delete(ctx, req) +} From a433beb79f05c162cfbc250813814808e9f648e1 Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Sun, 7 Nov 2021 16:24:43 -0800 Subject: [PATCH 07/22] [sandbox] Update vendor Signed-off-by: Maksym Pavlenko --- go.mod | 1 + services/services.go | 4 + .../containerd/api/types/sandbox.pb.go | 1147 ----------------- .../containerd/api/types/sandbox.proto | 51 - 4 files changed, 5 insertions(+), 1198 deletions(-) delete mode 100644 vendor/github.com/containerd/containerd/api/types/sandbox.pb.go delete mode 100644 vendor/github.com/containerd/containerd/api/types/sandbox.proto diff --git a/go.mod b/go.mod index 05838cc80..79ca6e15f 100644 --- a/go.mod +++ b/go.mod @@ -49,6 +49,7 @@ require ( github.com/opencontainers/selinux v1.10.0 github.com/pelletier/go-toml v1.9.3 github.com/prometheus/client_golang v1.11.1 + github.com/pkg/errors v0.9.1 github.com/sirupsen/logrus v1.8.1 github.com/stretchr/testify v1.7.0 github.com/tchap/go-patricia/v2 v2.3.1 diff --git a/services/services.go b/services/services.go index 27f47a5ce..9caf702c6 100644 --- a/services/services.go +++ b/services/services.go @@ -35,4 +35,8 @@ const ( DiffService = "diff-service" // IntrospectionService is the id of introspection service IntrospectionService = "introspection-service" + // SandboxStoreService is the id of Sandbox's store service + SandboxStoreService = "sandbox-store-service" + // SandboxControllerService is the id of Sandbox's controller service + SandboxControllerService = "sandbox-controller-service" ) diff --git a/vendor/github.com/containerd/containerd/api/types/sandbox.pb.go b/vendor/github.com/containerd/containerd/api/types/sandbox.pb.go deleted file mode 100644 index d44a3587d..000000000 --- a/vendor/github.com/containerd/containerd/api/types/sandbox.pb.go +++ /dev/null @@ -1,1147 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: github.com/containerd/containerd/api/types/sandbox.proto - -package types - -import ( - fmt "fmt" - proto "github.com/gogo/protobuf/proto" - github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - types "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. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// Sandbox represents a sandbox metadata object that keeps all info required by controller to -// work with a particular instance. containerd keeps this in metadata store and sends it to a controller with -// each request, so they can reflect sandbox state changes (by updating the corresponding fields). -type Sandbox struct { - // SandboxID is a unique instance identifier within namespace - SandboxID string `protobuf:"bytes,1,opt,name=sandbox_id,json=sandboxId,proto3" json:"sandbox_id,omitempty"` - // Runtime specifies which runtime to use for executing this container. - Runtime Sandbox_Runtime `protobuf:"bytes,2,opt,name=runtime,proto3" json:"runtime"` - // Spec is sandbox configuration (kin of OCI runtime spec, but for VM) - Spec *types.Any `protobuf:"bytes,3,opt,name=spec,proto3" json:"spec,omitempty"` - // Labels provides an area to include arbitrary data on containers. - Labels map[string]string `protobuf:"bytes,4,rep,name=labels,proto3" json:"labels" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - // CreatedAt is the time the container was first created. - CreatedAt time.Time `protobuf:"bytes,5,opt,name=created_at,json=createdAt,proto3,stdtime" json:"created_at"` - // UpdatedAt is the last time the container was mutated. - UpdatedAt time.Time `protobuf:"bytes,6,opt,name=updated_at,json=updatedAt,proto3,stdtime" json:"updated_at"` - // Extensions allow clients to provide optional blobs that can be handled by runtime. - Extensions map[string]types.Any `protobuf:"bytes,7,rep,name=extensions,proto3" json:"extensions" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Sandbox) Reset() { *m = Sandbox{} } -func (*Sandbox) ProtoMessage() {} -func (*Sandbox) Descriptor() ([]byte, []int) { - return fileDescriptor_f2257af6cf851f1c, []int{0} -} -func (m *Sandbox) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Sandbox) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Sandbox.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 *Sandbox) XXX_Merge(src proto.Message) { - xxx_messageInfo_Sandbox.Merge(m, src) -} -func (m *Sandbox) XXX_Size() int { - return m.Size() -} -func (m *Sandbox) XXX_DiscardUnknown() { - xxx_messageInfo_Sandbox.DiscardUnknown(m) -} - -var xxx_messageInfo_Sandbox proto.InternalMessageInfo - -type Sandbox_Runtime struct { - // Name is the name of the runtime. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Options specify additional runtime initialization options. - Options *types.Any `protobuf:"bytes,2,opt,name=options,proto3" json:"options,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Sandbox_Runtime) Reset() { *m = Sandbox_Runtime{} } -func (*Sandbox_Runtime) ProtoMessage() {} -func (*Sandbox_Runtime) Descriptor() ([]byte, []int) { - return fileDescriptor_f2257af6cf851f1c, []int{0, 0} -} -func (m *Sandbox_Runtime) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Sandbox_Runtime) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Sandbox_Runtime.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 *Sandbox_Runtime) XXX_Merge(src proto.Message) { - xxx_messageInfo_Sandbox_Runtime.Merge(m, src) -} -func (m *Sandbox_Runtime) XXX_Size() int { - return m.Size() -} -func (m *Sandbox_Runtime) XXX_DiscardUnknown() { - xxx_messageInfo_Sandbox_Runtime.DiscardUnknown(m) -} - -var xxx_messageInfo_Sandbox_Runtime proto.InternalMessageInfo - -func init() { - proto.RegisterType((*Sandbox)(nil), "containerd.types.Sandbox") - proto.RegisterMapType((map[string]types.Any)(nil), "containerd.types.Sandbox.ExtensionsEntry") - proto.RegisterMapType((map[string]string)(nil), "containerd.types.Sandbox.LabelsEntry") - proto.RegisterType((*Sandbox_Runtime)(nil), "containerd.types.Sandbox.Runtime") -} - -func init() { - proto.RegisterFile("github.com/containerd/containerd/api/types/sandbox.proto", fileDescriptor_f2257af6cf851f1c) -} - -var fileDescriptor_f2257af6cf851f1c = []byte{ - // 454 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0x4f, 0x8b, 0xd3, 0x40, - 0x14, 0xef, 0xf4, 0x5f, 0xcc, 0x2b, 0xe2, 0x32, 0xf4, 0x10, 0x73, 0x48, 0xab, 0x20, 0x54, 0x91, - 0x89, 0xac, 0x97, 0x55, 0x4f, 0xed, 0xba, 0x87, 0x15, 0x45, 0xc8, 0x7a, 0x10, 0x2f, 0xcb, 0xa4, - 0x19, 0x63, 0xb0, 0x9d, 0x09, 0xc9, 0x44, 0x36, 0x37, 0x3f, 0x82, 0xdf, 0xc1, 0x2f, 0xd3, 0xa3, - 0x47, 0x4f, 0xab, 0x9b, 0x4f, 0x22, 0x99, 0x99, 0xd8, 0x50, 0xad, 0xb8, 0x97, 0xf0, 0x86, 0xf7, - 0xfb, 0xf7, 0xde, 0x23, 0x70, 0x14, 0x27, 0xf2, 0x43, 0x11, 0x92, 0xa5, 0x58, 0xfb, 0x4b, 0xc1, - 0x25, 0x4d, 0x38, 0xcb, 0xa2, 0x76, 0x49, 0xd3, 0xc4, 0x97, 0x65, 0xca, 0x72, 0x3f, 0xa7, 0x3c, - 0x0a, 0xc5, 0x05, 0x49, 0x33, 0x21, 0x05, 0x3e, 0xd8, 0x62, 0x88, 0xea, 0xbb, 0xe3, 0x58, 0xc4, - 0x42, 0x35, 0xfd, 0xba, 0xd2,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0x60, 0x17, 0x92, 0xf1, 0x3c, 0x11, 0x3c, - 0x77, 0x2c, 0x35, 0xd2, 0xfd, 0xfd, 0x23, 0x9d, 0xfc, 0xc6, 0xb6, 0xc7, 0x6a, 0x49, 0xb8, 0xaf, - 0xc0, 0x32, 0x3b, 0xc6, 0x18, 0xfa, 0x9c, 0xae, 0x99, 0xbe, 0x5f, 0xa0, 0x6a, 0x4c, 0xc0, 0x12, - 0xa9, 0x54, 0x66, 0xdd, 0x7f, 0xec, 0xba, 0x01, 0xb9, 0x4f, 0x60, 0xd4, 0x5a, 0x23, 0x3e, 0x80, - 0xde, 0x47, 0x56, 0x1a, 0xc5, 0xba, 0xc4, 0x63, 0x18, 0x7c, 0xa2, 0xab, 0x42, 0x9f, 0xde, 0x0e, - 0xf4, 0xe3, 0x69, 0xf7, 0x08, 0xb9, 0x67, 0x70, 0x6b, 0x27, 0xee, 0x5f, 0xe8, 0x0f, 0xda, 0xf4, - 0x7d, 0x69, 0xb6, 0xa2, 0x8b, 0x17, 0x9b, 0x2b, 0xaf, 0xf3, 0xfd, 0xca, 0xeb, 0x7c, 0xae, 0x3c, - 0xb4, 0xa9, 0x3c, 0xf4, 0xad, 0xf2, 0xd0, 0xcf, 0xca, 0x43, 0xef, 0x1e, 0xfd, 0xff, 0xdf, 0xf5, - 0x4c, 0x7d, 0xdf, 0x76, 0xc2, 0xa1, 0xb2, 0x79, 0xfc, 0x2b, 0x00, 0x00, 0xff, 0xff, 0x90, 0x58, - 0x3c, 0xe1, 0x9a, 0x03, 0x00, 0x00, -} - -func (m *Sandbox) 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 *Sandbox) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Sandbox) 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.Extensions) > 0 { - for k := range m.Extensions { - v := m.Extensions[k] - baseI := i - { - size, err := (&v).MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintSandbox(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - i -= len(k) - copy(dAtA[i:], k) - i = encodeVarintSandbox(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = encodeVarintSandbox(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x3a - } - } - n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.UpdatedAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.UpdatedAt):]) - if err2 != nil { - return 0, err2 - } - i -= n2 - i = encodeVarintSandbox(dAtA, i, uint64(n2)) - i-- - dAtA[i] = 0x32 - n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CreatedAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CreatedAt):]) - if err3 != nil { - return 0, err3 - } - i -= n3 - i = encodeVarintSandbox(dAtA, i, uint64(n3)) - i-- - dAtA[i] = 0x2a - if len(m.Labels) > 0 { - for k := range m.Labels { - v := m.Labels[k] - baseI := i - i -= len(v) - copy(dAtA[i:], v) - i = encodeVarintSandbox(dAtA, i, uint64(len(v))) - i-- - dAtA[i] = 0x12 - i -= len(k) - copy(dAtA[i:], k) - i = encodeVarintSandbox(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = encodeVarintSandbox(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x22 - } - } - if m.Spec != nil { - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintSandbox(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - { - size, err := m.Runtime.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) - copy(dAtA[i:], m.SandboxID) - i = encodeVarintSandbox(dAtA, i, uint64(len(m.SandboxID))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Sandbox_Runtime) 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 *Sandbox_Runtime) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Sandbox_Runtime) 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 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] = 0x12 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintSandbox(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintSandbox(dAtA []byte, offset int, v uint64) int { - offset -= sovSandbox(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Sandbox) 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)) - } - l = m.Runtime.Size() - n += 1 + l + sovSandbox(uint64(l)) - if m.Spec != nil { - l = m.Spec.Size() - n += 1 + l + sovSandbox(uint64(l)) - } - if len(m.Labels) > 0 { - for k, v := range m.Labels { - _ = k - _ = v - mapEntrySize := 1 + len(k) + sovSandbox(uint64(len(k))) + 1 + len(v) + sovSandbox(uint64(len(v))) - n += mapEntrySize + 1 + sovSandbox(uint64(mapEntrySize)) - } - } - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CreatedAt) - n += 1 + l + sovSandbox(uint64(l)) - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.UpdatedAt) - n += 1 + l + sovSandbox(uint64(l)) - if len(m.Extensions) > 0 { - for k, v := range m.Extensions { - _ = k - _ = v - l = v.Size() - mapEntrySize := 1 + len(k) + sovSandbox(uint64(len(k))) + 1 + l + sovSandbox(uint64(l)) - n += mapEntrySize + 1 + sovSandbox(uint64(mapEntrySize)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Sandbox_Runtime) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - 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) - } - return n -} - -func sovSandbox(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozSandbox(x uint64) (n int) { - return sovSandbox(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *Sandbox) String() string { - if this == nil { - return "nil" - } - keysForLabels := make([]string, 0, len(this.Labels)) - for k, _ := range this.Labels { - keysForLabels = append(keysForLabels, k) - } - github_com_gogo_protobuf_sortkeys.Strings(keysForLabels) - mapStringForLabels := "map[string]string{" - for _, k := range keysForLabels { - mapStringForLabels += fmt.Sprintf("%v: %v,", k, this.Labels[k]) - } - mapStringForLabels += "}" - keysForExtensions := make([]string, 0, len(this.Extensions)) - for k, _ := range this.Extensions { - keysForExtensions = append(keysForExtensions, k) - } - github_com_gogo_protobuf_sortkeys.Strings(keysForExtensions) - mapStringForExtensions := "map[string]types.Any{" - for _, k := range keysForExtensions { - mapStringForExtensions += fmt.Sprintf("%v: %v,", k, this.Extensions[k]) - } - mapStringForExtensions += "}" - s := strings.Join([]string{`&Sandbox{`, - `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, - `Runtime:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Runtime), "Sandbox_Runtime", "Sandbox_Runtime", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(fmt.Sprintf("%v", this.Spec), "Any", "types.Any", 1) + `,`, - `Labels:` + mapStringForLabels + `,`, - `CreatedAt:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.CreatedAt), "Timestamp", "types.Timestamp", 1), `&`, ``, 1) + `,`, - `UpdatedAt:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.UpdatedAt), "Timestamp", "types.Timestamp", 1), `&`, ``, 1) + `,`, - `Extensions:` + mapStringForExtensions + `,`, - `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, - `}`, - }, "") - return s -} -func (this *Sandbox_Runtime) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Sandbox_Runtime{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `Options:` + strings.Replace(fmt.Sprintf("%v", this.Options), "Any", "types.Any", 1) + `,`, - `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, - `}`, - }, "") - return s -} -func valueToStringSandbox(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *Sandbox) 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: Sandbox: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Sandbox: 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 != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Runtime", 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 := m.Runtime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", 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.Spec == nil { - m.Spec = &types.Any{} - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Labels", 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.Labels == nil { - m.Labels = make(map[string]string) - } - var mapkey string - var mapvalue string - for iNdEx < postIndex { - entryPreIndex := 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) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSandbox - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthSandbox - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLengthSandbox - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var stringLenmapvalue uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSandbox - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapvalue |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapvalue := int(stringLenmapvalue) - if intStringLenmapvalue < 0 { - return ErrInvalidLengthSandbox - } - postStringIndexmapvalue := iNdEx + intStringLenmapvalue - if postStringIndexmapvalue < 0 { - return ErrInvalidLengthSandbox - } - if postStringIndexmapvalue > l { - return io.ErrUnexpectedEOF - } - mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) - iNdEx = postStringIndexmapvalue - } else { - iNdEx = entryPreIndex - skippy, err := skipSandbox(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSandbox - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.Labels[mapkey] = mapvalue - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", 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.CreatedAt, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UpdatedAt", 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.UpdatedAt, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Extensions", 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.Extensions == nil { - m.Extensions = make(map[string]types.Any) - } - var mapkey string - mapvalue := &types.Any{} - for iNdEx < postIndex { - entryPreIndex := 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) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSandbox - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthSandbox - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLengthSandbox - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var mapmsglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSandbox - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - mapmsglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if mapmsglen < 0 { - return ErrInvalidLengthSandbox - } - postmsgIndex := iNdEx + mapmsglen - if postmsgIndex < 0 { - return ErrInvalidLengthSandbox - } - if postmsgIndex > l { - return io.ErrUnexpectedEOF - } - mapvalue = &types.Any{} - if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { - return err - } - iNdEx = postmsgIndex - } else { - iNdEx = entryPreIndex - skippy, err := skipSandbox(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSandbox - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.Extensions[mapkey] = *mapvalue - 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 *Sandbox_Runtime) 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: Runtime: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Runtime: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", 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.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - 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 = &types.Any{} - } - if err := m.Options.Unmarshal(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 skipSandbox(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowSandbox - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowSandbox - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowSandbox - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthSandbox - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupSandbox - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthSandbox - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthSandbox = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowSandbox = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupSandbox = fmt.Errorf("proto: unexpected end of group") -) diff --git a/vendor/github.com/containerd/containerd/api/types/sandbox.proto b/vendor/github.com/containerd/containerd/api/types/sandbox.proto deleted file mode 100644 index b40e84bf4..000000000 --- a/vendor/github.com/containerd/containerd/api/types/sandbox.proto +++ /dev/null @@ -1,51 +0,0 @@ -/* - Copyright The containerd Authors. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -syntax = "proto3"; - -package containerd.types; - -import weak "gogoproto/gogo.proto"; -import "google/protobuf/any.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "github.com/containerd/containerd/api/types;types"; - -// Sandbox represents a sandbox metadata object that keeps all info required by controller to -// work with a particular instance. containerd keeps this in metadata store and sends it to a controller with -// each request, so they can reflect sandbox state changes (by updating the corresponding fields). -message Sandbox { - // SandboxID is a unique instance identifier within namespace - string sandbox_id = 1; - message Runtime { - // Name is the name of the runtime. - string name = 1; - // Options specify additional runtime initialization options. - google.protobuf.Any options = 2; - } - // Runtime specifies which runtime to use for executing this container. - Runtime runtime = 2 [(gogoproto.nullable) = false]; - // Spec is sandbox configuration (kin of OCI runtime spec, but for VM) - google.protobuf.Any spec = 3; - // Labels provides an area to include arbitrary data on containers. - map labels = 4 [(gogoproto.nullable) = false]; - // CreatedAt is the time the container was first created. - google.protobuf.Timestamp created_at = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - // UpdatedAt is the last time the container was mutated. - google.protobuf.Timestamp updated_at = 6 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - // Extensions allow clients to provide optional blobs that can be handled by runtime. - map extensions = 7 [(gogoproto.nullable) = false]; -} From df234edeb4663c88d0cc96bc2bf4b7904cb06baa Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Sun, 7 Nov 2021 16:40:28 -0800 Subject: [PATCH 08/22] [sandbox] Add controller service Signed-off-by: Maksym Pavlenko --- services/sandbox/controller_local.go | 101 +++++++++++++++++++++++++ services/sandbox/controller_service.go | 95 +++++++++++++++++++++++ 2 files changed, 196 insertions(+) create mode 100644 services/sandbox/controller_local.go create mode 100644 services/sandbox/controller_service.go diff --git a/services/sandbox/controller_local.go b/services/sandbox/controller_local.go new file mode 100644 index 000000000..3be92ff11 --- /dev/null +++ b/services/sandbox/controller_local.go @@ -0,0 +1,101 @@ +/* + Copyright The containerd Authors. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package sandbox + +import ( + "context" + + api "github.com/containerd/containerd/api/services/sandbox/v1" + "github.com/containerd/containerd/events" + "github.com/containerd/containerd/events/exchange" + "github.com/containerd/containerd/metadata" + "github.com/containerd/containerd/plugin" + v2 "github.com/containerd/containerd/runtime/v2" + "github.com/containerd/containerd/sandbox" + "github.com/containerd/containerd/services" + "google.golang.org/grpc" +) + +func init() { + plugin.Register(&plugin.Registration{ + Type: plugin.ServicePlugin, + ID: services.SandboxControllerService, + Requires: []plugin.Type{ + plugin.RuntimeShimPlugin, + plugin.MetadataPlugin, + plugin.EventPlugin, + }, + InitFn: func(ic *plugin.InitContext) (interface{}, error) { + shimPlugin, err := ic.Get(plugin.RuntimeShimPlugin) + if err != nil { + return nil, err + } + + metadataPlugin, err := ic.Get(plugin.MetadataPlugin) + if err != nil { + return nil, err + } + + exchangePlugin, err := ic.GetByID(plugin.EventPlugin, "exchange") + if err != nil { + return nil, err + } + + var ( + shims = shimPlugin.(*v2.ShimManager) + publisher = exchangePlugin.(*exchange.Exchange) + db = metadataPlugin.(*metadata.DB) + store = metadata.NewSandboxStore(db) + ) + + return &controllerLocal{ + shims: shims, + store: store, + publisher: publisher, + }, nil + }, + }) +} + +type controllerLocal struct { + shims *v2.ShimManager + store sandbox.Store + publisher events.Publisher +} + +var _ api.ControllerClient = (*controllerLocal)(nil) + +func (c *controllerLocal) Start(ctx context.Context, in *api.ControllerStartRequest, opts ...grpc.CallOption) (*api.ControllerStartResponse, error) { + panic("implement me") +} + +func (c *controllerLocal) Shutdown(ctx context.Context, in *api.ControllerShutdownRequest, opts ...grpc.CallOption) (*api.ControllerShutdownResponse, error) { + panic("implement me") +} + +func (c *controllerLocal) Pause(ctx context.Context, in *api.ControllerPauseRequest, opts ...grpc.CallOption) (*api.ControllerPauseResponse, error) { + panic("implement me") +} + +func (c *controllerLocal) Resume(ctx context.Context, in *api.ControllerResumeRequest, opts ...grpc.CallOption) (*api.ControllerResumeResponse, error) { + panic("implement me") +} + +func (c *controllerLocal) Ping(ctx context.Context, in *api.ControllerPingRequest, opts ...grpc.CallOption) (*api.ControllerPingResponse, error) { + panic("implement me") +} + +func (c *controllerLocal) Status(ctx context.Context, in *api.ControllerStatusRequest, opts ...grpc.CallOption) (*api.ControllerStatusResponse, error) { + panic("implement me") +} diff --git a/services/sandbox/controller_service.go b/services/sandbox/controller_service.go new file mode 100644 index 000000000..b1df0a423 --- /dev/null +++ b/services/sandbox/controller_service.go @@ -0,0 +1,95 @@ +/* + Copyright The containerd Authors. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package sandbox + +import ( + "context" + "errors" + + api "github.com/containerd/containerd/api/services/sandbox/v1" + "github.com/containerd/containerd/log" + "github.com/containerd/containerd/plugin" + "github.com/containerd/containerd/services" + "google.golang.org/grpc" +) + +func init() { + plugin.Register(&plugin.Registration{ + Type: plugin.GRPCPlugin, + ID: "controllers", + Requires: []plugin.Type{ + plugin.ServicePlugin, + }, + InitFn: func(ic *plugin.InitContext) (interface{}, error) { + plugins, err := ic.GetByType(plugin.ServicePlugin) + if err != nil { + return nil, err + } + + p, ok := plugins[services.SandboxControllerService] + if !ok { + return nil, errors.New("sandbox service not found") + } + + i, err := p.Instance() + if err != nil { + return nil, err + } + + return &controllerService{ + local: i.(api.ControllerClient), + }, nil + }, + }) +} + +type controllerService struct { + local api.ControllerClient +} + +var _ api.ControllerServer = (*controllerService)(nil) + +func (s *controllerService) Register(server *grpc.Server) error { + api.RegisterControllerServer(server, s) + return nil +} + +func (s *controllerService) Start(ctx context.Context, req *api.ControllerStartRequest) (*api.ControllerStartResponse, error) { + log.G(ctx).WithField("req", req).Debug("start sandbox") + return s.local.Start(ctx, req) +} + +func (s *controllerService) Shutdown(ctx context.Context, req *api.ControllerShutdownRequest) (*api.ControllerShutdownResponse, error) { + log.G(ctx).WithField("req", req).Debug("delete sandbox") + return s.local.Shutdown(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) +} + +func (s *controllerService) Resume(ctx context.Context, req *api.ControllerResumeRequest) (*api.ControllerResumeResponse, error) { + log.G(ctx).WithField("req", req).Debug("resume sandbox") + return s.local.Resume(ctx, req) +} + +func (s *controllerService) Ping(ctx context.Context, req *api.ControllerPingRequest) (*api.ControllerPingResponse, error) { + return s.local.Ping(ctx, req) +} + +func (s *controllerService) Status(ctx context.Context, req *api.ControllerStatusRequest) (*api.ControllerStatusResponse, error) { + log.G(ctx).WithField("req", req).Debug("sandbox status") + return s.local.Status(ctx, req) +} From eaccbf1d03428585d46f8cb5f128564e937e1127 Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Mon, 19 Apr 2021 15:19:29 -0700 Subject: [PATCH 09/22] [sandbox] Add clients Signed-off-by: Maksym Pavlenko --- client.go | 24 ++++- cmd/containerd/builtins.go | 1 + container_opts.go | 9 ++ sandbox.go | 198 +++++++++++++++++++++++++++++++++++++ sandbox_controller.go | 92 +++++++++++++++++ sandbox_store.go | 95 ++++++++++++++++++ services.go | 18 ++++ 7 files changed, 436 insertions(+), 1 deletion(-) create mode 100644 sandbox.go create mode 100644 sandbox_controller.go create mode 100644 sandbox_store.go diff --git a/client.go b/client.go index 1c2202e1e..defcc35f7 100644 --- a/client.go +++ b/client.go @@ -35,6 +35,7 @@ import ( introspectionapi "github.com/containerd/containerd/api/services/introspection/v1" leasesapi "github.com/containerd/containerd/api/services/leases/v1" namespacesapi "github.com/containerd/containerd/api/services/namespaces/v1" + sandboxsapi "github.com/containerd/containerd/api/services/sandbox/v1" snapshotsapi "github.com/containerd/containerd/api/services/snapshots/v1" "github.com/containerd/containerd/api/services/tasks/v1" versionservice "github.com/containerd/containerd/api/services/version/v1" @@ -54,13 +55,14 @@ import ( "github.com/containerd/containerd/plugin" "github.com/containerd/containerd/remotes" "github.com/containerd/containerd/remotes/docker" + "github.com/containerd/containerd/sandbox" "github.com/containerd/containerd/services/introspection" "github.com/containerd/containerd/snapshots" snproxy "github.com/containerd/containerd/snapshots/proxy" "github.com/containerd/typeurl" ptypes "github.com/gogo/protobuf/types" ocispec "github.com/opencontainers/image-spec/specs-go/v1" - specs "github.com/opencontainers/runtime-spec/specs-go" + "github.com/opencontainers/runtime-spec/specs-go" "golang.org/x/sync/semaphore" "google.golang.org/grpc" "google.golang.org/grpc/backoff" @@ -688,6 +690,26 @@ func (c *Client) EventService() EventService { return NewEventServiceFromClient(eventsapi.NewEventsClient(c.conn)) } +// SandboxStore returns the underlying sandbox store client +func (c *Client) SandboxStore() sandbox.Store { + if c.sandboxStore != nil { + return c.sandboxStore + } + c.connMu.Lock() + defer c.connMu.Unlock() + return NewRemoteSandboxStore(sandboxsapi.NewStoreClient(c.conn)) +} + +// SandboxController returns the underlying sandbox controller client +func (c *Client) SandboxController() sandbox.Controller { + if c.sandboxController != nil { + return c.sandboxController + } + c.connMu.Lock() + defer c.connMu.Unlock() + return NewSandboxRemoteController(sandboxsapi.NewControllerClient(c.conn)) +} + // VersionService returns the underlying VersionClient func (c *Client) VersionService() versionservice.VersionClient { c.connMu.Lock() diff --git a/cmd/containerd/builtins.go b/cmd/containerd/builtins.go index dd8b1d3d9..792adbe3c 100644 --- a/cmd/containerd/builtins.go +++ b/cmd/containerd/builtins.go @@ -33,6 +33,7 @@ import ( _ "github.com/containerd/containerd/services/leases" _ "github.com/containerd/containerd/services/namespaces" _ "github.com/containerd/containerd/services/opt" + _ "github.com/containerd/containerd/services/sandbox" _ "github.com/containerd/containerd/services/snapshots" _ "github.com/containerd/containerd/services/tasks" _ "github.com/containerd/containerd/services/version" diff --git a/container_opts.go b/container_opts.go index f005fe1c7..76a9b9616 100644 --- a/container_opts.go +++ b/container_opts.go @@ -74,6 +74,15 @@ func WithRuntime(name string, options interface{}) NewContainerOpts { } } +// WithSandbox joins the container to a container group (aka sandbox) from the given ID +// Note: shim runtime must support sandboxes environments. +func WithSandbox(sandboxID string) NewContainerOpts { + return func(ctx context.Context, client *Client, c *containers.Container) error { + c.SandboxID = sandboxID + return nil + } +} + // WithImage sets the provided image as the base for the container func WithImage(i Image) NewContainerOpts { return func(ctx context.Context, client *Client, c *containers.Container) error { diff --git a/sandbox.go b/sandbox.go new file mode 100644 index 000000000..9449bdabb --- /dev/null +++ b/sandbox.go @@ -0,0 +1,198 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package containerd + +import ( + "context" + "time" + + api "github.com/containerd/containerd/sandbox" + "github.com/containerd/typeurl" + "github.com/gogo/protobuf/types" + "github.com/pkg/errors" +) + +// Sandbox is a high level client to containerd's sandboxes. +type Sandbox interface { + // ID is a sandbox identifier + ID() string + // 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 + Labels(ctx context.Context) (map[string]string, error) + // Start starts new sandbox instance + Start(ctx context.Context) error + // Shutdown will turn down existing sandbox instance + Shutdown(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 +} + +type sandboxClient struct { + client *Client + metadata api.Sandbox +} + +func (s *sandboxClient) ID() string { + return s.metadata.ID +} + +func (s *sandboxClient) NewContainer(ctx context.Context, id string, opts ...NewContainerOpts) (Container, error) { + return s.client.NewContainer(ctx, id, append(opts, WithSandbox(s.ID()))...) +} + +func (s *sandboxClient) Labels(ctx context.Context) (map[string]string, error) { + sandbox, err := s.client.SandboxStore().Get(ctx, s.ID()) + if err != nil { + return nil, err + } + + return sandbox.Labels, nil +} + +func (s *sandboxClient) Start(ctx context.Context) error { + return s.client.SandboxController().Start(ctx, s.ID()) +} + +func (s *sandboxClient) Shutdown(ctx context.Context) error { + return s.client.SandboxController().Shutdown(ctx, s.ID()) +} + +func (s *sandboxClient) Pause(ctx context.Context) error { + return s.client.SandboxController().Pause(ctx, s.ID()) +} + +func (s *sandboxClient) Resume(ctx context.Context) error { + return s.client.SandboxController().Resume(ctx, s.ID()) +} + +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) { + newSandbox := api.Sandbox{ + ID: sandboxID, + CreatedAt: time.Now().UTC(), + UpdatedAt: time.Now().UTC(), + } + + for _, opt := range opts { + if err := opt(ctx, c, &newSandbox); err != nil { + return nil, err + } + } + + metadata, err := c.SandboxStore().Create(ctx, newSandbox) + if err != nil { + return nil, err + } + + return &sandboxClient{ + client: c, + metadata: metadata, + }, nil +} + +// LoadSandbox laods existing sandbox metadata object using the id +func (c *Client) LoadSandbox(ctx context.Context, id string) (Sandbox, error) { + sandbox, err := c.SandboxStore().Get(ctx, id) + if err != nil { + return nil, err + } + + return &sandboxClient{ + client: c, + metadata: sandbox, + }, nil +} + +// NewSandboxOpts is a sandbox options and extensions to be provided by client +type NewSandboxOpts func(ctx context.Context, client *Client, sandbox *api.Sandbox) error + +// WithSandboxRuntime allows a user to specify the runtime to be used to run a sandbox +func WithSandboxRuntime(name string, options interface{}) NewSandboxOpts { + return func(ctx context.Context, client *Client, s *api.Sandbox) error { + opts, err := typeurl.MarshalAny(options) + if err != nil { + return errors.Wrap(err, "failed to marshal sandbox runtime options") + } + + s.Runtime = api.RuntimeOpts{ + Name: name, + Options: opts, + } + + return nil + } +} + +// WithSandboxSpec will provide the sandbox runtime spec +func WithSandboxSpec(spec interface{}) NewSandboxOpts { + return func(ctx context.Context, client *Client, sandbox *api.Sandbox) error { + spec, err := typeurl.MarshalAny(spec) + if err != nil { + return errors.Wrap(err, "failed to marshal spec") + } + + sandbox.Spec = spec + return nil + } +} + +// WithSandboxExtension attaches an extension to sandbox +func WithSandboxExtension(name string, ext interface{}) NewSandboxOpts { + return func(ctx context.Context, client *Client, s *api.Sandbox) error { + if s.Extensions == nil { + s.Extensions = make(map[string]types.Any) + } + + any, err := typeurl.MarshalAny(ext) + if err != nil { + return errors.Wrap(err, "failed to marshal sandbox extension") + } + + s.Extensions[name] = *any + return err + } +} + +// WithSandboxLabels attaches map of labels to sandbox +func WithSandboxLabels(labels map[string]string) NewSandboxOpts { + return func(ctx context.Context, client *Client, sandbox *api.Sandbox) error { + sandbox.Labels = labels + return nil + } +} diff --git a/sandbox_controller.go b/sandbox_controller.go new file mode 100644 index 000000000..ecb7e093d --- /dev/null +++ b/sandbox_controller.go @@ -0,0 +1,92 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package containerd + +import ( + "context" + + 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 +type sandboxRemoteController struct { + client api.ControllerClient +} + +var _ sb.Controller = (*sandboxRemoteController)(nil) + +// NewSandboxRemoteController creates client for sandbox controller +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) + } + + return nil +} + +func (s *sandboxRemoteController) Shutdown(ctx context.Context, sandboxID string) error { + _, err := s.client.Shutdown(ctx, &api.ControllerShutdownRequest{SandboxID: sandboxID}) + if err != nil { + return errdefs.FromGRPC(err) + } + + return nil +} + +func (s *sandboxRemoteController) Pause(ctx context.Context, sandboxID string) error { + _, err := s.client.Pause(ctx, &api.ControllerPauseRequest{SandboxID: sandboxID}) + if err != nil { + return errdefs.FromGRPC(err) + } + + return nil +} + +func (s *sandboxRemoteController) Resume(ctx context.Context, sandboxID string) error { + _, err := s.client.Resume(ctx, &api.ControllerResumeRequest{SandboxID: sandboxID}) + if err != nil { + return errdefs.FromGRPC(err) + } + + return nil +} + +func (s *sandboxRemoteController) Ping(ctx context.Context, sandboxID string) error { + if _, err := s.client.Ping(ctx, &api.ControllerPingRequest{SandboxID: sandboxID}); err != nil { + return errdefs.FromGRPC(err) + } + + return nil +} + +func (s *sandboxRemoteController) Status(ctx context.Context, sandboxID string) (*types.Any, error) { + resp, err := s.client.Status(ctx, &api.ControllerStatusRequest{SandboxID: sandboxID}) + if err != nil { + return nil, errdefs.FromGRPC(err) + } + + return resp.Status, nil +} diff --git a/sandbox_store.go b/sandbox_store.go new file mode 100644 index 000000000..3fe437353 --- /dev/null +++ b/sandbox_store.go @@ -0,0 +1,95 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package containerd + +import ( + "context" + + api "github.com/containerd/containerd/api/services/sandbox/v1" + "github.com/containerd/containerd/errdefs" + sb "github.com/containerd/containerd/sandbox" +) + +// remoteSandboxStore is a low-level containerd client to manage sandbox environments metadata +type remoteSandboxStore struct { + client api.StoreClient +} + +var _ sb.Store = (*remoteSandboxStore)(nil) + +// NewRemoteSandboxStore create client for sandbox store +func NewRemoteSandboxStore(client api.StoreClient) sb.Store { + return &remoteSandboxStore{client: client} +} + +func (s *remoteSandboxStore) Create(ctx context.Context, sandbox sb.Sandbox) (sb.Sandbox, error) { + resp, err := s.client.Create(ctx, &api.StoreCreateRequest{ + Sandbox: sb.ToProto(&sandbox), + }) + if err != nil { + return sb.Sandbox{}, errdefs.FromGRPC(err) + } + + return sb.FromProto(&resp.Sandbox), nil +} + +func (s *remoteSandboxStore) Update(ctx context.Context, sandbox sb.Sandbox, fieldpaths ...string) (sb.Sandbox, error) { + resp, err := s.client.Update(ctx, &api.StoreUpdateRequest{ + Sandbox: sb.ToProto(&sandbox), + Fields: fieldpaths, + }) + if err != nil { + return sb.Sandbox{}, errdefs.FromGRPC(err) + } + + return sb.FromProto(&resp.Sandbox), nil +} + +func (s *remoteSandboxStore) Get(ctx context.Context, id string) (sb.Sandbox, error) { + resp, err := s.client.Get(ctx, &api.StoreGetRequest{ + SandboxID: id, + }) + if err != nil { + return sb.Sandbox{}, errdefs.FromGRPC(err) + } + + return sb.FromProto(resp.Sandbox), nil +} + +func (s *remoteSandboxStore) List(ctx context.Context, filters ...string) ([]sb.Sandbox, error) { + resp, err := s.client.List(ctx, &api.StoreListRequest{ + Filters: filters, + }) + if err != nil { + return nil, errdefs.FromGRPC(err) + } + + out := make([]sb.Sandbox, len(resp.List)) + for i, s := range resp.List { + out[i] = sb.FromProto(&s) + } + + return out, nil +} + +func (s *remoteSandboxStore) Delete(ctx context.Context, id string) error { + _, err := s.client.Delete(ctx, &api.StoreDeleteRequest{ + SandboxID: id, + }) + + return errdefs.FromGRPC(err) +} diff --git a/services.go b/services.go index e780e6ccf..3e1c66835 100644 --- a/services.go +++ b/services.go @@ -22,12 +22,14 @@ import ( imagesapi "github.com/containerd/containerd/api/services/images/v1" introspectionapi "github.com/containerd/containerd/api/services/introspection/v1" namespacesapi "github.com/containerd/containerd/api/services/namespaces/v1" + sandboxsapi "github.com/containerd/containerd/api/services/sandbox/v1" "github.com/containerd/containerd/api/services/tasks/v1" "github.com/containerd/containerd/containers" "github.com/containerd/containerd/content" "github.com/containerd/containerd/images" "github.com/containerd/containerd/leases" "github.com/containerd/containerd/namespaces" + "github.com/containerd/containerd/sandbox" "github.com/containerd/containerd/services/introspection" "github.com/containerd/containerd/snapshots" ) @@ -43,6 +45,8 @@ type services struct { eventService EventService leasesService leases.Manager introspectionService introspection.Service + sandboxStore sandbox.Store + sandboxController sandbox.Controller } // ServicesOpt allows callers to set options on the services @@ -155,3 +159,17 @@ func WithIntrospectionService(in introspection.Service) ServicesOpt { s.introspectionService = in } } + +// WithSandboxStore sets the sandbox store. +func WithSandboxStore(client sandboxsapi.StoreClient) ServicesOpt { + return func(s *services) { + s.sandboxStore = NewRemoteSandboxStore(client) + } +} + +// WithSandboxController sets the sandbox controller. +func WithSandboxController(client sandboxsapi.ControllerClient) ServicesOpt { + return func(s *services) { + s.sandboxController = NewSandboxRemoteController(client) + } +} From 6343fe3ea25fde4dc344b23ba5399934b481304c Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Sun, 7 Nov 2021 17:25:16 -0800 Subject: [PATCH 10/22] [sandbox] Implement sandbox controller Signed-off-by: Maksym Pavlenko --- runtime/v2/manager.go | 3 +- runtime/v2/shim.go | 6 ++ services/sandbox/controller_local.go | 118 +++++++++++++++++++++++++-- 3 files changed, 120 insertions(+), 7 deletions(-) diff --git a/runtime/v2/manager.go b/runtime/v2/manager.go index d8e2cb5fe..e98027551 100644 --- a/runtime/v2/manager.go +++ b/runtime/v2/manager.go @@ -324,7 +324,8 @@ func (m *ShimManager) Get(ctx context.Context, id string) (ShimProcess, error) { return nil, err } - return proc, nil + shimTask := proc.(*shimTask) + return shimTask, nil } // Delete a runtime task diff --git a/runtime/v2/shim.go b/runtime/v2/shim.go index 2bffe116a..037d64c9d 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 + // Client returns the underlying TTRPC client for this shim. + Client() *ttrpc.Client } type shim struct { @@ -243,6 +245,10 @@ type shimTask struct { task task.TaskService } +func (s *shimTask) Client() *ttrpc.Client { + return s.client +} + func (s *shimTask) Shutdown(ctx context.Context) error { _, err := s.task.Shutdown(ctx, &task.ShutdownRequest{ ID: s.ID(), diff --git a/services/sandbox/controller_local.go b/services/sandbox/controller_local.go index 3be92ff11..ad96f4880 100644 --- a/services/sandbox/controller_local.go +++ b/services/sandbox/controller_local.go @@ -15,15 +15,21 @@ package sandbox import ( "context" + "fmt" api "github.com/containerd/containerd/api/services/sandbox/v1" + "github.com/containerd/containerd/errdefs" "github.com/containerd/containerd/events" "github.com/containerd/containerd/events/exchange" "github.com/containerd/containerd/metadata" "github.com/containerd/containerd/plugin" + "github.com/containerd/containerd/runtime" v2 "github.com/containerd/containerd/runtime/v2" + "github.com/containerd/containerd/runtime/v2/task" + proto "github.com/containerd/containerd/runtime/v2/task" "github.com/containerd/containerd/sandbox" "github.com/containerd/containerd/services" + "github.com/pkg/errors" "google.golang.org/grpc" ) @@ -77,25 +83,125 @@ type controllerLocal struct { var _ api.ControllerClient = (*controllerLocal)(nil) func (c *controllerLocal) Start(ctx context.Context, in *api.ControllerStartRequest, opts ...grpc.CallOption) (*api.ControllerStartResponse, error) { - panic("implement me") + if _, err := c.shims.Get(ctx, in.SandboxID); err == nil { + return nil, fmt.Errorf("sandbox %s already running: %w", in.SandboxID, errdefs.ErrAlreadyExists) + } + + info, err := c.store.Get(ctx, in.SandboxID) + if err != nil { + return nil, fmt.Errorf("failed to query sandbox metadata from store: %w", err) + } + + shim, err := c.shims.Start(ctx, in.SandboxID, runtime.CreateOpts{ + Spec: info.Spec, + RuntimeOptions: info.Runtime.Options, + Runtime: info.Runtime.Name, + TaskOptions: nil, + }) + + if err != nil { + return nil, fmt.Errorf("failed to start new sandbox: %w", err) + } + + svc := task.NewSandboxClient(shim.Client()) + + _, err = svc.StartSandbox(ctx, &proto.StartSandboxRequest{ + SandboxID: in.SandboxID, + BundlePath: "", + }) + + if err != nil { + return nil, fmt.Errorf("failed to start sandbox %s: %w", in.SandboxID, err) + } + + return &api.ControllerStartResponse{}, nil } func (c *controllerLocal) Shutdown(ctx context.Context, in *api.ControllerShutdownRequest, opts ...grpc.CallOption) (*api.ControllerShutdownResponse, error) { - panic("implement me") + svc, err := c.getSandbox(ctx, in.SandboxID) + if err != nil { + return nil, err + } + + if _, err := svc.StopSandbox(ctx, &proto.StopSandboxRequest{ + SandboxID: in.SandboxID, + TimeoutSecs: 0, + }); err != nil { + return nil, fmt.Errorf("failed to stop sandbox: %w", err) + } + + if err := c.shims.Delete(ctx, in.SandboxID); err != nil { + return nil, fmt.Errorf("failed to delete sandbox shim: %w", err) + } + + return &api.ControllerShutdownResponse{}, nil } func (c *controllerLocal) Pause(ctx context.Context, in *api.ControllerPauseRequest, opts ...grpc.CallOption) (*api.ControllerPauseResponse, error) { - panic("implement me") + svc, err := c.getSandbox(ctx, in.SandboxID) + if err != nil { + return nil, err + } + + if _, err := svc.PauseSandbox(ctx, &proto.PauseSandboxRequest{ + SandboxID: in.SandboxID, + }); err != nil { + return nil, errors.Wrapf(err, "failed to resume sandbox %s", in.SandboxID) + } + + return &api.ControllerPauseResponse{}, nil } func (c *controllerLocal) Resume(ctx context.Context, in *api.ControllerResumeRequest, opts ...grpc.CallOption) (*api.ControllerResumeResponse, error) { - panic("implement me") + svc, err := c.getSandbox(ctx, in.SandboxID) + if err != nil { + return nil, err + } + + if _, err := svc.ResumeSandbox(ctx, &proto.ResumeSandboxRequest{ + SandboxID: in.SandboxID, + }); err != nil { + return nil, errors.Wrapf(err, "failed to resume sandbox %s", in.SandboxID) + } + + return &api.ControllerResumeResponse{}, nil } func (c *controllerLocal) Ping(ctx context.Context, in *api.ControllerPingRequest, opts ...grpc.CallOption) (*api.ControllerPingResponse, error) { - panic("implement me") + svc, err := c.getSandbox(ctx, in.SandboxID) + if err != nil { + return nil, err + } + + if _, err := svc.PingSandbox(ctx, &proto.PingRequest{ + SandboxID: in.SandboxID, + }); err != nil { + return nil, err + } + + return &api.ControllerPingResponse{}, nil } func (c *controllerLocal) Status(ctx context.Context, in *api.ControllerStatusRequest, opts ...grpc.CallOption) (*api.ControllerStatusResponse, error) { - panic("implement me") + svc, err := c.getSandbox(ctx, in.SandboxID) + if err != nil { + return nil, err + } + + resp, err := svc.SandboxStatus(ctx, &proto.SandboxStatusRequest{SandboxID: in.SandboxID}) + if err != nil { + return nil, fmt.Errorf("failed to query sandbox %s status: %w", in.SandboxID, err) + } + + return &api.ControllerStatusResponse{Status: resp.Status}, nil +} + +func (c *controllerLocal) getSandbox(ctx context.Context, id string) (task.SandboxService, error) { + shim, err := c.shims.Get(ctx, id) + if err != nil { + return nil, errdefs.ErrNotFound + } + + svc := task.NewSandboxClient(shim.Client()) + return svc, nil } From 00f7a6bf2b0b8f5eda0369154a4ecbaddd6d9ed5 Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Sun, 7 Nov 2021 17:55:47 -0800 Subject: [PATCH 11/22] [sandbox] Address PR review comments Signed-off-by: Maksym Pavlenko --- api/next.pb.txt | 8 ++++---- api/types/sandbox.pb.go | 9 +++++---- api/types/sandbox.proto | 9 +++++---- metadata/boltutil/helpers.go | 4 ++-- metadata/sandbox.go | 12 +++++++----- sandbox.go | 2 ++ sandbox/controller.go | 7 ++++--- sandbox/helpers.go | 1 + services/sandbox/controller_local.go | 3 +++ services/sandbox/controller_service.go | 5 ++++- 10 files changed, 37 insertions(+), 23 deletions(-) diff --git a/api/next.pb.txt b/api/next.pb.txt index 98b74e017..a670015bd 100644 --- a/api/next.pb.txt +++ b/api/next.pb.txt @@ -22,7 +22,7 @@ file { java_package: "com.google.protobuf" java_outer_classname: "AnyProto" java_multiple_files: true - go_package: "google.golang.org/protobuf/types/known/anypb" + go_package: "github.com/golang/protobuf/ptypes/any" objc_class_prefix: "GPB" csharp_namespace: "Google.Protobuf.WellKnownTypes" } @@ -458,7 +458,7 @@ file { java_package: "com.google.protobuf" java_outer_classname: "TimestampProto" java_multiple_files: true - go_package: "google.golang.org/protobuf/types/known/timestamppb" + go_package: "github.com/golang/protobuf/ptypes/timestamp" cc_enable_arenas: true objc_class_prefix: "GPB" csharp_namespace: "Google.Protobuf.WellKnownTypes" @@ -800,7 +800,7 @@ file { java_package: "com.google.protobuf" java_outer_classname: "EmptyProto" java_multiple_files: true - go_package: "google.golang.org/protobuf/types/known/emptypb" + go_package: "github.com/golang/protobuf/ptypes/empty" cc_enable_arenas: true objc_class_prefix: "GPB" csharp_namespace: "Google.Protobuf.WellKnownTypes" @@ -824,7 +824,7 @@ file { java_package: "com.google.protobuf" java_outer_classname: "FieldMaskProto" java_multiple_files: true - go_package: "google.golang.org/protobuf/types/known/fieldmaskpb" + go_package: "google.golang.org/genproto/protobuf/field_mask;field_mask" cc_enable_arenas: true objc_class_prefix: "GPB" csharp_namespace: "Google.Protobuf.WellKnownTypes" diff --git a/api/types/sandbox.pb.go b/api/types/sandbox.pb.go index d44a3587d..5bd7b8e7e 100644 --- a/api/types/sandbox.pb.go +++ b/api/types/sandbox.pb.go @@ -30,14 +30,14 @@ var _ = time.Kitchen const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Sandbox represents a sandbox metadata object that keeps all info required by controller to -// work with a particular instance. containerd keeps this in metadata store and sends it to a controller with -// each request, so they can reflect sandbox state changes (by updating the corresponding fields). +// work with a particular instance. type Sandbox struct { // SandboxID is a unique instance identifier within namespace SandboxID string `protobuf:"bytes,1,opt,name=sandbox_id,json=sandboxId,proto3" json:"sandbox_id,omitempty"` // Runtime specifies which runtime to use for executing this container. Runtime Sandbox_Runtime `protobuf:"bytes,2,opt,name=runtime,proto3" json:"runtime"` - // Spec is sandbox configuration (kin of OCI runtime spec, but for VM) + // Spec is sandbox configuration (kin of OCI runtime spec), spec's data will be written to a config.json file in the + // bundle directory (similary to OCI spec). Spec *types.Any `protobuf:"bytes,3,opt,name=spec,proto3" json:"spec,omitempty"` // Labels provides an area to include arbitrary data on containers. Labels map[string]string `protobuf:"bytes,4,rep,name=labels,proto3" json:"labels" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` @@ -87,7 +87,8 @@ var xxx_messageInfo_Sandbox proto.InternalMessageInfo type Sandbox_Runtime struct { // Name is the name of the runtime. Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Options specify additional runtime initialization options. + // Options specify additional runtime initialization options for the shim (this data will be available in StartShim). + // Typically this data expected to be runtime shim implementation specific. Options *types.Any `protobuf:"bytes,2,opt,name=options,proto3" json:"options,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` diff --git a/api/types/sandbox.proto b/api/types/sandbox.proto index b40e84bf4..0a2cf7a5b 100644 --- a/api/types/sandbox.proto +++ b/api/types/sandbox.proto @@ -25,20 +25,21 @@ import "google/protobuf/timestamp.proto"; option go_package = "github.com/containerd/containerd/api/types;types"; // Sandbox represents a sandbox metadata object that keeps all info required by controller to -// work with a particular instance. containerd keeps this in metadata store and sends it to a controller with -// each request, so they can reflect sandbox state changes (by updating the corresponding fields). +// work with a particular instance. message Sandbox { // SandboxID is a unique instance identifier within namespace string sandbox_id = 1; message Runtime { // Name is the name of the runtime. string name = 1; - // Options specify additional runtime initialization options. + // Options specify additional runtime initialization options for the shim (this data will be available in StartShim). + // Typically this data expected to be runtime shim implementation specific. google.protobuf.Any options = 2; } // Runtime specifies which runtime to use for executing this container. Runtime runtime = 2 [(gogoproto.nullable) = false]; - // Spec is sandbox configuration (kin of OCI runtime spec, but for VM) + // Spec is sandbox configuration (kin of OCI runtime spec), spec's data will be written to a config.json file in the + // bundle directory (similary to OCI spec). google.protobuf.Any spec = 3; // Labels provides an area to include arbitrary data on containers. map labels = 4 [(gogoproto.nullable) = false]; diff --git a/metadata/boltutil/helpers.go b/metadata/boltutil/helpers.go index 2b2b0ad1e..73d546ced 100644 --- a/metadata/boltutil/helpers.go +++ b/metadata/boltutil/helpers.go @@ -213,11 +213,11 @@ func WriteAny(bkt *bolt.Bucket, name []byte, any typeurl.Any) error { data, err := proto.Marshal(pbany) if err != nil { - return err + return fmt.Errorf("failed to marshal: %w", err) } if err := bkt.Put(name, data); err != nil { - return err + return fmt.Errorf("put failed: %w", err) } return nil diff --git a/metadata/sandbox.go b/metadata/sandbox.go index 158e7ba6e..ecff782cd 100644 --- a/metadata/sandbox.go +++ b/metadata/sandbox.go @@ -18,11 +18,13 @@ package metadata import ( "context" + "fmt" "strings" "time" "github.com/containerd/containerd/errdefs" "github.com/containerd/containerd/filters" + "github.com/containerd/containerd/identifiers" "github.com/containerd/containerd/metadata/boltutil" "github.com/containerd/containerd/namespaces" api "github.com/containerd/containerd/sandbox" @@ -59,11 +61,11 @@ func (s *sandboxStore) Create(ctx context.Context, sandbox api.Sandbox) (api.San if err := s.db.Update(func(tx *bbolt.Tx) error { parent, err := createSandboxBucket(tx, ns) if err != nil { - return err + return fmt.Errorf("create error: %w", err) } if err := s.write(parent, &sandbox, false); err != nil { - return err + return fmt.Errorf("write error: %w", err) } return nil @@ -200,7 +202,7 @@ func (s *sandboxStore) List(ctx context.Context, fields ...string) ([]api.Sandbo if err := view(ctx, s.db, func(tx *bbolt.Tx) error { bucket := getSandboxBucket(tx, ns) if bucket == nil { - return errors.Wrap(errdefs.ErrNotFound, "not sandbox buckets") + return errors.Wrap(errdefs.ErrNotFound, "no sandbox buckets") } if err := bucket.ForEach(func(k, v []byte) error { @@ -354,8 +356,8 @@ func (s *sandboxStore) read(parent *bbolt.Bucket, id []byte) (api.Sandbox, error } func (s *sandboxStore) validate(new *api.Sandbox) error { - if new.ID == "" { - return errors.Wrap(errdefs.ErrInvalidArgument, "instance ID must not be empty") + if err := identifiers.Validate(new.ID); err != nil { + return errors.Wrap(err, "invalid sandbox ID") } if new.CreatedAt.IsZero() { diff --git a/sandbox.go b/sandbox.go index 9449bdabb..6c30906f5 100644 --- a/sandbox.go +++ b/sandbox.go @@ -44,6 +44,8 @@ type Sandbox interface { 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 { diff --git a/sandbox/controller.go b/sandbox/controller.go index dd5f11547..3bf77d154 100644 --- a/sandbox/controller.go +++ b/sandbox/controller.go @@ -37,7 +37,7 @@ import ( // 1. Client calls `client.Controller.Start()` to launch new shim and create sandbox process // 2. Run containers with `shim.TaskService.RunContainer(id=1)` and another one `shim.TaskService.RunContainer(id=2)` // 3. ... usual container lifecycle calls to `shim.TaskService` -// 4. Client calls shim to stop the VM with `client.SandboxService.Shutdown()` +// 4. Client calls shim to stop the sandbox with `client.SandboxService.Shutdown()` // 5. Shim implementation will perform cleanup similar to regular task service (e.g. shutdown, clean, and `shim_binary --delete`) type Controller interface { // Start will start new sandbox instance. @@ -52,9 +52,10 @@ type Controller interface { Pause(ctx context.Context, sandboxID string) error // Resume will unfreeze previously paused sandbox instance Resume(ctx context.Context, sandboxID string) error - // Ping is a lightweight API call to check whether sandbox instance is still alive. + // Ping is a lightweight API call to check whether sandbox instance is still alive (e.g. quick livability check). // This should not involve any complex logic and containerd will not debug log it as it might be called quite often. Ping(ctx context.Context, sandboxID string) error - // Status will query sandbox process status + // 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) } diff --git a/sandbox/helpers.go b/sandbox/helpers.go index 420589cca..9f155bf07 100644 --- a/sandbox/helpers.go +++ b/sandbox/helpers.go @@ -32,6 +32,7 @@ func ToProto(s *Sandbox) types.Sandbox { CreatedAt: s.CreatedAt, UpdatedAt: s.UpdatedAt, Extensions: s.Extensions, + Spec: s.Spec, } } diff --git a/services/sandbox/controller_local.go b/services/sandbox/controller_local.go index ad96f4880..968e04ba7 100644 --- a/services/sandbox/controller_local.go +++ b/services/sandbox/controller_local.go @@ -1,9 +1,12 @@ /* Copyright The containerd Authors. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/services/sandbox/controller_service.go b/services/sandbox/controller_service.go index b1df0a423..b959a370b 100644 --- a/services/sandbox/controller_service.go +++ b/services/sandbox/controller_service.go @@ -1,9 +1,12 @@ /* Copyright The containerd Authors. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -27,7 +30,7 @@ import ( func init() { plugin.Register(&plugin.Registration{ Type: plugin.GRPCPlugin, - ID: "controllers", + ID: "sandbox-controllers", Requires: []plugin.Type{ plugin.ServicePlugin, }, From 982de8a5d5a2b469df89425115a93caeeb7611e6 Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Wed, 10 Nov 2021 14:57:57 -0800 Subject: [PATCH 12/22] Launch sandboxed containers from task service Signed-off-by: Maksym Pavlenko --- containers/containers.go | 2 ++ runtime/runtime.go | 2 ++ runtime/v2/manager.go | 19 ++++++++++++++++--- sandbox/controller.go | 26 +++++++++++++------------- services/tasks/local.go | 1 + 5 files changed, 34 insertions(+), 16 deletions(-) diff --git a/containers/containers.go b/containers/containers.go index c343a64a9..9aa0ba0d4 100644 --- a/containers/containers.go +++ b/containers/containers.go @@ -78,6 +78,8 @@ type Container struct { Extensions map[string]typeurl.Any // SandboxID is an identifier of sandbox this container belongs to. + // + // This property is optional, but can't be changed after creation. SandboxID string } diff --git a/runtime/runtime.go b/runtime/runtime.go index 1ca22ee2b..65c276c80 100644 --- a/runtime/runtime.go +++ b/runtime/runtime.go @@ -49,6 +49,8 @@ type CreateOpts struct { // Runtime name to use (e.g. `io.containerd.NAME.VERSION`). // As an alternative full abs path to binary may be specified instead. Runtime string + // SandboxID is an optional ID of sandbox this container belongs to + SandboxID string } // Exit information for a process diff --git a/runtime/v2/manager.go b/runtime/v2/manager.go index e98027551..51c6df616 100644 --- a/runtime/v2/manager.go +++ b/runtime/v2/manager.go @@ -373,9 +373,22 @@ func (m *TaskManager) ID() string { // Create launches new shim instance and creates new task func (m *TaskManager) Create(ctx context.Context, taskID string, opts runtime.CreateOpts) (runtime.Task, error) { - process, err := m.manager.Start(ctx, taskID, opts) - if err != nil { - return nil, fmt.Errorf("failed to start shim: %w", err) + var ( + process ShimProcess + err error + ) + + if opts.SandboxID != "" { + // This container belongs to sandbox which supposed to be already started via sandbox API. + process, err = m.manager.Get(ctx, opts.SandboxID) + if err != nil { + return nil, fmt.Errorf("can't find sandbox %s", opts.SandboxID) + } + } else { + process, err = m.manager.Start(ctx, taskID, opts) + if err != nil { + return nil, fmt.Errorf("failed to start shim: %w", err) + } } // Cast to shim task and call task service to create a new container task instance. diff --git a/sandbox/controller.go b/sandbox/controller.go index 3bf77d154..b0c24953f 100644 --- a/sandbox/controller.go +++ b/sandbox/controller.go @@ -22,22 +22,22 @@ import ( "github.com/gogo/protobuf/types" ) -// Controller is an interface to manage a runtime sandbox instance (runtimes's SandboxManager) -// SandboxRuntime is responsible for the sandbox instances lifecycle management. +// Controller is an interface to manage sandboxes at runtime. // When running the traditional containerd shim, the workflow looks as follows: // For each new task we're about to run: -// 1. Invoke `shim_binary --start` to obtain `TaskService` address (printed in stdout) -// 2. Call TaskService.RunContainer(id=1) -// 3. Exec `shim_binary --delete` to stop shim -// 4. Exec `shim_binary --start` again to obtain another `TaskService` address -// 5. TaskService.RunContainer(id=2) -// 6. Exec `shim_binary --delete` to stop shim +// 1. Invoke `shim_binary --start` to obtain `TaskService` address (printed in stdout) +// 2. Call TaskService.RunContainer(id=1) +// 3. Exec `shim_binary --delete` to stop shim +// 4. Exec `shim_binary --start` again to obtain another `TaskService` address +// 5. TaskService.RunContainer(id=2) +// 6. Exec `shim_binary --delete` to stop shim // -// When running in sandbox mode, shim must implement `SandboxService`. In sandbox mode shim lifetimes are managed manually. -// 1. Client calls `client.Controller.Start()` to launch new shim and create sandbox process -// 2. Run containers with `shim.TaskService.RunContainer(id=1)` and another one `shim.TaskService.RunContainer(id=2)` -// 3. ... usual container lifecycle calls to `shim.TaskService` -// 4. Client calls shim to stop the sandbox with `client.SandboxService.Shutdown()` +// When running in sandbox mode, shim must implement `SandboxService`. +// In sandbox mode shim lifetimes are managed manually via sandbox API. +// 1. Client calls `client.SandboxController.Start()` to launch new shim and create sandbox process +// 2. Run containers with `shim.TaskService.RunContainer(id=1)` and another one `shim.TaskService.RunContainer(id=2)` +// 3. ... usual container lifecycle calls to `shim.TaskService` +// 4. Client calls shim to stop the sandbox with `client.SandboxService.Shutdown()` // 5. Shim implementation will perform cleanup similar to regular task service (e.g. shutdown, clean, and `shim_binary --delete`) type Controller interface { // Start will start new sandbox instance. diff --git a/services/tasks/local.go b/services/tasks/local.go index f57748ff5..8e7ac4933 100644 --- a/services/tasks/local.go +++ b/services/tasks/local.go @@ -200,6 +200,7 @@ func (l *local) Create(ctx context.Context, r *api.CreateTaskRequest, _ ...grpc. Runtime: container.Runtime.Name, RuntimeOptions: container.Runtime.Options, TaskOptions: r.Options, + SandboxID: container.SandboxID, } if r.RuntimePath != "" { opts.Runtime = r.RuntimePath From 17a2aaded39803161245608b3e32e7a153230158 Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Wed, 24 Nov 2021 10:58:48 -0800 Subject: [PATCH 13/22] [sandbox] Add ctr support Signed-off-by: Maksym Pavlenko --- cmd/ctr/app/main.go | 2 + cmd/ctr/commands/sandboxes/sandboxes.go | 196 ++++++++++++++++++++++++ metadata/sandbox.go | 3 +- runtime/v2/bundle.go | 21 ++- runtime/v2/bundle_linux_test.go | 5 +- runtime/v2/manager.go | 2 +- sandbox.go | 33 +++- sandbox/helpers.go | 1 + 8 files changed, 249 insertions(+), 14 deletions(-) create mode 100644 cmd/ctr/commands/sandboxes/sandboxes.go diff --git a/cmd/ctr/app/main.go b/cmd/ctr/app/main.go index 4beb24ba1..f2a352f1a 100644 --- a/cmd/ctr/app/main.go +++ b/cmd/ctr/app/main.go @@ -31,6 +31,7 @@ import ( "github.com/containerd/containerd/cmd/ctr/commands/plugins" "github.com/containerd/containerd/cmd/ctr/commands/pprof" "github.com/containerd/containerd/cmd/ctr/commands/run" + "github.com/containerd/containerd/cmd/ctr/commands/sandboxes" "github.com/containerd/containerd/cmd/ctr/commands/snapshots" "github.com/containerd/containerd/cmd/ctr/commands/tasks" versionCmd "github.com/containerd/containerd/cmd/ctr/commands/version" @@ -114,6 +115,7 @@ containerd CLI tasks.Command, install.Command, ociCmd.Command, + sandboxes.Command, }, extraCmds...) app.Before = func(context *cli.Context) error { if context.GlobalBool("debug") { diff --git a/cmd/ctr/commands/sandboxes/sandboxes.go b/cmd/ctr/commands/sandboxes/sandboxes.go new file mode 100644 index 000000000..73156f660 --- /dev/null +++ b/cmd/ctr/commands/sandboxes/sandboxes.go @@ -0,0 +1,196 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package sandboxes + +import ( + "fmt" + "os" + "text/tabwriter" + + "github.com/containerd/containerd" + "github.com/containerd/containerd/cmd/ctr/commands" + "github.com/containerd/containerd/defaults" + "github.com/containerd/containerd/log" + "github.com/containerd/containerd/oci" + "github.com/urfave/cli" +) + +// Command is a set of subcommands to manage runtimes with sandbox support +var Command = cli.Command{ + Name: "sandboxes", + Aliases: []string{"sandbox", "sb", "s"}, + Usage: "manage sandboxes", + Subcommands: cli.Commands{ + runCommand, + listCommand, + removeCommand, + pingCommand, + }, +} + +var runCommand = cli.Command{ + Name: "run", + Aliases: []string{"create", "c", "r"}, + Usage: "run a new sandbox", + ArgsUsage: "[flags] ", + Flags: []cli.Flag{ + cli.StringFlag{ + Name: "runtime", + Usage: "runtime name", + Value: defaults.DefaultRuntime, + }, + }, + Action: func(context *cli.Context) error { + var ( + id = context.Args().Get(0) + runtime = context.String("runtime") + ) + + client, ctx, cancel, err := commands.NewClient(context) + if err != nil { + return err + } + defer cancel() + + sandbox, err := client.NewSandbox(ctx, id, + containerd.WithSandboxRuntime(runtime, nil), + containerd.WithSandboxSpec(&oci.Spec{}), + ) + if err != nil { + return fmt.Errorf("failed to create new sandbox: %w", err) + } + + err = sandbox.Start(ctx) + if err != nil { + return fmt.Errorf("failed to start: %w", err) + } + + fmt.Println(sandbox.ID()) + return nil + }, +} + +var listCommand = cli.Command{ + Name: "list", + Aliases: []string{"ls"}, + Usage: "list sandboxes", + Flags: []cli.Flag{ + cli.StringSliceFlag{ + Name: "filters", + Usage: "the list of filters to apply when querying sandboxes from the store", + }, + }, + Action: func(context *cli.Context) error { + client, ctx, cancel, err := commands.NewClient(context) + if err != nil { + return err + } + defer cancel() + + var ( + writer = tabwriter.NewWriter(os.Stdout, 1, 8, 1, ' ', 0) + filters = context.StringSlice("filters") + ) + + defer func() { + _ = writer.Flush() + }() + + list, err := client.SandboxStore().List(ctx, filters...) + if err != nil { + return fmt.Errorf("failed to list sandboxes: %w", err) + } + + if _, err := fmt.Fprintln(writer, "ID\tCREATED\tRUNTIME\t"); err != nil { + return err + } + + for _, sandbox := range list { + _, err := fmt.Fprintf(writer, "%s\t%s\t%s\t\n", sandbox.ID, sandbox.CreatedAt, sandbox.Runtime.Name) + if err != nil { + return err + } + } + + return nil + }, +} + +var removeCommand = cli.Command{ + Name: "remove", + Aliases: []string{"rm"}, + ArgsUsage: " [, ...]", + Usage: "remove sandboxes", + Flags: []cli.Flag{ + cli.BoolFlag{ + Name: "force, f", + Usage: "ignore shutdown errors when removing sandbox", + }, + }, + Action: func(context *cli.Context) error { + client, ctx, cancel, err := commands.NewClient(context) + if err != nil { + return err + } + defer cancel() + + for _, id := range context.Args() { + sandbox, err := client.LoadSandbox(ctx, id) + if err != nil { + log.G(ctx).WithError(err).Errorf("failed to load sandbox %s", id) + continue + } + + err = sandbox.Shutdown(ctx, context.Bool("force")) + if err != nil { + log.G(ctx).WithError(err).Errorf("failed to shutdown sandbox %s", id) + continue + } + + log.G(ctx).Infof("deleted: %s", id) + } + + return nil + }, +} + +var pingCommand = cli.Command{ + Name: "ping", + ArgsUsage: " [, ...]", + Usage: "ping sandbox", + Action: func(context *cli.Context) error { + client, ctx, cancel, err := commands.NewClient(context) + if err != nil { + return err + } + defer cancel() + + for _, id := range context.Args() { + sandbox, err := client.LoadSandbox(ctx, id) + if err != nil { + return fmt.Errorf("failed to load sandbox %s: %w", id, err) + } + + err = sandbox.Ping(ctx) + if err != nil { + return fmt.Errorf("failed to ping %s: %w", id, err) + } + } + + return nil + }, +} diff --git a/metadata/sandbox.go b/metadata/sandbox.go index ecff782cd..bcdfce8a3 100644 --- a/metadata/sandbox.go +++ b/metadata/sandbox.go @@ -202,7 +202,8 @@ func (s *sandboxStore) List(ctx context.Context, fields ...string) ([]api.Sandbo if err := view(ctx, s.db, func(tx *bbolt.Tx) error { bucket := getSandboxBucket(tx, ns) if bucket == nil { - return errors.Wrap(errdefs.ErrNotFound, "no sandbox buckets") + // We haven't created any sandboxes yet, just return empty list + return nil } if err := bucket.ForEach(func(k, v []byte) error { diff --git a/runtime/v2/bundle.go b/runtime/v2/bundle.go index 8152a5277..8282d540b 100644 --- a/runtime/v2/bundle.go +++ b/runtime/v2/bundle.go @@ -25,6 +25,8 @@ import ( "github.com/containerd/containerd/identifiers" "github.com/containerd/containerd/mount" "github.com/containerd/containerd/namespaces" + "github.com/containerd/typeurl" + "github.com/opencontainers/runtime-spec/specs-go" ) const configFilename = "config.json" @@ -43,7 +45,7 @@ func LoadBundle(ctx context.Context, root, id string) (*Bundle, error) { } // NewBundle returns a new bundle on disk -func NewBundle(ctx context.Context, root, state, id string, spec []byte) (b *Bundle, err error) { +func NewBundle(ctx context.Context, root, state, id string, spec typeurl.Any) (b *Bundle, err error) { if err := identifiers.Validate(id); err != nil { return nil, fmt.Errorf("invalid task id %s: %w", id, err) } @@ -73,8 +75,10 @@ func NewBundle(ctx context.Context, root, state, id string, spec []byte) (b *Bun if err := os.Mkdir(b.Path, 0700); err != nil { return nil, err } - if err := prepareBundleDirectoryPermissions(b.Path, spec); err != nil { - return nil, err + if typeurl.Is(spec, &specs.Spec{}) { + if err := prepareBundleDirectoryPermissions(b.Path, spec.GetValue()); err != nil { + return nil, err + } } paths = append(paths, b.Path) // create working directory for the bundle @@ -100,9 +104,14 @@ func NewBundle(ctx context.Context, root, state, id string, spec []byte) (b *Bun if err := os.Symlink(work, filepath.Join(b.Path, "work")); err != nil { return nil, err } - // write the spec to the bundle - err = os.WriteFile(filepath.Join(b.Path, configFilename), spec, 0666) - return b, err + if spec := spec.GetValue(); spec != nil { + // write the spec to the bundle + err = os.WriteFile(filepath.Join(b.Path, configFilename), spec, 0666) + if err != nil { + return nil, fmt.Errorf("failed to write %s", configFilename) + } + } + return b, nil } // Bundle represents an OCI bundle diff --git a/runtime/v2/bundle_linux_test.go b/runtime/v2/bundle_linux_test.go index 685dc2fbf..f34859453 100644 --- a/runtime/v2/bundle_linux_test.go +++ b/runtime/v2/bundle_linux_test.go @@ -29,6 +29,7 @@ import ( "github.com/containerd/containerd/namespaces" "github.com/containerd/containerd/oci" "github.com/containerd/containerd/pkg/testutil" + "github.com/containerd/typeurl" "github.com/opencontainers/runtime-spec/specs-go" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -57,11 +58,11 @@ func TestNewBundle(t *testing.T) { GIDMappings: []specs.LinuxIDMapping{{ContainerID: 0, HostID: usernsGID}}, } } - specBytes, err := json.Marshal(&spec) + specAny, err := typeurl.MarshalAny(&spec) require.NoError(t, err, "failed to marshal spec") ctx := namespaces.WithNamespace(context.TODO(), namespaces.Default) - b, err := NewBundle(ctx, work, state, id, specBytes) + b, err := NewBundle(ctx, work, state, id, specAny) require.NoError(t, err, "NewBundle should succeed") require.NotNil(t, b, "bundle should not be nil") diff --git a/runtime/v2/manager.go b/runtime/v2/manager.go index 51c6df616..b7bd9bf95 100644 --- a/runtime/v2/manager.go +++ b/runtime/v2/manager.go @@ -158,7 +158,7 @@ func (m *ShimManager) ID() string { // Start launches a new shim instance func (m *ShimManager) Start(ctx context.Context, id string, opts runtime.CreateOpts) (_ ShimProcess, retErr error) { - bundle, err := NewBundle(ctx, m.root, m.state, id, opts.Spec.GetValue()) + bundle, err := NewBundle(ctx, m.root, m.state, id, opts.Spec) if err != nil { return nil, err } diff --git a/sandbox.go b/sandbox.go index 6c30906f5..805002aff 100644 --- a/sandbox.go +++ b/sandbox.go @@ -18,6 +18,7 @@ package containerd import ( "context" + "fmt" "time" api "github.com/containerd/containerd/sandbox" @@ -36,8 +37,9 @@ type Sandbox interface { Labels(ctx context.Context) (map[string]string, error) // Start starts new sandbox instance Start(ctx context.Context) error - // Shutdown will turn down existing sandbox instance - Shutdown(ctx context.Context) error + // Shutdown will turn down existing sandbox instance. + // If using force, the client will ignore shutdown errors. + Shutdown(ctx context.Context, force bool) error // Pause will freeze running sandbox instance Pause(ctx context.Context) error // Resume will unfreeze previously paused sandbox instance @@ -74,8 +76,23 @@ func (s *sandboxClient) Start(ctx context.Context) error { return s.client.SandboxController().Start(ctx, s.ID()) } -func (s *sandboxClient) Shutdown(ctx context.Context) error { - return s.client.SandboxController().Shutdown(ctx, s.ID()) +func (s *sandboxClient) Shutdown(ctx context.Context, force bool) error { + var ( + controller = s.client.SandboxController() + store = s.client.SandboxStore() + ) + + err := controller.Shutdown(ctx, s.ID()) + if err != nil && !force { + return fmt.Errorf("failed to shutdown sandbox: %w", err) + } + + err = store.Delete(ctx, s.ID()) + if err != nil { + return fmt.Errorf("failed to delete sandbox from metadata store: %w", err) + } + + return nil } func (s *sandboxClient) Pause(ctx context.Context) error { @@ -105,6 +122,10 @@ func (s *sandboxClient) Status(ctx context.Context, status interface{}) error { // NewSandbox creates new sandbox client func (c *Client) NewSandbox(ctx context.Context, sandboxID string, opts ...NewSandboxOpts) (Sandbox, error) { + if sandboxID == "" { + return nil, errors.New("sandbox ID must be specified") + } + newSandbox := api.Sandbox{ ID: sandboxID, CreatedAt: time.Now().UTC(), @@ -147,6 +168,10 @@ type NewSandboxOpts func(ctx context.Context, client *Client, sandbox *api.Sandb // WithSandboxRuntime allows a user to specify the runtime to be used to run a sandbox func WithSandboxRuntime(name string, options interface{}) NewSandboxOpts { return func(ctx context.Context, client *Client, s *api.Sandbox) error { + if options == nil { + options = &types.Empty{} + } + opts, err := typeurl.MarshalAny(options) if err != nil { return errors.Wrap(err, "failed to marshal sandbox runtime options") diff --git a/sandbox/helpers.go b/sandbox/helpers.go index 9f155bf07..ad984e9e8 100644 --- a/sandbox/helpers.go +++ b/sandbox/helpers.go @@ -47,6 +47,7 @@ func FromProto(p *types.Sandbox) Sandbox { ID: p.SandboxID, Labels: p.Labels, Runtime: runtime, + Spec: p.Spec, CreatedAt: p.CreatedAt, UpdatedAt: p.UpdatedAt, Extensions: p.Extensions, From 35195737e7bbaa47b9c37cb06971fa1711990c40 Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Thu, 2 Dec 2021 11:50:38 -0800 Subject: [PATCH 14/22] [sandbox] Register shim plugin after #6301 Signed-off-by: Maksym Pavlenko --- runtime/v2/manager.go | 18 ++++++++++++++++++ services/sandbox/controller_local.go | 4 ++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/runtime/v2/manager.go b/runtime/v2/manager.go index b7bd9bf95..708310aeb 100644 --- a/runtime/v2/manager.go +++ b/runtime/v2/manager.go @@ -96,6 +96,24 @@ func init() { return NewTaskManager(shimManager), nil }, }) + + // Task manager uses shim manager as a dependency to manage shim instances. + // However, due to time limits and to avoid migration steps in 1.6 release, + // use the following workaround. + // This expected to be removed in 1.7. + plugin.Register(&plugin.Registration{ + Type: plugin.RuntimePluginV2, + ID: "shim", + InitFn: func(ic *plugin.InitContext) (interface{}, error) { + taskManagerI, err := ic.GetByID(plugin.RuntimePluginV2, "task") + if err != nil { + return nil, err + } + + taskManager := taskManagerI.(*TaskManager) + return taskManager.manager, nil + }, + }) } type ManagerConfig struct { diff --git a/services/sandbox/controller_local.go b/services/sandbox/controller_local.go index 968e04ba7..e01124bee 100644 --- a/services/sandbox/controller_local.go +++ b/services/sandbox/controller_local.go @@ -41,12 +41,12 @@ func init() { Type: plugin.ServicePlugin, ID: services.SandboxControllerService, Requires: []plugin.Type{ - plugin.RuntimeShimPlugin, + plugin.RuntimePluginV2, plugin.MetadataPlugin, plugin.EventPlugin, }, InitFn: func(ic *plugin.InitContext) (interface{}, error) { - shimPlugin, err := ic.Get(plugin.RuntimeShimPlugin) + shimPlugin, err := ic.GetByID(plugin.RuntimePluginV2, "shim") if err != nil { return nil, err } From fa02477ca9ac7d70aa44c0592743343d194aedf6 Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Thu, 2 Dec 2021 13:16:18 -0800 Subject: [PATCH 15/22] [sandbox] Add sandbox shim skeleton Signed-off-by: Maksym Pavlenko --- cmd/containerd-shim-runc-v2/main.go | 1 + runtime/v2/pause/sandbox.go | 84 +++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 runtime/v2/pause/sandbox.go diff --git a/cmd/containerd-shim-runc-v2/main.go b/cmd/containerd-shim-runc-v2/main.go index c94942e3a..24f84e835 100644 --- a/cmd/containerd-shim-runc-v2/main.go +++ b/cmd/containerd-shim-runc-v2/main.go @@ -22,6 +22,7 @@ package main import ( "context" + _ "github.com/containerd/containerd/runtime/v2/pause" "github.com/containerd/containerd/runtime/v2/runc/manager" _ "github.com/containerd/containerd/runtime/v2/runc/task/plugin" "github.com/containerd/containerd/runtime/v2/shim" diff --git a/runtime/v2/pause/sandbox.go b/runtime/v2/pause/sandbox.go new file mode 100644 index 000000000..c94ff44a5 --- /dev/null +++ b/runtime/v2/pause/sandbox.go @@ -0,0 +1,84 @@ +//go:build linux +// +build linux + +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package pause + +import ( + "context" + + "github.com/containerd/ttrpc" + log "github.com/sirupsen/logrus" + + "github.com/containerd/containerd/plugin" + api "github.com/containerd/containerd/runtime/v2/task" +) + +func init() { + plugin.Register(&plugin.Registration{ + Type: plugin.TTRPCPlugin, + ID: "pause", + InitFn: func(ic *plugin.InitContext) (interface{}, error) { + return &pauseService{}, nil + }, + }) +} + +// pauseService is an extension for task v2 runtime to support Pod "pause" containers via sandbox API. +type pauseService struct{} + +var _ api.SandboxService = (*pauseService)(nil) + +func (p *pauseService) RegisterTTRPC(server *ttrpc.Server) error { + api.RegisterSandboxService(server, p) + return nil +} + +func (p *pauseService) StartSandbox(ctx context.Context, req *api.StartSandboxRequest) (*api.StartSandboxResponse, error) { + log.Debugf("start sandbox request: %+v", req) + return &api.StartSandboxResponse{}, nil +} + +func (p *pauseService) StopSandbox(ctx context.Context, req *api.StopSandboxRequest) (*api.StopSandboxResponse, error) { + log.Debugf("stop sandbox request: %+v", req) + return &api.StopSandboxResponse{}, 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 +} + +func (p *pauseService) PauseSandbox(ctx context.Context, req *api.PauseSandboxRequest) (*api.PauseSandboxResponse, error) { + log.Debugf("pause sandbox request: %+v", req) + return &api.PauseSandboxResponse{}, nil +} + +func (p *pauseService) ResumeSandbox(ctx context.Context, req *api.ResumeSandboxRequest) (*api.ResumeSandboxResponse, error) { + log.Debugf("resume sandbox request: %+v", req) + return &api.ResumeSandboxResponse{}, nil +} + +func (p *pauseService) SandboxStatus(ctx context.Context, req *api.SandboxStatusRequest) (*api.SandboxStatusResponse, error) { + log.Debugf("sandbox status request: %+v", req) + return &api.SandboxStatusResponse{}, nil +} + +func (p *pauseService) PingSandbox(ctx context.Context, req *api.PingRequest) (*api.PingResponse, error) { + return &api.PingResponse{}, nil +} From 0c5e5c357979ac96d2997e13159c1ddfef3e414e Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Mon, 24 Jan 2022 13:10:58 -0800 Subject: [PATCH 16/22] Fix protobuf after rebase Signed-off-by: Maksym Pavlenko --- api/services/sandbox/v1/doc.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 api/services/sandbox/v1/doc.go diff --git a/api/services/sandbox/v1/doc.go b/api/services/sandbox/v1/doc.go new file mode 100644 index 000000000..f960350c1 --- /dev/null +++ b/api/services/sandbox/v1/doc.go @@ -0,0 +1,17 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package sandbox From 0d165e654407a7e55f1716cb07f907fbfaa241de Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Thu, 27 Jan 2022 14:00:42 -0800 Subject: [PATCH 17/22] Restore sandboxes on daemon restart Signed-off-by: Maksym Pavlenko --- api/next.pb.txt | 7 +++ api/services/containers/v1/containers.pb.go | 54 +++++++++++++++-- api/services/containers/v1/containers.proto | 3 + cmd/containerd-shim-runc-v2/main.go | 2 +- cmd/ctr/commands/sandboxes/sandboxes.go | 12 +++- containerstore.go | 2 + runtime/v2/manager.go | 64 +++++++++++++++------ runtime/v2/{ => runc}/pause/sandbox.go | 18 +++++- runtime/v2/shim.go | 10 +++- sandbox.go | 41 ++++++------- services/containers/helpers.go | 2 + services/sandbox/controller_local.go | 3 +- 12 files changed, 165 insertions(+), 53 deletions(-) rename runtime/v2/{ => runc}/pause/sandbox.go (88%) diff --git a/api/next.pb.txt b/api/next.pb.txt index a670015bd..efaeb9930 100644 --- a/api/next.pb.txt +++ b/api/next.pb.txt @@ -928,6 +928,13 @@ file { } json_name: "extensions" } + field { + name: "sandbox" + number: 11 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "sandbox" + } nested_type { name: "LabelsEntry" field { diff --git a/api/services/containers/v1/containers.pb.go b/api/services/containers/v1/containers.pb.go index e2319a66a..47af85b4a 100644 --- a/api/services/containers/v1/containers.pb.go +++ b/api/services/containers/v1/containers.pb.go @@ -81,10 +81,12 @@ type Container struct { // that should be unique against other extensions. When updating extension // data, one should only update the specified extension using field paths // to select a specific map key. - Extensions map[string]types.Any `protobuf:"bytes,10,rep,name=extensions,proto3" json:"extensions" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Extensions map[string]types.Any `protobuf:"bytes,10,rep,name=extensions,proto3" json:"extensions" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // Sandbox ID this container belongs to. + Sandbox string `protobuf:"bytes,11,opt,name=sandbox,proto3" json:"sandbox,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Container) Reset() { *m = Container{} } @@ -960,6 +962,13 @@ func (m *Container) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + if len(m.Sandbox) > 0 { + i -= len(m.Sandbox) + copy(dAtA[i:], m.Sandbox) + i = encodeVarintContainers(dAtA, i, uint64(len(m.Sandbox))) + i-- + dAtA[i] = 0x5a + } if len(m.Extensions) > 0 { for k := range m.Extensions { v := m.Extensions[k] @@ -1563,6 +1572,10 @@ func (m *Container) Size() (n int) { n += mapEntrySize + 1 + sovContainers(uint64(mapEntrySize)) } } + l = len(m.Sandbox) + if l > 0 { + n += 1 + l + sovContainers(uint64(l)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -1788,6 +1801,7 @@ func (this *Container) String() string { `CreatedAt:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.CreatedAt), "Timestamp", "types.Timestamp", 1), `&`, ``, 1) + `,`, `UpdatedAt:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.UpdatedAt), "Timestamp", "types.Timestamp", 1), `&`, ``, 1) + `,`, `Extensions:` + mapStringForExtensions + `,`, + `Sandbox:` + fmt.Sprintf("%v", this.Sandbox) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") @@ -2480,6 +2494,38 @@ func (m *Container) Unmarshal(dAtA []byte) error { } m.Extensions[mapkey] = *mapvalue iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sandbox", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContainers + } + 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 ErrInvalidLengthContainers + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthContainers + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sandbox = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipContainers(dAtA[iNdEx:]) diff --git a/api/services/containers/v1/containers.proto b/api/services/containers/v1/containers.proto index 8b51e3393..28bc5628d 100644 --- a/api/services/containers/v1/containers.proto +++ b/api/services/containers/v1/containers.proto @@ -114,6 +114,9 @@ message Container { // data, one should only update the specified extension using field paths // to select a specific map key. map extensions = 10 [(gogoproto.nullable) = false]; + + // Sandbox ID this container belongs to. + string sandbox = 11; } message GetContainerRequest { diff --git a/cmd/containerd-shim-runc-v2/main.go b/cmd/containerd-shim-runc-v2/main.go index 24f84e835..c5454bba3 100644 --- a/cmd/containerd-shim-runc-v2/main.go +++ b/cmd/containerd-shim-runc-v2/main.go @@ -22,8 +22,8 @@ package main import ( "context" - _ "github.com/containerd/containerd/runtime/v2/pause" "github.com/containerd/containerd/runtime/v2/runc/manager" + _ "github.com/containerd/containerd/runtime/v2/runc/pause" _ "github.com/containerd/containerd/runtime/v2/runc/task/plugin" "github.com/containerd/containerd/runtime/v2/shim" ) diff --git a/cmd/ctr/commands/sandboxes/sandboxes.go b/cmd/ctr/commands/sandboxes/sandboxes.go index 73156f660..9d1935bf3 100644 --- a/cmd/ctr/commands/sandboxes/sandboxes.go +++ b/cmd/ctr/commands/sandboxes/sandboxes.go @@ -148,6 +148,8 @@ var removeCommand = cli.Command{ } defer cancel() + force := context.Bool("force") + for _, id := range context.Args() { sandbox, err := client.LoadSandbox(ctx, id) if err != nil { @@ -155,7 +157,15 @@ var removeCommand = cli.Command{ continue } - err = sandbox.Shutdown(ctx, context.Bool("force")) + err = sandbox.Stop(ctx) + if err != nil { + log.G(ctx).WithError(err).Errorf("failed to stop sandbox %s", id) + if !force { + continue + } + } + + err = sandbox.Delete(ctx) if err != nil { log.G(ctx).WithError(err).Errorf("failed to shutdown sandbox %s", id) continue diff --git a/containerstore.go b/containerstore.go index 2a154e265..a9a82a2f5 100644 --- a/containerstore.go +++ b/containerstore.go @@ -166,6 +166,7 @@ func containerToProto(container *containers.Container) containersapi.Container { Snapshotter: container.Snapshotter, SnapshotKey: container.SnapshotKey, Extensions: extensions, + Sandbox: container.SandboxID, } } @@ -193,6 +194,7 @@ func containerFromProto(containerpb *containersapi.Container) containers.Contain CreatedAt: containerpb.CreatedAt, UpdatedAt: containerpb.UpdatedAt, Extensions: extensions, + SandboxID: containerpb.Sandbox, } } diff --git a/runtime/v2/manager.go b/runtime/v2/manager.go index 708310aeb..3ff177512 100644 --- a/runtime/v2/manager.go +++ b/runtime/v2/manager.go @@ -186,6 +186,40 @@ func (m *ShimManager) Start(ctx context.Context, id string, opts runtime.CreateO } }() + // This container belongs to sandbox which supposed to be already started via sandbox API. + if opts.SandboxID != "" { + process, err := m.Get(ctx, opts.SandboxID) + if err != nil { + return nil, fmt.Errorf("can't find sandbox %s", opts.SandboxID) + } + + // Write sandbox ID this task belongs to. + if err := os.WriteFile(filepath.Join(bundle.Path, "sandbox"), []byte(opts.SandboxID), 0600); err != nil { + return nil, err + } + + address, err := shimbinary.ReadAddress(filepath.Join(m.state, process.Namespace(), opts.SandboxID, "address")) + if err != nil { + return nil, fmt.Errorf("failed to get socket address for sandbox %q: %w", opts.SandboxID, err) + } + + // Use sandbox's socket address to handle task requests for this container. + if err := shimbinary.WriteAddress(filepath.Join(bundle.Path, "address"), address); err != nil { + return nil, err + } + + shim, err := loadShim(ctx, bundle, func() {}) + if err != nil { + return nil, fmt.Errorf("failed to load sandbox task %q: %w", opts.SandboxID, err) + } + + if err := m.shims.Add(ctx, shim); err != nil { + return nil, err + } + + return shim, nil + } + shim, err := m.startShim(ctx, bundle, id, opts) if err != nil { return nil, err @@ -391,22 +425,9 @@ func (m *TaskManager) ID() string { // Create launches new shim instance and creates new task func (m *TaskManager) Create(ctx context.Context, taskID string, opts runtime.CreateOpts) (runtime.Task, error) { - var ( - process ShimProcess - err error - ) - - if opts.SandboxID != "" { - // This container belongs to sandbox which supposed to be already started via sandbox API. - process, err = m.manager.Get(ctx, opts.SandboxID) - if err != nil { - return nil, fmt.Errorf("can't find sandbox %s", opts.SandboxID) - } - } else { - process, err = m.manager.Start(ctx, taskID, opts) - if err != nil { - return nil, fmt.Errorf("failed to start shim: %w", err) - } + process, err := m.manager.Start(ctx, taskID, opts) + if err != nil { + return nil, fmt.Errorf("failed to start shim: %w", err) } // Cast to shim task and call task service to create a new container task instance. @@ -420,7 +441,8 @@ func (m *TaskManager) Create(ctx context.Context, taskID string, opts runtime.Cr dctx, cancel := timeout.WithContext(context.Background(), cleanupTimeout) defer cancel() - _, errShim := shim.delete(dctx, func(context.Context, string) {}) + sandboxed := opts.SandboxID != "" + _, errShim := shim.delete(dctx, sandboxed, func(context.Context, string) {}) if errShim != nil { if errdefs.IsDeadlineExceeded(errShim) { dctx, cancel = timeout.WithContext(context.Background(), cleanupTimeout) @@ -454,8 +476,14 @@ func (m *TaskManager) Delete(ctx context.Context, taskID string) (*runtime.Exit, return nil, err } + container, err := m.manager.containers.Get(ctx, taskID) + if err != nil { + return nil, err + } + + sandboxed := container.SandboxID != "" shimTask := item.(*shimTask) - exit, err := shimTask.delete(ctx, func(ctx context.Context, id string) { + exit, err := shimTask.delete(ctx, sandboxed, func(ctx context.Context, id string) { m.manager.shims.Delete(ctx, id) }) diff --git a/runtime/v2/pause/sandbox.go b/runtime/v2/runc/pause/sandbox.go similarity index 88% rename from runtime/v2/pause/sandbox.go rename to runtime/v2/runc/pause/sandbox.go index c94ff44a5..dc08c33bb 100644 --- a/runtime/v2/pause/sandbox.go +++ b/runtime/v2/runc/pause/sandbox.go @@ -22,6 +22,7 @@ package pause import ( "context" + "github.com/containerd/containerd/pkg/shutdown" "github.com/containerd/ttrpc" log "github.com/sirupsen/logrus" @@ -33,14 +34,26 @@ func init() { plugin.Register(&plugin.Registration{ Type: plugin.TTRPCPlugin, ID: "pause", + Requires: []plugin.Type{ + plugin.InternalPlugin, + }, InitFn: func(ic *plugin.InitContext) (interface{}, error) { - return &pauseService{}, nil + ss, err := ic.GetByID(plugin.InternalPlugin, "shutdown") + if err != nil { + return nil, err + } + + return &pauseService{ + shutdown: ss.(shutdown.Service), + }, nil }, }) } // pauseService is an extension for task v2 runtime to support Pod "pause" containers via sandbox API. -type pauseService struct{} +type pauseService struct { + shutdown shutdown.Service +} var _ api.SandboxService = (*pauseService)(nil) @@ -56,6 +69,7 @@ func (p *pauseService) StartSandbox(ctx context.Context, req *api.StartSandboxRe func (p *pauseService) StopSandbox(ctx context.Context, req *api.StopSandboxRequest) (*api.StopSandboxResponse, error) { log.Debugf("stop sandbox request: %+v", req) + p.shutdown.Shutdown() return &api.StopSandboxResponse{}, nil } diff --git a/runtime/v2/shim.go b/runtime/v2/shim.go index 037d64c9d..3c8e2b9a2 100644 --- a/runtime/v2/shim.go +++ b/runtime/v2/shim.go @@ -277,7 +277,7 @@ func (s *shimTask) PID(ctx context.Context) (uint32, error) { return response.TaskPid, nil } -func (s *shimTask) delete(ctx context.Context, removeTask func(ctx context.Context, id string)) (*runtime.Exit, error) { +func (s *shimTask) delete(ctx context.Context, sandboxed bool, removeTask func(ctx context.Context, id string)) (*runtime.Exit, error) { response, shimErr := s.task.Delete(ctx, &task.DeleteRequest{ ID: s.ID(), }) @@ -305,8 +305,12 @@ func (s *shimTask) delete(ctx context.Context, removeTask func(ctx context.Conte removeTask(ctx, s.ID()) } - if err := s.waitShutdown(ctx); err != nil { - log.G(ctx).WithField("id", s.ID()).WithError(err).Error("failed to shutdown shim task") + // Don't shutdown sandbox as there may be other containers running. + // Let controller decide when to shutdown. + if !sandboxed { + if err := s.waitShutdown(ctx); err != nil { + log.G(ctx).WithField("id", s.ID()).WithError(err).Error("failed to shutdown shim task") + } } if err := s.shim.delete(ctx); err != nil { diff --git a/sandbox.go b/sandbox.go index 805002aff..c3795649f 100644 --- a/sandbox.go +++ b/sandbox.go @@ -18,9 +18,10 @@ package containerd import ( "context" - "fmt" "time" + "github.com/containerd/containerd/containers" + "github.com/containerd/containerd/oci" api "github.com/containerd/containerd/sandbox" "github.com/containerd/typeurl" "github.com/gogo/protobuf/types" @@ -37,9 +38,10 @@ type Sandbox interface { Labels(ctx context.Context) (map[string]string, error) // Start starts new sandbox instance Start(ctx context.Context) error - // Shutdown will turn down existing sandbox instance. - // If using force, the client will ignore shutdown errors. - Shutdown(ctx context.Context, force bool) error + // Stop sends stop request to the shim instance. + Stop(ctx context.Context) 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 @@ -76,23 +78,12 @@ func (s *sandboxClient) Start(ctx context.Context) error { return s.client.SandboxController().Start(ctx, s.ID()) } -func (s *sandboxClient) Shutdown(ctx context.Context, force bool) error { - var ( - controller = s.client.SandboxController() - store = s.client.SandboxStore() - ) +func (s *sandboxClient) Stop(ctx context.Context) error { + return s.client.SandboxController().Shutdown(ctx, s.ID()) +} - err := controller.Shutdown(ctx, s.ID()) - if err != nil && !force { - return fmt.Errorf("failed to shutdown sandbox: %w", err) - } - - err = store.Delete(ctx, s.ID()) - if err != nil { - return fmt.Errorf("failed to delete sandbox from metadata store: %w", err) - } - - return nil +func (s *sandboxClient) Delete(ctx context.Context) error { + return s.client.SandboxStore().Delete(ctx, s.ID()) } func (s *sandboxClient) Pause(ctx context.Context) error { @@ -187,9 +178,15 @@ func WithSandboxRuntime(name string, options interface{}) NewSandboxOpts { } // WithSandboxSpec will provide the sandbox runtime spec -func WithSandboxSpec(spec interface{}) NewSandboxOpts { +func WithSandboxSpec(s *oci.Spec, opts ...oci.SpecOpts) NewSandboxOpts { return func(ctx context.Context, client *Client, sandbox *api.Sandbox) error { - spec, err := typeurl.MarshalAny(spec) + c := &containers.Container{ID: sandbox.ID} + + if err := oci.ApplyOpts(ctx, client, c, s, opts...); err != nil { + return err + } + + spec, err := typeurl.MarshalAny(s) if err != nil { return errors.Wrap(err, "failed to marshal spec") } diff --git a/services/containers/helpers.go b/services/containers/helpers.go index a75d5d62b..ceb2ca5dd 100644 --- a/services/containers/helpers.go +++ b/services/containers/helpers.go @@ -54,6 +54,7 @@ func containerToProto(container *containers.Container) api.Container { CreatedAt: container.CreatedAt, UpdatedAt: container.UpdatedAt, Extensions: extensions, + Sandbox: container.SandboxID, } } @@ -79,5 +80,6 @@ func containerFromProto(containerpb *api.Container) containers.Container { Snapshotter: containerpb.Snapshotter, SnapshotKey: containerpb.SnapshotKey, Extensions: extensions, + SandboxID: containerpb.Sandbox, } } diff --git a/services/sandbox/controller_local.go b/services/sandbox/controller_local.go index e01124bee..0fd448fac 100644 --- a/services/sandbox/controller_local.go +++ b/services/sandbox/controller_local.go @@ -109,8 +109,7 @@ func (c *controllerLocal) Start(ctx context.Context, in *api.ControllerStartRequ svc := task.NewSandboxClient(shim.Client()) _, err = svc.StartSandbox(ctx, &proto.StartSandboxRequest{ - SandboxID: in.SandboxID, - BundlePath: "", + SandboxID: in.SandboxID, }) if err != nil { From b7a36950f65826a046413f8aa9ec93307fb274f4 Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Wed, 9 Feb 2022 12:52:37 -0800 Subject: [PATCH 18/22] [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, 0x90, - 0x16, 0x96, 0x88, 0xa0, 0x07, 0x75, 0x41, 0x16, 0x12, 0x13, 0xc9, 0x6e, 0x4c, 0x0c, 0x17, 0xd3, - 0xdd, 0x0e, 0xa5, 0xb1, 0x74, 0xba, 0x9d, 0x29, 0x42, 0xbc, 0xe8, 0xaf, 0xf2, 0x2f, 0x70, 0xf4, - 0xe8, 0x89, 0xc8, 0xfe, 0x07, 0xef, 0x66, 0xa7, 0x53, 0xda, 0xca, 0x46, 0xdb, 0xe2, 0x6d, 0xba, - 0x7d, 0xde, 0xe7, 0x63, 0x78, 0xf7, 0x61, 0x61, 0xc7, 0x71, 0xd9, 0x51, 0xd4, 0x37, 0x06, 0xe4, - 0xd8, 0x1c, 0x10, 0x9f, 0x59, 0xae, 0x8f, 0x43, 0x3b, 0x7b, 0xb4, 0x02, 0xd7, 0xa4, 0x38, 0x3c, - 0x71, 0x07, 0x98, 0x9a, 0xd4, 0xf2, 0xed, 0x3e, 0x39, 0x35, 0x4f, 0x56, 0x93, 0xa3, 0x11, 0x84, - 0x84, 0x11, 0xa4, 0xa5, 0x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x8f, 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, 0x52, 0x7c, 0xaa, + 0xd0, 0xca, 0xde, 0xa6, 0xa2, 0xec, 0xc2, 0x01, 0x9a, 0x2d, 0x5b, 0x2a, 0x81, 0xa8, 0x1c, 0x10, + 0xb0, 0x97, 0xca, 0x8d, 0xa7, 0xa9, 0x45, 0xe2, 0x71, 0x3c, 0xe3, 0x92, 0x0a, 0x0e, 0xf0, 0x0f, + 0xf8, 0x17, 0xfc, 0x04, 0xfe, 0x42, 0x8f, 0x1c, 0x39, 0x15, 0x36, 0x47, 0xc4, 0x8f, 0x40, 0x9e, + 0x19, 0xd7, 0x76, 0x13, 0x15, 0xdb, 0xdd, 0xdb, 0xcc, 0xf8, 0xbd, 0xef, 0x7d, 0xef, 0xcd, 0x9b, + 0xf7, 0x25, 0xf0, 0x62, 0xe8, 0xb1, 0xf3, 0xe8, 0xd4, 0x1c, 0x90, 0xb1, 0x35, 0x20, 0x3e, 0x73, + 0x3c, 0x1f, 0x87, 0x6e, 0x76, 0xe9, 0x04, 0x9e, 0x45, 0x71, 0x78, 0xe1, 0x0d, 0x30, 0xb5, 0xa8, + 0xe3,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xb6, 0xe8, 0x4f, 0xcb, 0x3b, 0xa6, + 0xd5, 0x8e, 0x47, 0x7f, 0x99, 0x6a, 0x67, 0x14, 0xa7, 0x4c, 0xb5, 0xb3, 0x0a, 0x13, 0xe7, 0x2c, + 0x87, 0x74, 0xb9, 0x5e, 0x4d, 0x95, 0xa8, 0x4c, 0xce, 0x79, 0xe1, 0xe9, 0xbd, 0xbc, 0x7a, 0xd5, + 0x5e, 0xfa, 0xf3, 0x55, 0x7b, 0xe9, 0xe7, 0x59, 0x5b, 0xb9, 0x9a, 0xb5, 0x95, 0x3f, 0x66, 0x6d, + 0xe5, 0xef, 0x59, 0x5b, 0x79, 0xf9, 0x49, 0xd5, 0xbf, 0x97, 0x1f, 0xc9, 0xe5, 0xb7, 0xb5, 0x53, + 0x95, 0x6b, 0xc3, 0xee, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x89, 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, 0x0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, 0x0c, 0xd5, 0xe2, 0xea, 0xa1, - 0x13, 0x5d, 0xa4, 0x34, 0x9f, 0x00, 0xbb, 0x7d, 0x3f, 0x50, 0x75, 0xfa, 0x19, 0xcc, 0xc2, 0x32, - 0xa1, 0x97, 0xfa, 0x87, 0xdb, 0x4b, 0x6d, 0x9f, 0xdc, 0x8b, 0x53, 0xfc, 0x11, 0xd4, 0x36, 0xd2, - 0x87, 0xda, 0x0f, 0x5d, 0x0b, 0xfb, 0xd5, 0x03, 0x90, 0x4a, 0x05, 0x43, 0xb5, 0x98, 0x1f, 0xbd, - 0x51, 0x9a, 0x98, 0xea, 0x8d, 0xd2, 0x45, 0x31, 0x6f, 0x64, 0x23, 0x44, 0xfa, 0x46, 0x74, 0x69, - 0xd5, 0x37, 0xa2, 0x4d, 0x64, 0xae, 0xb2, 0x91, 0x48, 0xbd, 0x8a, 0x6e, 0x6d, 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, 0x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83, 0x28, 0xac, 0x1b, 0x4d, 0xa3, 0x55, 0xea, 0x56, + 0x66, 0x77, 0x4e, 0x49, 0xe1, 0xce, 0x4e, 0x83, 0x92, 0x02, 0x9c, 0x85, 0xc8, 0x01, 0x6b, 0x98, + 0xc5, 0xe1, 0x15, 0x19, 0x24, 0x98, 0x5f, 0xd4, 0x4d, 0x01, 0x0f, 0x40, 0x5e, 0xf5, 0x30, 0xbf, + 0x40, 0x3e, 0x14, 0x53, 0x4a, 0xf9, 0x39, 0xab, 0x17, 0x9a, 0x85, 0x96, 0xd5, 0x3e, 0xf2, 0xf2, + 0xaa, 0x88, 0xac, 0xbc, 0xef, 0x45, 0x56, 0x81, 0x82, 0x21, 0x0f, 0x76, 0x69, 0xc2, 0x23, 0x1a, + 0xb3, 0xfa, 0x76, 0xd3, 0x68, 0x59, 0xed, 0xaa, 0x27, 0x85, 0xf1, 0x16, 0xc2, 0x78, 0x9d, 0x78, + 0x1a, 0x2c, 0x40, 0x6e, 0x0b, 0xaa, 0xab, 0x65, 0xb0, 0x84, 0xc6, 0x8c, 0xa0, 0x7d, 0x28, 0x24, + 0xaa, 0x80, 0x4a, 0x20, 0x8e, 0x2e, 0x01, 0xd4, 0xe7, 0x34, 0xd9, 0xa8, 0xde, 0x8f, 0xa0, 0x2c, + 0xda, 0x42, 0x33, 0x3e, 0x60, 0x64, 0xc4, 0xe6, 0x05, 0x57, 0x02, 0x4b, 0xdd, 0xf5, 0xc9, 0x88, + 0xb9, 0x35, 0xa1, 0x6b, 0x2e, 0x8c, 0xcc, 0xc7, 0xfd, 0xcb, 0x84, 0xea, 0x8f, 0x49, 0x88, 0x39, + 0xd9, 0x28, 0x81, 0x36, 0x94, 0x52, 0xc2, 0x68, 0x96, 0x8e, 0x88, 0x8c, 0xfe, 0x94, 0x40, 0x4b, + 0x18, 0xfa, 0x05, 0x2c, 0x1c, 0xc7, 0x94, 0x63, 0x29, 0xab, 0x6c, 0xc4, 0x57, 0xde, 0xe3, 0xf1, +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 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) From de49745723252950aca0e93c5b783468457cf6b6 Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Sun, 20 Mar 2022 15:03:53 -0700 Subject: [PATCH 19/22] [sandbox] Fix CI Signed-off-by: Maksym Pavlenko --- api/next.pb.txt | 8 +- api/services/containers/v1/containers.pb.go | 105 ++++++++++---------- go.mod | 3 +- sandbox_store.go | 4 +- services/sandbox/store_local.go | 4 +- 5 files changed, 62 insertions(+), 62 deletions(-) diff --git a/api/next.pb.txt b/api/next.pb.txt index 28355603f..6208b6b3c 100644 --- a/api/next.pb.txt +++ b/api/next.pb.txt @@ -2988,8 +2988,8 @@ file { type: TYPE_MESSAGE type_name: ".google.protobuf.Timestamp" options { - 65001: 0 65010: 1 + 65001: 0 } json_name: "createdAt" } @@ -3000,8 +3000,8 @@ file { type: TYPE_MESSAGE type_name: ".google.protobuf.Timestamp" options { - 65001: 0 65010: 1 + 65001: 0 } json_name: "updatedAt" } @@ -3300,8 +3300,8 @@ file { type: TYPE_MESSAGE type_name: ".google.protobuf.Timestamp" options { - 65001: 0 65010: 1 + 65001: 0 } json_name: "exitedAt" } @@ -3392,8 +3392,8 @@ file { type: TYPE_MESSAGE type_name: ".google.protobuf.Timestamp" options { - 65001: 0 65010: 1 + 65001: 0 } json_name: "exitedAt" } diff --git a/api/services/containers/v1/containers.pb.go b/api/services/containers/v1/containers.pb.go index 47af85b4a..909aa795e 100644 --- a/api/services/containers/v1/containers.pb.go +++ b/api/services/containers/v1/containers.pb.go @@ -596,58 +596,59 @@ func init() { } var fileDescriptor_311afb8e15951042 = []byte{ - // 815 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcb, 0x72, 0x12, 0x4d, - 0x14, 0xce, 0x00, 0x19, 0xc2, 0xe1, 0xaf, 0xfa, 0xff, 0xea, 0x1f, 0x71, 0x1c, 0xab, 0x80, 0xb0, - 0xa2, 0x2c, 0x1d, 0x12, 0xb4, 0xcc, 0xcd, 0x4d, 0xc8, 0xad, 0xd4, 0xc4, 0x4a, 0x4d, 0x74, 0xa3, - 0x8b, 0x38, 0x40, 0x87, 0x8c, 0xcc, 0xcd, 0xe9, 0x86, 0x92, 0x72, 0x11, 0x7d, 0x03, 0x77, 0x3e, - 0x82, 0xaf, 0x92, 0xa5, 0x4b, 0x57, 0xd1, 0x50, 0x3e, 0x88, 0x35, 0x3d, 0x3d, 0xcc, 0x84, 0x8b, - 0x42, 0x62, 0x76, 0x7d, 0xe8, 0xf3, 0x9d, 0xf3, 0xf5, 0x77, 0xfa, 0x6b, 0x06, 0x76, 0x9b, 0x3a, - 0x3d, 0x6e, 0xd7, 0x94, 0xba, 0x6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, 0x84, 0x78, 0xef, 0xff, 0x93, 0x2b, 0x72, 0x8b, - 0xb0, 0xaa, 0xfc, 0x9c, 0x05, 0x08, 0x2f, 0x3c, 0xea, 0x40, 0x7c, 0x07, 0x53, 0xf4, 0x70, 0x82, - 0x72, 0x23, 0x6c, 0x2f, 0x2f, 0x4d, 0x8d, 0xe3, 0x72, 0xbf, 0x87, 0x84, 0x77, 0x54, 0x34, 0xc9, - 0x5f, 0xe6, 0x48, 0x5b, 0xcb, 0x2b, 0x97, 0x40, 0xf2, 0xe6, 0x1f, 0x05, 0x00, 0x6f, 0xeb, 0x80, - 0xba, 0x58, 0x33, 0xaf, 0xc0, 0x61, 0x69, 0x5a, 0x24, 0x9f, 0xe8, 0x82, 0x80, 0x4e, 0x40, 0xf4, - 0x1d, 0x8a, 0x26, 0x39, 0xc8, 0xe8, 0x87, 0x43, 0x5e, 0xbd, 0x0c, 0x94, 0x8b, 0x70, 0x02, 0xa2, - 0xef, 0x85, 0x89, 0x08, 0x8c, 0xf6, 0xf7, 0x44, 0x04, 0xc6, 0x39, 0xee, 0x15, 0x88, 0xbe, 0x3f, - 0x26, 0x22, 0x30, 0xda, 0x4a, 0x72, 0x76, 0xc8, 0xf9, 0x5b, 0xde, 0x97, 0x60, 0xf5, 0xf5, 0xe9, - 0x79, 0x6e, 0xe6, 0xdb, 0x79, 0x6e, 0xe6, 0x43, 0x2f, 0x27, 0x9c, 0xf6, 0x72, 0xc2, 0xd7, 0x5e, - 0x4e, 0xf8, 0xd1, 0xcb, 0x09, 0x2f, 0xb7, 0xaf, 0xf0, 0x71, 0xbb, 0x16, 0x46, 0x35, 0x91, 0x75, - 0xbc, 0xff, 0x2b, 0x00, 0x00, 0xff, 0xff, 0x77, 0xc8, 0x5c, 0x78, 0x2d, 0x0b, 0x00, 0x00, + // 832 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcb, 0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41, 0x26, 0x3f, 0x1c, 0xea, 0xe6, 0x5d, 0xa0, 0x42, 0x84, 0x4b, 0x90, + 0x03, 0x2f, 0xcc, 0x44, 0x60, 0xb2, 0xbf, 0x67, 0x22, 0x30, 0xcd, 0x71, 0x8f, 0x40, 0x0e, 0xfc, + 0x31, 0x13, 0x81, 0xc9, 0x56, 0x52, 0xf3, 0x63, 0xce, 0xdf, 0x63, 0xff, 0x11, 0xeb, 0x8f, 0xaf, + 0x6e, 0x0a, 0x0b, 0x6f, 0x6f, 0x0a, 0x0b, 0xcf, 0x07, 0x05, 0xe9, 0x6a, 0x50, 0x90, 0xde, 0x0c, + 0x0a, 0xd2, 0xfb, 0x41, 0x41, 0xfa, 0x7f, 0xff, 0x1e, 0x7f, 0x7b, 0xb7, 0xa2, 0xa8, 0x21, 0xf3, + 0x8e, 0xbf, 0x7e, 0x0c, 0x00, 0x00, 0xff, 0xff, 0xef, 0xe7, 0xe1, 0xb7, 0x47, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/go.mod b/go.mod index 79ca6e15f..5228df705 100644 --- a/go.mod +++ b/go.mod @@ -48,8 +48,8 @@ require ( github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417 github.com/opencontainers/selinux v1.10.0 github.com/pelletier/go-toml v1.9.3 - github.com/prometheus/client_golang v1.11.1 github.com/pkg/errors v0.9.1 + github.com/prometheus/client_golang v1.11.1 github.com/sirupsen/logrus v1.8.1 github.com/stretchr/testify v1.7.0 github.com/tchap/go-patricia/v2 v2.3.1 @@ -104,7 +104,6 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/opencontainers/runtime-tools v0.0.0-20190417131837-cd1349b7c47e // indirect - github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.30.0 // indirect diff --git a/sandbox_store.go b/sandbox_store.go index 3fe437353..ee5c8cb20 100644 --- a/sandbox_store.go +++ b/sandbox_store.go @@ -79,8 +79,8 @@ func (s *remoteSandboxStore) List(ctx context.Context, filters ...string) ([]sb. } out := make([]sb.Sandbox, len(resp.List)) - for i, s := range resp.List { - out[i] = sb.FromProto(&s) + for i := range resp.List { + out[i] = sb.FromProto(&resp.List[i]) } return out, nil diff --git a/services/sandbox/store_local.go b/services/sandbox/store_local.go index 508924008..eb4ecb4bb 100644 --- a/services/sandbox/store_local.go +++ b/services/sandbox/store_local.go @@ -95,8 +95,8 @@ func (s *sandboxLocal) List(ctx context.Context, in *api.StoreListRequest, _ ... } list := make([]types.Sandbox, len(resp)) - for i, item := range resp { - list[i] = sandbox.ToProto(&item) + for i := range resp { + list[i] = sandbox.ToProto(&resp[i]) } return &api.StoreListResponse{List: list}, nil From 85a49e4ee708157af02dbd69fe665c6febd94cd2 Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Tue, 22 Mar 2022 16:02:13 -0700 Subject: [PATCH 20/22] [sandbox] Cleanup interfaces Signed-off-by: Maksym Pavlenko --- api/next.pb.txt | 54 - api/services/sandbox/v1/sandbox.pb.go | 1197 ++--------------------- api/services/sandbox/v1/sandbox.proto | 21 - cmd/ctr/commands/sandboxes/sandboxes.go | 28 - sandbox.go | 18 - sandbox/controller.go | 8 - sandbox_controller.go | 26 - services/sandbox/controller_local.go | 46 - services/sandbox/controller_service.go | 14 - 9 files changed, 57 insertions(+), 1355 deletions(-) diff --git a/api/next.pb.txt b/api/next.pb.txt index 6208b6b3c..43cbe6c82 100644 --- a/api/next.pb.txt +++ b/api/next.pb.txt @@ -3306,45 +3306,6 @@ file { json_name: "exitedAt" } } - message_type { - name: "ControllerPauseRequest" - field { - name: "sandbox_id" - number: 1 - label: LABEL_OPTIONAL - type: TYPE_STRING - json_name: "sandboxId" - } - } - message_type { - name: "ControllerPauseResponse" - } - message_type { - name: "ControllerResumeRequest" - field { - name: "sandbox_id" - number: 1 - label: LABEL_OPTIONAL - type: TYPE_STRING - json_name: "sandboxId" - } - } - message_type { - name: "ControllerResumeResponse" - } - message_type { - name: "ControllerPingRequest" - field { - name: "sandbox_id" - number: 1 - label: LABEL_OPTIONAL - type: TYPE_STRING - json_name: "sandboxId" - } - } - message_type { - name: "ControllerPingResponse" - } message_type { name: "ControllerStatusRequest" field { @@ -3451,21 +3412,6 @@ file { input_type: ".containerd.services.sandbox.v1.ControllerWaitRequest" output_type: ".containerd.services.sandbox.v1.ControllerWaitResponse" } - method { - name: "Pause" - input_type: ".containerd.services.sandbox.v1.ControllerPauseRequest" - output_type: ".containerd.services.sandbox.v1.ControllerPauseResponse" - } - method { - name: "Resume" - input_type: ".containerd.services.sandbox.v1.ControllerResumeRequest" - output_type: ".containerd.services.sandbox.v1.ControllerResumeResponse" - } - method { - name: "Ping" - input_type: ".containerd.services.sandbox.v1.ControllerPingRequest" - output_type: ".containerd.services.sandbox.v1.ControllerPingResponse" - } method { name: "Status" input_type: ".containerd.services.sandbox.v1.ControllerStatusRequest" diff --git a/api/services/sandbox/v1/sandbox.pb.go b/api/services/sandbox/v1/sandbox.pb.go index 3e8480481..94403a005 100644 --- a/api/services/sandbox/v1/sandbox.pb.go +++ b/api/services/sandbox/v1/sandbox.pb.go @@ -669,237 +669,6 @@ func (m *ControllerWaitResponse) XXX_DiscardUnknown() { 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:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ControllerPauseRequest) Reset() { *m = ControllerPauseRequest{} } -func (*ControllerPauseRequest) ProtoMessage() {} -func (*ControllerPauseRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d6eb1ebcbc2879f1, []int{16} -} -func (m *ControllerPauseRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ControllerPauseRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ControllerPauseRequest.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 *ControllerPauseRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ControllerPauseRequest.Merge(m, src) -} -func (m *ControllerPauseRequest) XXX_Size() int { - return m.Size() -} -func (m *ControllerPauseRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ControllerPauseRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ControllerPauseRequest proto.InternalMessageInfo - -type ControllerPauseResponse struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ControllerPauseResponse) Reset() { *m = ControllerPauseResponse{} } -func (*ControllerPauseResponse) ProtoMessage() {} -func (*ControllerPauseResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d6eb1ebcbc2879f1, []int{17} -} -func (m *ControllerPauseResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ControllerPauseResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ControllerPauseResponse.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 *ControllerPauseResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ControllerPauseResponse.Merge(m, src) -} -func (m *ControllerPauseResponse) XXX_Size() int { - return m.Size() -} -func (m *ControllerPauseResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ControllerPauseResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ControllerPauseResponse proto.InternalMessageInfo - -type ControllerResumeRequest 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 *ControllerResumeRequest) Reset() { *m = ControllerResumeRequest{} } -func (*ControllerResumeRequest) ProtoMessage() {} -func (*ControllerResumeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d6eb1ebcbc2879f1, []int{18} -} -func (m *ControllerResumeRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ControllerResumeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ControllerResumeRequest.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 *ControllerResumeRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ControllerResumeRequest.Merge(m, src) -} -func (m *ControllerResumeRequest) XXX_Size() int { - return m.Size() -} -func (m *ControllerResumeRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ControllerResumeRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ControllerResumeRequest proto.InternalMessageInfo - -type ControllerResumeResponse struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ControllerResumeResponse) Reset() { *m = ControllerResumeResponse{} } -func (*ControllerResumeResponse) ProtoMessage() {} -func (*ControllerResumeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d6eb1ebcbc2879f1, []int{19} -} -func (m *ControllerResumeResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ControllerResumeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ControllerResumeResponse.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 *ControllerResumeResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ControllerResumeResponse.Merge(m, src) -} -func (m *ControllerResumeResponse) XXX_Size() int { - return m.Size() -} -func (m *ControllerResumeResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ControllerResumeResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ControllerResumeResponse proto.InternalMessageInfo - -type ControllerPingRequest 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 *ControllerPingRequest) Reset() { *m = ControllerPingRequest{} } -func (*ControllerPingRequest) ProtoMessage() {} -func (*ControllerPingRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d6eb1ebcbc2879f1, []int{20} -} -func (m *ControllerPingRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ControllerPingRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ControllerPingRequest.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 *ControllerPingRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ControllerPingRequest.Merge(m, src) -} -func (m *ControllerPingRequest) XXX_Size() int { - return m.Size() -} -func (m *ControllerPingRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ControllerPingRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ControllerPingRequest proto.InternalMessageInfo - -type ControllerPingResponse struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ControllerPingResponse) Reset() { *m = ControllerPingResponse{} } -func (*ControllerPingResponse) ProtoMessage() {} -func (*ControllerPingResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d6eb1ebcbc2879f1, []int{21} -} -func (m *ControllerPingResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ControllerPingResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ControllerPingResponse.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 *ControllerPingResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ControllerPingResponse.Merge(m, src) -} -func (m *ControllerPingResponse) XXX_Size() int { - return m.Size() -} -func (m *ControllerPingResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ControllerPingResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ControllerPingResponse proto.InternalMessageInfo - type ControllerStatusRequest struct { SandboxID string `protobuf:"bytes,1,opt,name=sandbox_id,json=sandboxId,proto3" json:"sandbox_id,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -910,7 +679,7 @@ type ControllerStatusRequest struct { func (m *ControllerStatusRequest) Reset() { *m = ControllerStatusRequest{} } func (*ControllerStatusRequest) ProtoMessage() {} func (*ControllerStatusRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d6eb1ebcbc2879f1, []int{22} + return fileDescriptor_d6eb1ebcbc2879f1, []int{16} } func (m *ControllerStatusRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -954,7 +723,7 @@ type ControllerStatusResponse struct { func (m *ControllerStatusResponse) Reset() { *m = ControllerStatusResponse{} } func (*ControllerStatusResponse) ProtoMessage() {} func (*ControllerStatusResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d6eb1ebcbc2879f1, []int{23} + return fileDescriptor_d6eb1ebcbc2879f1, []int{17} } func (m *ControllerStatusResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1000,12 +769,6 @@ func init() { 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") - proto.RegisterType((*ControllerResumeResponse)(nil), "containerd.services.sandbox.v1.ControllerResumeResponse") - proto.RegisterType((*ControllerPingRequest)(nil), "containerd.services.sandbox.v1.ControllerPingRequest") - proto.RegisterType((*ControllerPingResponse)(nil), "containerd.services.sandbox.v1.ControllerPingResponse") proto.RegisterType((*ControllerStatusRequest)(nil), "containerd.services.sandbox.v1.ControllerStatusRequest") proto.RegisterType((*ControllerStatusResponse)(nil), "containerd.services.sandbox.v1.ControllerStatusResponse") } @@ -1015,67 +778,61 @@ func init() { } var fileDescriptor_d6eb1ebcbc2879f1 = []byte{ - // 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, 0x52, 0x7c, 0xaa, - 0xd0, 0xca, 0xde, 0xa6, 0xa2, 0xec, 0xc2, 0x01, 0x9a, 0x2d, 0x5b, 0x2a, 0x81, 0xa8, 0x1c, 0x10, - 0xb0, 0x97, 0xca, 0x8d, 0xa7, 0xa9, 0x45, 0xe2, 0x71, 0x3c, 0xe3, 0x92, 0x0a, 0x0e, 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, 0x87, 0xb4, 0x58, 0x23, 0xf5, 0x0f, 0x4a, 0xfb, 0xc9, 0x94, - 0x7f, 0x51, 0x60, 0x35, 0x99, 0xfd, 0xe8, 0x59, 0x09, 0x94, 0xbc, 0x3a, 0xe9, 0x1f, 0x56, 0x71, - 0x95, 0x1c, 0x22, 0xa8, 0xc7, 0xca, 0x80, 0xde, 0x2f, 0x8e, 0x91, 0x11, 0x24, 0x7d, 0xaf, 0xac, - 0x9b, 0x0c, 0x3b, 0x85, 0x06, 0x1f, 0xe5, 0x65, 0x8a, 0x9e, 0xd5, 0x90, 0x32, 0x45, 0xcf, 0x69, - 0x06, 0xfa, 0x11, 0x54, 0x31, 0xe0, 0x51, 0x09, 0x88, 0x9c, 0xb6, 0xe8, 0x4f, 0xcb, 0x3b, 0xa6, - 0xd5, 0x8e, 0x47, 0x7f, 0x99, 0x6a, 0x67, 0x14, 0xa7, 0x4c, 0xb5, 0xb3, 0x0a, 0x13, 0xe7, 0x2c, - 0x87, 0x74, 0xb9, 0x5e, 0x4d, 0x95, 0xa8, 0x4c, 0xce, 0x79, 0xe1, 0xe9, 0xbd, 0xbc, 0x7a, 0xd5, - 0x5e, 0xfa, 0xf3, 0x55, 0x7b, 0xe9, 0xe7, 0x59, 0x5b, 0xb9, 0x9a, 0xb5, 0x95, 0x3f, 0x66, 0x6d, - 0xe5, 0xef, 0x59, 0x5b, 0x79, 0xf9, 0x49, 0xd5, 0xbf, 0x97, 0x1f, 0xc9, 0xe5, 0xb7, 0xb5, 0x53, - 0x95, 0x6b, 0xc3, 0xee, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x89, 0x0a, 0xdb, 0xe4, 0xab, 0x0e, - 0x00, 0x00, + // 859 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcd, 0x6e, 0xeb, 0x44, + 0x14, 0xae, 0xf3, 0xe3, 0x36, 0x27, 0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 0xc6, 0x89, 0x92, 0x7f, 0x91, 0x60, 0x23, 0xb1, 0x34, 0x74, 0x94, 0x83, 0x65, 0xd1, 0x74, + 0xd5, 0xf7, 0x8b, 0x40, 0x85, 0x86, 0x10, 0x2a, 0x91, 0xe1, 0xa1, 0x77, 0xb3, 0x73, 0xcc, 0xf9, + 0xac, 0x7a, 0x98, 0x17, 0x26, 0xd2, 0xfe, 0x08, 0xb2, 0xb0, 0x8d, 0x7c, 0xdd, 0x4b, 0xbd, 0x51, + 0x7d, 0x99, 0x1f, 0x18, 0x27, 0x6f, 0x9f, 0x5f, 0xdf, 0x36, 0xd6, 0xfe, 0xbc, 0x6d, 0xac, 0xfd, + 0x3c, 0x6b, 0x48, 0xd7, 0xb3, 0x86, 0xf4, 0xc7, 0xac, 0x21, 0xfd, 0x3d, 0x6b, 0x48, 0xe7, 0x1f, + 0x15, 0xfd, 0x1f, 0xff, 0x81, 0x58, 0x7e, 0x5b, 0xea, 0xcb, 0xdc, 0xad, 0x0e, 0xfe, 0x0b, 0x00, + 0x00, 0xff, 0xff, 0x36, 0x7e, 0xfa, 0xf8, 0x14, 0x0c, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1309,9 +1066,6 @@ 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) Status(ctx context.Context, in *ControllerStatusRequest, opts ...grpc.CallOption) (*ControllerStatusResponse, error) } @@ -1350,33 +1104,6 @@ func (c *controllerClient) Wait(ctx context.Context, in *ControllerWaitRequest, 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...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *controllerClient) Resume(ctx context.Context, in *ControllerResumeRequest, opts ...grpc.CallOption) (*ControllerResumeResponse, error) { - out := new(ControllerResumeResponse) - err := c.cc.Invoke(ctx, "/containerd.services.sandbox.v1.Controller/Resume", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *controllerClient) Ping(ctx context.Context, in *ControllerPingRequest, opts ...grpc.CallOption) (*ControllerPingResponse, error) { - out := new(ControllerPingResponse) - err := c.cc.Invoke(ctx, "/containerd.services.sandbox.v1.Controller/Ping", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *controllerClient) Status(ctx context.Context, in *ControllerStatusRequest, opts ...grpc.CallOption) (*ControllerStatusResponse, error) { out := new(ControllerStatusResponse) err := c.cc.Invoke(ctx, "/containerd.services.sandbox.v1.Controller/Status", in, out, opts...) @@ -1391,9 +1118,6 @@ 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) Status(context.Context, *ControllerStatusRequest) (*ControllerStatusResponse, error) } @@ -1410,15 +1134,6 @@ func (*UnimplementedControllerServer) Shutdown(ctx context.Context, req *Control 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") -} -func (*UnimplementedControllerServer) Resume(ctx context.Context, req *ControllerResumeRequest) (*ControllerResumeResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Resume not implemented") -} -func (*UnimplementedControllerServer) Ping(ctx context.Context, req *ControllerPingRequest) (*ControllerPingResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented") -} func (*UnimplementedControllerServer) Status(ctx context.Context, req *ControllerStatusRequest) (*ControllerStatusResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Status not implemented") } @@ -1481,60 +1196,6 @@ func _Controller_Wait_Handler(srv interface{}, ctx context.Context, dec func(int 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 { - return nil, err - } - if interceptor == nil { - return srv.(ControllerServer).Pause(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/containerd.services.sandbox.v1.Controller/Pause", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ControllerServer).Pause(ctx, req.(*ControllerPauseRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Controller_Resume_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ControllerResumeRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ControllerServer).Resume(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/containerd.services.sandbox.v1.Controller/Resume", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ControllerServer).Resume(ctx, req.(*ControllerResumeRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Controller_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ControllerPingRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ControllerServer).Ping(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/containerd.services.sandbox.v1.Controller/Ping", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ControllerServer).Ping(ctx, req.(*ControllerPingRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _Controller_Status_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ControllerStatusRequest) if err := dec(in); err != nil { @@ -1569,18 +1230,6 @@ var _Controller_serviceDesc = grpc.ServiceDesc{ MethodName: "Wait", Handler: _Controller_Wait_Handler, }, - { - MethodName: "Pause", - Handler: _Controller_Pause_Handler, - }, - { - MethodName: "Resume", - Handler: _Controller_Resume_Handler, - }, - { - MethodName: "Ping", - Handler: _Controller_Ping_Handler, - }, { MethodName: "Status", Handler: _Controller_Status_Handler, @@ -2197,189 +1846,6 @@ func (m *ControllerWaitResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *ControllerPauseRequest) 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 *ControllerPauseRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ControllerPauseRequest) 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 *ControllerPauseResponse) 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 *ControllerPauseResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ControllerPauseResponse) 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) - } - return len(dAtA) - i, nil -} - -func (m *ControllerResumeRequest) 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 *ControllerResumeRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ControllerResumeRequest) 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 *ControllerResumeResponse) 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 *ControllerResumeResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ControllerResumeResponse) 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) - } - return len(dAtA) - i, nil -} - -func (m *ControllerPingRequest) 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 *ControllerPingRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ControllerPingRequest) 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 *ControllerPingResponse) 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 *ControllerPingResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ControllerPingResponse) 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) - } - return len(dAtA) - i, nil -} - func (m *ControllerStatusRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2763,90 +2229,6 @@ func (m *ControllerWaitResponse) Size() (n int) { return n } -func (m *ControllerPauseRequest) 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 *ControllerPauseResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ControllerResumeRequest) 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 *ControllerResumeResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ControllerPingRequest) 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 *ControllerPingResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - func (m *ControllerStatusRequest) Size() (n int) { if m == nil { return 0 @@ -3091,69 +2473,6 @@ func (this *ControllerWaitResponse) String() string { }, "") return s } -func (this *ControllerPauseRequest) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ControllerPauseRequest{`, - `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, - `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, - `}`, - }, "") - return s -} -func (this *ControllerPauseResponse) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ControllerPauseResponse{`, - `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, - `}`, - }, "") - return s -} -func (this *ControllerResumeRequest) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ControllerResumeRequest{`, - `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, - `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, - `}`, - }, "") - return s -} -func (this *ControllerResumeResponse) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ControllerResumeResponse{`, - `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, - `}`, - }, "") - return s -} -func (this *ControllerPingRequest) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ControllerPingRequest{`, - `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, - `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, - `}`, - }, "") - return s -} -func (this *ControllerPingResponse) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ControllerPingResponse{`, - `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, - `}`, - }, "") - return s -} func (this *ControllerStatusRequest) String() string { if this == nil { return "nil" @@ -4623,408 +3942,6 @@ func (m *ControllerWaitResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *ControllerPauseRequest) 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: ControllerPauseRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ControllerPauseRequest: 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 *ControllerPauseResponse) 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: ControllerPauseResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ControllerPauseResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - 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 *ControllerResumeRequest) 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: ControllerResumeRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ControllerResumeRequest: 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 *ControllerResumeResponse) 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: ControllerResumeResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ControllerResumeResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - 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 *ControllerPingRequest) 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: ControllerPingRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ControllerPingRequest: 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 *ControllerPingResponse) 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: ControllerPingResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ControllerPingResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - 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 *ControllerStatusRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/api/services/sandbox/v1/sandbox.proto b/api/services/sandbox/v1/sandbox.proto index 862f5eee6..a3e5d9753 100644 --- a/api/services/sandbox/v1/sandbox.proto +++ b/api/services/sandbox/v1/sandbox.proto @@ -89,9 +89,6 @@ 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); rpc Status(ControllerStatusRequest) returns (ControllerStatusResponse); } @@ -122,24 +119,6 @@ message ControllerWaitResponse { google.protobuf.Timestamp exited_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; } -message ControllerPauseRequest { - string sandbox_id = 1; -} - -message ControllerPauseResponse {} - -message ControllerResumeRequest { - string sandbox_id = 1; -} - -message ControllerResumeResponse {} - -message ControllerPingRequest { - string sandbox_id = 1; -} - -message ControllerPingResponse {} - message ControllerStatusRequest { string sandbox_id = 1; } diff --git a/cmd/ctr/commands/sandboxes/sandboxes.go b/cmd/ctr/commands/sandboxes/sandboxes.go index 9d1935bf3..7e639afb2 100644 --- a/cmd/ctr/commands/sandboxes/sandboxes.go +++ b/cmd/ctr/commands/sandboxes/sandboxes.go @@ -38,7 +38,6 @@ var Command = cli.Command{ runCommand, listCommand, removeCommand, - pingCommand, }, } @@ -177,30 +176,3 @@ var removeCommand = cli.Command{ return nil }, } - -var pingCommand = cli.Command{ - Name: "ping", - ArgsUsage: " [, ...]", - Usage: "ping sandbox", - Action: func(context *cli.Context) error { - client, ctx, cancel, err := commands.NewClient(context) - if err != nil { - return err - } - defer cancel() - - for _, id := range context.Args() { - sandbox, err := client.LoadSandbox(ctx, id) - if err != nil { - return fmt.Errorf("failed to load sandbox %s: %w", id, err) - } - - err = sandbox.Ping(ctx) - if err != nil { - return fmt.Errorf("failed to ping %s: %w", id, err) - } - } - - return nil - }, -} diff --git a/sandbox.go b/sandbox.go index b6225648c..1e949aac8 100644 --- a/sandbox.go +++ b/sandbox.go @@ -47,12 +47,6 @@ type Sandbox interface { 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 - // Ping will check whether existing sandbox instance alive - Ping(ctx context.Context) error } type sandboxClient struct { @@ -127,18 +121,6 @@ func (s *sandboxClient) Delete(ctx context.Context) error { return s.client.SandboxStore().Delete(ctx, s.ID()) } -func (s *sandboxClient) Pause(ctx context.Context) error { - return s.client.SandboxController().Pause(ctx, s.ID()) -} - -func (s *sandboxClient) Resume(ctx context.Context) error { - return s.client.SandboxController().Resume(ctx, s.ID()) -} - -func (s *sandboxClient) Ping(ctx context.Context) error { - return s.client.SandboxController().Ping(ctx, s.ID()) -} - // NewSandbox creates new sandbox client func (c *Client) NewSandbox(ctx context.Context, sandboxID string, opts ...NewSandboxOpts) (Sandbox, error) { if sandboxID == "" { diff --git a/sandbox/controller.go b/sandbox/controller.go index 6b77f3cae..925307829 100644 --- a/sandbox/controller.go +++ b/sandbox/controller.go @@ -49,14 +49,6 @@ type Controller interface { 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 - // Resume will unfreeze previously paused sandbox instance - Resume(ctx context.Context, sandboxID string) error - // Ping is a lightweight API call to check whether sandbox instance is still alive (e.g. quick livability check). - // This should not involve any complex logic and containerd will not debug log it as it might be called quite often. - 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) (*sandbox.ControllerStatusResponse, error) diff --git a/sandbox_controller.go b/sandbox_controller.go index 2093783bd..17e91889b 100644 --- a/sandbox_controller.go +++ b/sandbox_controller.go @@ -63,32 +63,6 @@ func (s *sandboxRemoteController) Wait(ctx context.Context, sandboxID string) (* 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 { - return errdefs.FromGRPC(err) - } - - return nil -} - -func (s *sandboxRemoteController) Resume(ctx context.Context, sandboxID string) error { - _, err := s.client.Resume(ctx, &api.ControllerResumeRequest{SandboxID: sandboxID}) - if err != nil { - return errdefs.FromGRPC(err) - } - - return nil -} - -func (s *sandboxRemoteController) Ping(ctx context.Context, sandboxID string) error { - if _, err := s.client.Ping(ctx, &api.ControllerPingRequest{SandboxID: sandboxID}); err != nil { - return errdefs.FromGRPC(err) - } - - return nil -} - 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 { diff --git a/services/sandbox/controller_local.go b/services/sandbox/controller_local.go index 8ea42096f..a4b62088c 100644 --- a/services/sandbox/controller_local.go +++ b/services/sandbox/controller_local.go @@ -32,7 +32,6 @@ import ( proto "github.com/containerd/containerd/runtime/v2/task" "github.com/containerd/containerd/sandbox" "github.com/containerd/containerd/services" - "github.com/pkg/errors" "google.golang.org/grpc" ) @@ -165,51 +164,6 @@ func (c *controllerLocal) Wait(ctx context.Context, in *api.ControllerWaitReques }, 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 { - return nil, err - } - - if _, err := svc.PauseSandbox(ctx, &proto.PauseSandboxRequest{ - SandboxID: in.SandboxID, - }); err != nil { - return nil, errors.Wrapf(err, "failed to resume sandbox %s", in.SandboxID) - } - - return &api.ControllerPauseResponse{}, nil -} - -func (c *controllerLocal) Resume(ctx context.Context, in *api.ControllerResumeRequest, opts ...grpc.CallOption) (*api.ControllerResumeResponse, error) { - svc, err := c.getSandbox(ctx, in.SandboxID) - if err != nil { - return nil, err - } - - if _, err := svc.ResumeSandbox(ctx, &proto.ResumeSandboxRequest{ - SandboxID: in.SandboxID, - }); err != nil { - return nil, errors.Wrapf(err, "failed to resume sandbox %s", in.SandboxID) - } - - return &api.ControllerResumeResponse{}, nil -} - -func (c *controllerLocal) Ping(ctx context.Context, in *api.ControllerPingRequest, opts ...grpc.CallOption) (*api.ControllerPingResponse, error) { - svc, err := c.getSandbox(ctx, in.SandboxID) - if err != nil { - return nil, err - } - - if _, err := svc.PingSandbox(ctx, &proto.PingRequest{ - SandboxID: in.SandboxID, - }); err != nil { - return nil, err - } - - return &api.ControllerPingResponse{}, nil -} - func (c *controllerLocal) Status(ctx context.Context, in *api.ControllerStatusRequest, opts ...grpc.CallOption) (*api.ControllerStatusResponse, error) { svc, err := c.getSandbox(ctx, in.SandboxID) if err != nil { diff --git a/services/sandbox/controller_service.go b/services/sandbox/controller_service.go index 47270e5a9..12dc5b08a 100644 --- a/services/sandbox/controller_service.go +++ b/services/sandbox/controller_service.go @@ -83,20 +83,6 @@ func (s *controllerService) Wait(ctx context.Context, req *api.ControllerWaitReq 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) -} - -func (s *controllerService) Resume(ctx context.Context, req *api.ControllerResumeRequest) (*api.ControllerResumeResponse, error) { - log.G(ctx).WithField("req", req).Debug("resume sandbox") - return s.local.Resume(ctx, req) -} - -func (s *controllerService) Ping(ctx context.Context, req *api.ControllerPingRequest) (*api.ControllerPingResponse, error) { - return s.local.Ping(ctx, req) -} - func (s *controllerService) Status(ctx context.Context, req *api.ControllerStatusRequest) (*api.ControllerStatusResponse, error) { log.G(ctx).WithField("req", req).Debug("sandbox status") return s.local.Status(ctx, req) From d0b32c0539cd529c35b86b29b8b61305c3ca3191 Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Tue, 29 Mar 2022 14:11:48 -0700 Subject: [PATCH 21/22] [sandbox] Migrate from gogo to Any Signed-off-by: Maksym Pavlenko --- metadata/sandbox.go | 4 ++-- metadata/sandbox_test.go | 32 ++++++++++++++------------ sandbox.go | 4 ++-- sandbox/helpers.go | 49 +++++++++++++++++++++++++--------------- sandbox/store.go | 8 +++---- 5 files changed, 56 insertions(+), 41 deletions(-) diff --git a/metadata/sandbox.go b/metadata/sandbox.go index bcdfce8a3..82cf239b0 100644 --- a/metadata/sandbox.go +++ b/metadata/sandbox.go @@ -28,7 +28,7 @@ import ( "github.com/containerd/containerd/metadata/boltutil" "github.com/containerd/containerd/namespaces" api "github.com/containerd/containerd/sandbox" - "github.com/gogo/protobuf/types" + "github.com/containerd/typeurl" "github.com/pkg/errors" "go.etcd.io/bbolt" ) @@ -114,7 +114,7 @@ func (s *sandboxStore) Update(ctx context.Context, sandbox api.Sandbox, fieldpat continue } else if strings.HasPrefix(path, "extensions.") { if updated.Extensions == nil { - updated.Extensions = map[string]types.Any{} + updated.Extensions = map[string]typeurl.Any{} } key := strings.TrimPrefix(path, "extensions.") diff --git a/metadata/sandbox_test.go b/metadata/sandbox_test.go index 0a6d82a59..0147de780 100644 --- a/metadata/sandbox_test.go +++ b/metadata/sandbox_test.go @@ -21,7 +21,9 @@ import ( "testing" "github.com/containerd/containerd/errdefs" + "github.com/containerd/containerd/protobuf" api "github.com/containerd/containerd/sandbox" + "github.com/containerd/typeurl" "github.com/gogo/protobuf/types" ) @@ -35,9 +37,9 @@ func TestSandboxCreate(t *testing.T) { ID: "1", Labels: map[string]string{"a": "1", "b": "2"}, Spec: &types.Any{TypeUrl: "1", Value: []byte{1, 2, 3}}, - Extensions: map[string]types.Any{ - "ext1": {TypeUrl: "url/1", Value: []byte{1, 2, 3}}, - "ext2": {TypeUrl: "url/2", Value: []byte{3, 2, 1}}, + Extensions: map[string]typeurl.Any{ + "ext1": &types.Any{TypeUrl: "url/1", Value: []byte{1, 2, 3}}, + "ext2": &types.Any{TypeUrl: "url/2", Value: []byte{3, 2, 1}}, }, Runtime: api.RuntimeOpts{ Name: "test", @@ -91,8 +93,8 @@ func TestSandboxUpdate(t *testing.T) { ID: "2", Labels: map[string]string{"lbl1": "existing"}, Spec: &types.Any{TypeUrl: "1", Value: []byte{1}}, // will replace - Extensions: map[string]types.Any{ - "ext2": {TypeUrl: "url2", Value: []byte{4, 5, 6}}, // will append `ext1` + Extensions: map[string]typeurl.Any{ + "ext2": &types.Any{TypeUrl: "url2", Value: []byte{4, 5, 6}}, // will append `ext1` }, Runtime: api.RuntimeOpts{Name: "test"}, // no change }); err != nil { @@ -105,8 +107,8 @@ func TestSandboxUpdate(t *testing.T) { ID: "2", Labels: map[string]string{"lbl1": "new"}, Spec: &expectedSpec, - Extensions: map[string]types.Any{ - "ext1": {TypeUrl: "url1", Value: []byte{1, 2}}, + Extensions: map[string]typeurl.Any{ + "ext1": &types.Any{TypeUrl: "url1", Value: []byte{1, 2}}, }, }, "labels.lbl1", "extensions.ext1", "spec") if err != nil { @@ -119,9 +121,9 @@ func TestSandboxUpdate(t *testing.T) { Labels: map[string]string{ "lbl1": "new", }, - Extensions: map[string]types.Any{ - "ext1": {TypeUrl: "url1", Value: []byte{1, 2}}, - "ext2": {TypeUrl: "url2", Value: []byte{4, 5, 6}}, + Extensions: map[string]typeurl.Any{ + "ext1": &types.Any{TypeUrl: "url1", Value: []byte{1, 2}}, + "ext2": &types.Any{TypeUrl: "url2", Value: []byte{4, 5, 6}}, }, Runtime: api.RuntimeOpts{Name: "test"}, } @@ -154,14 +156,14 @@ func TestSandboxList(t *testing.T) { ID: "1", Labels: map[string]string{"test": "1"}, Spec: &types.Any{TypeUrl: "1", Value: []byte{1, 2, 3}}, - Extensions: map[string]types.Any{"ext": {}}, + Extensions: map[string]typeurl.Any{"ext": &types.Any{}}, Runtime: api.RuntimeOpts{Name: "test"}, }, { ID: "2", Labels: map[string]string{"test": "2"}, Spec: &types.Any{TypeUrl: "2", Value: []byte{3, 2, 1}}, - Extensions: map[string]types.Any{"ext": { + Extensions: map[string]typeurl.Any{"ext": &types.Any{ TypeUrl: "test", Value: []byte{9}, }}, @@ -201,14 +203,14 @@ func TestSandboxListWithFilter(t *testing.T) { ID: "1", Labels: map[string]string{"test": "1"}, Spec: &types.Any{TypeUrl: "1", Value: []byte{1, 2, 3}}, - Extensions: map[string]types.Any{"ext": {}}, + Extensions: map[string]typeurl.Any{"ext": &types.Any{}}, Runtime: api.RuntimeOpts{Name: "test"}, }, { ID: "2", Labels: map[string]string{"test": "2"}, Spec: &types.Any{TypeUrl: "2", Value: []byte{3, 2, 1}}, - Extensions: map[string]types.Any{"ext": { + Extensions: map[string]typeurl.Any{"ext": &types.Any{ TypeUrl: "test", Value: []byte{9}, }}, @@ -284,7 +286,7 @@ func assertEqualInstances(t *testing.T, x, y api.Sandbox) { t.Fatalf("runtime names are not equal: %q != %q", x.Runtime.Name, y.Runtime.Name) } - if !reflect.DeepEqual(x.Runtime.Options, y.Runtime.Options) { + if !reflect.DeepEqual(protobuf.FromAny(x.Runtime.Options), protobuf.FromAny(y.Runtime.Options)) { t.Fatalf("runtime options are not equal: %+v != %+v", x.Runtime.Options, y.Runtime.Options) } } diff --git a/sandbox.go b/sandbox.go index 1e949aac8..ef5f94d3e 100644 --- a/sandbox.go +++ b/sandbox.go @@ -217,7 +217,7 @@ func WithSandboxSpec(s *oci.Spec, opts ...oci.SpecOpts) NewSandboxOpts { func WithSandboxExtension(name string, ext interface{}) NewSandboxOpts { return func(ctx context.Context, client *Client, s *api.Sandbox) error { if s.Extensions == nil { - s.Extensions = make(map[string]types.Any) + s.Extensions = make(map[string]typeurl.Any) } any, err := typeurl.MarshalAny(ext) @@ -225,7 +225,7 @@ func WithSandboxExtension(name string, ext interface{}) NewSandboxOpts { return errors.Wrap(err, "failed to marshal sandbox extension") } - s.Extensions[name] = *any + s.Extensions[name] = any return err } } diff --git a/sandbox/helpers.go b/sandbox/helpers.go index ad984e9e8..0ffd7bbd0 100644 --- a/sandbox/helpers.go +++ b/sandbox/helpers.go @@ -18,38 +18,51 @@ package sandbox import ( "github.com/containerd/containerd/api/types" + "github.com/containerd/containerd/protobuf" + "github.com/containerd/typeurl" + gogo_types "github.com/gogo/protobuf/types" ) // ToProto will map Sandbox struct to it's protobuf definition -func ToProto(s *Sandbox) types.Sandbox { +func ToProto(sandbox *Sandbox) types.Sandbox { + extensions := make(map[string]gogo_types.Any) + for k, v := range sandbox.Extensions { + extensions[k] = *protobuf.FromAny(v) + } return types.Sandbox{ - SandboxID: s.ID, + SandboxID: sandbox.ID, Runtime: types.Sandbox_Runtime{ - Name: s.Runtime.Name, - Options: s.Runtime.Options, + Name: sandbox.Runtime.Name, + Options: protobuf.FromAny(sandbox.Runtime.Options), }, - Labels: s.Labels, - CreatedAt: s.CreatedAt, - UpdatedAt: s.UpdatedAt, - Extensions: s.Extensions, - Spec: s.Spec, + Labels: sandbox.Labels, + CreatedAt: sandbox.CreatedAt, + UpdatedAt: sandbox.UpdatedAt, + Extensions: extensions, + Spec: protobuf.FromAny(sandbox.Spec), } } // FromProto map protobuf sandbox definition to Sandbox struct -func FromProto(p *types.Sandbox) Sandbox { +func FromProto(sandboxpb *types.Sandbox) Sandbox { runtime := RuntimeOpts{ - Name: p.Runtime.Name, - Options: p.Runtime.Options, + Name: sandboxpb.Runtime.Name, + Options: sandboxpb.Runtime.Options, + } + + extensions := make(map[string]typeurl.Any) + for k, v := range sandboxpb.Extensions { + v := v + extensions[k] = &v } return Sandbox{ - ID: p.SandboxID, - Labels: p.Labels, + ID: sandboxpb.SandboxID, + Labels: sandboxpb.Labels, Runtime: runtime, - Spec: p.Spec, - CreatedAt: p.CreatedAt, - UpdatedAt: p.UpdatedAt, - Extensions: p.Extensions, + Spec: sandboxpb.Spec, + CreatedAt: sandboxpb.CreatedAt, + UpdatedAt: sandboxpb.UpdatedAt, + Extensions: extensions, } } diff --git a/sandbox/store.go b/sandbox/store.go index fd467aadb..d81a17e77 100644 --- a/sandbox/store.go +++ b/sandbox/store.go @@ -20,7 +20,7 @@ import ( "context" "time" - "github.com/gogo/protobuf/types" + "github.com/containerd/typeurl" ) // Sandbox is an object stored in metadata database @@ -32,19 +32,19 @@ type Sandbox struct { // Runtime shim to use for this sandbox Runtime RuntimeOpts // Spec carries the runtime specification used to implement the sandbox - Spec *types.Any + Spec typeurl.Any // CreatedAt is the time at which the sandbox was created CreatedAt time.Time // UpdatedAt is the time at which the sandbox was updated UpdatedAt time.Time // Extensions stores client-specified metadata - Extensions map[string]types.Any + Extensions map[string]typeurl.Any } // RuntimeOpts holds runtime specific information type RuntimeOpts struct { Name string - Options *types.Any + Options typeurl.Any } // Store is a storage interface for sandbox metadata objects From b446c7647f81876a093c326c6d3cc37e5fd7bedf Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Thu, 31 Mar 2022 14:58:35 -0700 Subject: [PATCH 22/22] [Sandbox] Remove outdated documentation Signed-off-by: Maksym Pavlenko --- sandbox/controller.go | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/sandbox/controller.go b/sandbox/controller.go index 925307829..e597e4b73 100644 --- a/sandbox/controller.go +++ b/sandbox/controller.go @@ -23,22 +23,8 @@ import ( ) // Controller is an interface to manage sandboxes at runtime. -// When running the traditional containerd shim, the workflow looks as follows: -// For each new task we're about to run: -// 1. Invoke `shim_binary --start` to obtain `TaskService` address (printed in stdout) -// 2. Call TaskService.RunContainer(id=1) -// 3. Exec `shim_binary --delete` to stop shim -// 4. Exec `shim_binary --start` again to obtain another `TaskService` address -// 5. TaskService.RunContainer(id=2) -// 6. Exec `shim_binary --delete` to stop shim -// -// When running in sandbox mode, shim must implement `SandboxService`. -// In sandbox mode shim lifetimes are managed manually via sandbox API. -// 1. Client calls `client.SandboxController.Start()` to launch new shim and create sandbox process -// 2. Run containers with `shim.TaskService.RunContainer(id=1)` and another one `shim.TaskService.RunContainer(id=2)` -// 3. ... usual container lifecycle calls to `shim.TaskService` -// 4. Client calls shim to stop the sandbox with `client.SandboxService.Shutdown()` -// 5. Shim implementation will perform cleanup similar to regular task service (e.g. shutdown, clean, and `shim_binary --delete`) +// When running in sandbox mode, shim expected to implement `SandboxService`. +// Shim lifetimes are now managed manually via sandbox API by the containerd's client. type Controller interface { // Start will start new sandbox instance. // containerd will run new shim runtime instance and will invoke Start to create a sandbox process.