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, 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, 0xe0, 0xb5, 0x9e, 0xd3, 0x9d, 0xa2, 0xd9, 0xe8, 0xf0, 0x0e, 0xd9, 0xcd, - 0x4b, 0x0c, 0x91, 0x04, 0x1a, 0xb8, 0xe8, 0x6f, 0x2e, 0x27, 0x9d, 0xa0, 0xe1, 0xe1, 0x19, 0xf4, - 0xf3, 0x94, 0x2d, 0x9d, 0x9e, 0xe2, 0x8f, 0x89, 0x0e, 0x4b, 0x9a, 0xb0, 0x64, 0xce, 0xcb, 0x40, - 0x21, 0xf0, 0x31, 0x0c, 0x57, 0x34, 0x64, 0xab, 0xdc, 0xe9, 0x4f, 0x7b, 0xb3, 0xd1, 0xe1, 0xbd, - 0xfd, 0x5e, 0x2f, 0x15, 0xee, 0x84, 0xcb, 0xac, 0x34, 0x7e, 0x86, 0x8a, 0x8f, 0x01, 0x96, 0x19, - 0xa3, 0x92, 0x45, 0xe7, 0x54, 0x3a, 0x03, 0x65, 0xea, 0xfe, 0x61, 0xfa, 0xa6, 0xd9, 0xd0, 0xe2, - 0x46, 0xcd, 0xfe, 0xf2, 0x63, 0x82, 0x02, 0xdb, 0xf0, 0xe6, 0xb2, 0x16, 0x29, 0xd2, 0xa8, 0x11, - 0x19, 0x5e, 0x47, 0xc4, 0xf0, 0xe6, 0x12, 0xbf, 0x06, 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]; -}