From 790b0ead7bc4e234b5ce90b9a1225b60bad34d75 Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Fri, 23 Jan 2026 15:57:11 -0800 Subject: [PATCH 01/28] Implement shim bootstrap protocol Signed-off-by: Maksym Pavlenko --- api/runtime/boot/v1/bootstrap.pb.go | 577 ++++++++++++++++++++++++++++ api/runtime/boot/v1/bootstrap.proto | 119 ++++++ api/runtime/boot/v1/doc.go | 17 + api/runtime/boot/v1/helpers.go | 57 +++ api/runtime/boot/v1/helpers_test.go | 42 ++ 5 files changed, 812 insertions(+) create mode 100644 api/runtime/boot/v1/bootstrap.pb.go create mode 100644 api/runtime/boot/v1/bootstrap.proto create mode 100644 api/runtime/boot/v1/doc.go create mode 100644 api/runtime/boot/v1/helpers.go create mode 100644 api/runtime/boot/v1/helpers_test.go diff --git a/api/runtime/boot/v1/bootstrap.pb.go b/api/runtime/boot/v1/bootstrap.pb.go new file mode 100644 index 0000000000000..aa0aafbe25d32 --- /dev/null +++ b/api/runtime/boot/v1/bootstrap.pb.go @@ -0,0 +1,577 @@ +// +//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. + +// Bootstrap Protocol +// +// This protocol defines the interface between containerd and shims at startup. +// It replaces the previous scattered configuration mechanisms (CLI args, env vars, +// stdin JSON, spec.json annotations) with a single, versioned, extensible protocol. +// +// Flow: +// 1. containerd spawns the shim process +// 2. containerd writes BootstrapParams as JSON to shim's stdin +// 3. shim initializes and writes BootstrapResult as JSON to stdout +// 4. containerd connects to the address provided in BootstrapResult +// +// Note: JSON serialization is used to keep shim binaries small since the +// encoding/json package is already part of the Go runtime. The proto +// definition serves as the schema for detecting breaking changes and +// maintaining forward/backward compatibility. +// +// This design enables: +// - Forward/backward compatibility via version field +// - Typed extensibility via google.protobuf.Any and Extension +// - Clear capability negotiation between containerd and shims + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: runtime/boot/v1/bootstrap.proto + +package bootstrap + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + anypb "google.golang.org/protobuf/types/known/anypb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// BootstrapParams contains all configuration passed from containerd to shim at startup. +type BootstrapParams struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Container/sandbox ID + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // Namespace for the container + Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"` + // Enable debug messages in logs. + EnableDebug bool `protobuf:"varint,3,opt,name=enable_debug,json=enableDebug,proto3" json:"enable_debug,omitempty"` + // Containerd's TTRPC API address (e.g., "unix:///run/containerd/containerd.sock.ttrpc") + ContainerdTtrpcAddress string `protobuf:"bytes,4,opt,name=containerd_ttrpc_address,json=containerdTtrpcAddress,proto3" json:"containerd_ttrpc_address,omitempty"` + // Containerd's gRPC API address (e.g., "unix:///run/containerd/containerd.sock") + ContainerdGrpcAddress string `protobuf:"bytes,5,opt,name=containerd_grpc_address,json=containerdGrpcAddress,proto3" json:"containerd_grpc_address,omitempty"` + // Socket path to serve. + SocketPath string `protobuf:"bytes,6,opt,name=socket_path,json=socketPath,proto3" json:"socket_path,omitempty"` + // Debug socket path to serve. + SocketPathDebug string `protobuf:"bytes,7,opt,name=socket_path_debug,json=socketPathDebug,proto3" json:"socket_path_debug,omitempty"` + // Path to containerd binary for event publishing + ContainerdBinary string `protobuf:"bytes,8,opt,name=containerd_binary,json=containerdBinary,proto3" json:"containerd_binary,omitempty"` + // Extensible configuration sections for new features + // Each section can contain arbitrary structured data identified by type URL + // Examples: CRI config, NRI config, sandbox config, etc. + Extensions []*Extension `protobuf:"bytes,9,rep,name=extensions,proto3" json:"extensions,omitempty"` +} + +func (x *BootstrapParams) Reset() { + *x = BootstrapParams{} + if protoimpl.UnsafeEnabled { + mi := &file_runtime_boot_v1_bootstrap_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BootstrapParams) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BootstrapParams) ProtoMessage() {} + +func (x *BootstrapParams) ProtoReflect() protoreflect.Message { + mi := &file_runtime_boot_v1_bootstrap_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BootstrapParams.ProtoReflect.Descriptor instead. +func (*BootstrapParams) Descriptor() ([]byte, []int) { + return file_runtime_boot_v1_bootstrap_proto_rawDescGZIP(), []int{0} +} + +func (x *BootstrapParams) GetID() string { + if x != nil { + return x.ID + } + return "" +} + +func (x *BootstrapParams) GetNamespace() string { + if x != nil { + return x.Namespace + } + return "" +} + +func (x *BootstrapParams) GetEnableDebug() bool { + if x != nil { + return x.EnableDebug + } + return false +} + +func (x *BootstrapParams) GetContainerdTtrpcAddress() string { + if x != nil { + return x.ContainerdTtrpcAddress + } + return "" +} + +func (x *BootstrapParams) GetContainerdGrpcAddress() string { + if x != nil { + return x.ContainerdGrpcAddress + } + return "" +} + +func (x *BootstrapParams) GetSocketPath() string { + if x != nil { + return x.SocketPath + } + return "" +} + +func (x *BootstrapParams) GetSocketPathDebug() string { + if x != nil { + return x.SocketPathDebug + } + return "" +} + +func (x *BootstrapParams) GetContainerdBinary() string { + if x != nil { + return x.ContainerdBinary + } + return "" +} + +func (x *BootstrapParams) GetExtensions() []*Extension { + if x != nil { + return x.Extensions + } + return nil +} + +// Extension provides extensibility for new configuration types +// without changing the core BootstrapParams protocol +type Extension struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Configuration data with embedded type URL + // Examples of type URLs: + // - "containerd.io/cri.v1.PodSandboxConfig" + // - "containerd.io/nri.v1.PluginConfig" + // - "containerd.io/sandbox.v1.SandboxConfig" + Value *anypb.Any `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *Extension) Reset() { + *x = Extension{} + if protoimpl.UnsafeEnabled { + mi := &file_runtime_boot_v1_bootstrap_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Extension) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Extension) ProtoMessage() {} + +func (x *Extension) ProtoReflect() protoreflect.Message { + mi := &file_runtime_boot_v1_bootstrap_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Extension.ProtoReflect.Descriptor instead. +func (*Extension) Descriptor() ([]byte, []int) { + return file_runtime_boot_v1_bootstrap_proto_rawDescGZIP(), []int{1} +} + +func (x *Extension) GetValue() *anypb.Any { + if x != nil { + return x.Value + } + return nil +} + +// BootstrapResult is returned by shim via stdout after successful startup +type BootstrapResult struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Version of shim parameters (expected 2 for shim v2) + Version int32 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"` + // Address where shim is listening (e.g., "unix:///run/containerd/shim.sock") + // Containerd will connect to this address for task operations + Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` + // Protocol used by shim: "ttrpc" or "grpc" + Protocol string `protobuf:"bytes,3,opt,name=protocol,proto3" json:"protocol,omitempty"` + // Optional: Capabilities supported by this shim instance + // Allows shim to advertise what features it supports + Capabilities []string `protobuf:"bytes,4,rep,name=capabilities,proto3" json:"capabilities,omitempty"` + // Optional: Additional metadata from shim + Metadata map[string]string `protobuf:"bytes,5,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (x *BootstrapResult) Reset() { + *x = BootstrapResult{} + if protoimpl.UnsafeEnabled { + mi := &file_runtime_boot_v1_bootstrap_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BootstrapResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BootstrapResult) ProtoMessage() {} + +func (x *BootstrapResult) ProtoReflect() protoreflect.Message { + mi := &file_runtime_boot_v1_bootstrap_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BootstrapResult.ProtoReflect.Descriptor instead. +func (*BootstrapResult) Descriptor() ([]byte, []int) { + return file_runtime_boot_v1_bootstrap_proto_rawDescGZIP(), []int{2} +} + +func (x *BootstrapResult) GetVersion() int32 { + if x != nil { + return x.Version + } + return 0 +} + +func (x *BootstrapResult) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +func (x *BootstrapResult) GetProtocol() string { + if x != nil { + return x.Protocol + } + return "" +} + +func (x *BootstrapResult) GetCapabilities() []string { + if x != nil { + return x.Capabilities + } + return nil +} + +func (x *BootstrapResult) GetMetadata() map[string]string { + if x != nil { + return x.Metadata + } + return nil +} + +type RuncV2Extensions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Annotations are spec annotations read from config.json. + Annotations map[string]string `protobuf:"bytes,1,rep,name=annotations,proto3" json:"annotations,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // Enable core scheduling if available + SchedCore bool `protobuf:"varint,2,opt,name=sched_core,json=schedCore,proto3" json:"sched_core,omitempty"` + // Cgroup path to place the shim process into + ShimCgroup string `protobuf:"bytes,3,opt,name=shim_cgroup,json=shimCgroup,proto3" json:"shim_cgroup,omitempty"` +} + +func (x *RuncV2Extensions) Reset() { + *x = RuncV2Extensions{} + if protoimpl.UnsafeEnabled { + mi := &file_runtime_boot_v1_bootstrap_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RuncV2Extensions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RuncV2Extensions) ProtoMessage() {} + +func (x *RuncV2Extensions) ProtoReflect() protoreflect.Message { + mi := &file_runtime_boot_v1_bootstrap_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RuncV2Extensions.ProtoReflect.Descriptor instead. +func (*RuncV2Extensions) Descriptor() ([]byte, []int) { + return file_runtime_boot_v1_bootstrap_proto_rawDescGZIP(), []int{3} +} + +func (x *RuncV2Extensions) GetAnnotations() map[string]string { + if x != nil { + return x.Annotations + } + return nil +} + +func (x *RuncV2Extensions) GetSchedCore() bool { + if x != nil { + return x.SchedCore + } + return false +} + +func (x *RuncV2Extensions) GetShimCgroup() string { + if x != nil { + return x.ShimCgroup + } + return "" +} + +var File_runtime_boot_v1_bootstrap_proto protoreflect.FileDescriptor + +var file_runtime_boot_v1_bootstrap_proto_rawDesc = []byte{ + 0x0a, 0x1f, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x2f, 0x76, + 0x31, 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x1f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, + 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, + 0x76, 0x31, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9a, 0x03, + 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, + 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, + 0x21, 0x0a, 0x0c, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x64, 0x65, 0x62, 0x75, 0x67, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x44, 0x65, 0x62, + 0x75, 0x67, 0x12, 0x38, 0x0a, 0x18, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, + 0x5f, 0x74, 0x74, 0x72, 0x70, 0x63, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x16, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, + 0x54, 0x74, 0x72, 0x70, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x36, 0x0a, 0x17, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, 0x67, 0x72, 0x70, 0x63, 0x5f, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x63, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x47, 0x72, 0x70, 0x63, 0x41, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x5f, 0x70, + 0x61, 0x74, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x6f, 0x63, 0x6b, 0x65, + 0x74, 0x50, 0x61, 0x74, 0x68, 0x12, 0x2a, 0x0a, 0x11, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x5f, + 0x70, 0x61, 0x74, 0x68, 0x5f, 0x64, 0x65, 0x62, 0x75, 0x67, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0f, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x50, 0x61, 0x74, 0x68, 0x44, 0x65, 0x62, 0x75, + 0x67, 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, + 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x12, 0x4a, + 0x0a, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x09, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, + 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, + 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0a, + 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x37, 0x0a, 0x09, 0x45, 0x78, + 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x22, 0x9e, 0x02, 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, + 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x61, 0x70, 0x61, 0x62, + 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x63, + 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x5a, 0x0a, 0x08, 0x6d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3e, 0x2e, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, + 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, + 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x2e, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x3a, 0x02, 0x38, 0x01, 0x22, 0xf8, 0x01, 0x0a, 0x10, 0x52, 0x75, 0x6e, 0x63, 0x56, 0x32, 0x45, + 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x64, 0x0a, 0x0b, 0x61, 0x6e, 0x6e, + 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x42, + 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, + 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, + 0x2e, 0x52, 0x75, 0x6e, 0x63, 0x56, 0x32, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, + 0x73, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x52, 0x0b, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, + 0x1d, 0x0a, 0x0a, 0x73, 0x63, 0x68, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x09, 0x73, 0x63, 0x68, 0x65, 0x64, 0x43, 0x6f, 0x72, 0x65, 0x12, 0x1f, + 0x0a, 0x0b, 0x73, 0x68, 0x69, 0x6d, 0x5f, 0x63, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x68, 0x69, 0x6d, 0x43, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x1a, + 0x3e, 0x0a, 0x10, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, + 0x45, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, + 0x65, 0x72, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2f, + 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2f, 0x76, 0x31, 0x3b, 0x62, 0x6f, 0x6f, + 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_runtime_boot_v1_bootstrap_proto_rawDescOnce sync.Once + file_runtime_boot_v1_bootstrap_proto_rawDescData = file_runtime_boot_v1_bootstrap_proto_rawDesc +) + +func file_runtime_boot_v1_bootstrap_proto_rawDescGZIP() []byte { + file_runtime_boot_v1_bootstrap_proto_rawDescOnce.Do(func() { + file_runtime_boot_v1_bootstrap_proto_rawDescData = protoimpl.X.CompressGZIP(file_runtime_boot_v1_bootstrap_proto_rawDescData) + }) + return file_runtime_boot_v1_bootstrap_proto_rawDescData +} + +var file_runtime_boot_v1_bootstrap_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_runtime_boot_v1_bootstrap_proto_goTypes = []interface{}{ + (*BootstrapParams)(nil), // 0: containerd.runtime.bootstrap.v1.BootstrapParams + (*Extension)(nil), // 1: containerd.runtime.bootstrap.v1.Extension + (*BootstrapResult)(nil), // 2: containerd.runtime.bootstrap.v1.BootstrapResult + (*RuncV2Extensions)(nil), // 3: containerd.runtime.bootstrap.v1.RuncV2Extensions + nil, // 4: containerd.runtime.bootstrap.v1.BootstrapResult.MetadataEntry + nil, // 5: containerd.runtime.bootstrap.v1.RuncV2Extensions.AnnotationsEntry + (*anypb.Any)(nil), // 6: google.protobuf.Any +} +var file_runtime_boot_v1_bootstrap_proto_depIdxs = []int32{ + 1, // 0: containerd.runtime.bootstrap.v1.BootstrapParams.extensions:type_name -> containerd.runtime.bootstrap.v1.Extension + 6, // 1: containerd.runtime.bootstrap.v1.Extension.value:type_name -> google.protobuf.Any + 4, // 2: containerd.runtime.bootstrap.v1.BootstrapResult.metadata:type_name -> containerd.runtime.bootstrap.v1.BootstrapResult.MetadataEntry + 5, // 3: containerd.runtime.bootstrap.v1.RuncV2Extensions.annotations:type_name -> containerd.runtime.bootstrap.v1.RuncV2Extensions.AnnotationsEntry + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_runtime_boot_v1_bootstrap_proto_init() } +func file_runtime_boot_v1_bootstrap_proto_init() { + if File_runtime_boot_v1_bootstrap_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_runtime_boot_v1_bootstrap_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BootstrapParams); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_runtime_boot_v1_bootstrap_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Extension); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_runtime_boot_v1_bootstrap_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BootstrapResult); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_runtime_boot_v1_bootstrap_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RuncV2Extensions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_runtime_boot_v1_bootstrap_proto_rawDesc, + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_runtime_boot_v1_bootstrap_proto_goTypes, + DependencyIndexes: file_runtime_boot_v1_bootstrap_proto_depIdxs, + MessageInfos: file_runtime_boot_v1_bootstrap_proto_msgTypes, + }.Build() + File_runtime_boot_v1_bootstrap_proto = out.File + file_runtime_boot_v1_bootstrap_proto_rawDesc = nil + file_runtime_boot_v1_bootstrap_proto_goTypes = nil + file_runtime_boot_v1_bootstrap_proto_depIdxs = nil +} diff --git a/api/runtime/boot/v1/bootstrap.proto b/api/runtime/boot/v1/bootstrap.proto new file mode 100644 index 0000000000000..ff0aff8a08222 --- /dev/null +++ b/api/runtime/boot/v1/bootstrap.proto @@ -0,0 +1,119 @@ +/* + 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. +*/ + +// Bootstrap Protocol +// +// This protocol defines the interface between containerd and shims at startup. +// It replaces the previous scattered configuration mechanisms (CLI args, env vars, +// stdin JSON, spec.json annotations) with a single, versioned, extensible protocol. +// +// Flow: +// 1. containerd spawns the shim process +// 2. containerd writes BootstrapParams as JSON to shim's stdin +// 3. shim initializes and writes BootstrapResult as JSON to stdout +// 4. containerd connects to the address provided in BootstrapResult +// +// Note: JSON serialization is used to keep shim binaries small since the +// encoding/json package is already part of the Go runtime. The proto +// definition serves as the schema for detecting breaking changes and +// maintaining forward/backward compatibility. +// +// This design enables: +// - Forward/backward compatibility via version field +// - Typed extensibility via google.protobuf.Any and Extension +// - Clear capability negotiation between containerd and shims + +syntax = "proto3"; + +package containerd.runtime.bootstrap.v1; + +import "google/protobuf/any.proto"; + +option go_package = "github.com/containerd/containerd/api/runtime/bootstrap/v1;bootstrap"; + +// BootstrapParams contains all configuration passed from containerd to shim at startup. +message BootstrapParams { + // Container/sandbox ID + string id = 1; + + // Namespace for the container + string namespace = 2; + + // Enable debug messages in logs. + bool enable_debug = 3; + + // Containerd's TTRPC API address (e.g., "unix:///run/containerd/containerd.sock.ttrpc") + string containerd_ttrpc_address = 4; + + // Containerd's gRPC API address (e.g., "unix:///run/containerd/containerd.sock") + string containerd_grpc_address = 5; + + // Socket path to serve. + string socket_path = 6; + + // Debug socket path to serve. + string socket_path_debug = 7; + + // Path to containerd binary for event publishing + string containerd_binary = 8; + + // Extensible configuration sections for new features + // Each section can contain arbitrary structured data identified by type URL + // Examples: CRI config, NRI config, sandbox config, etc. + repeated Extension extensions = 9; +} + +// Extension provides extensibility for new configuration types +// without changing the core BootstrapParams protocol +message Extension { + // Configuration data with embedded type URL + // Examples of type URLs: + // - "containerd.io/cri.v1.PodSandboxConfig" + // - "containerd.io/nri.v1.PluginConfig" + // - "containerd.io/sandbox.v1.SandboxConfig" + google.protobuf.Any value = 1; +} + +// BootstrapResult is returned by shim via stdout after successful startup +message BootstrapResult { + // Version of shim parameters (expected 2 for shim v2) + int32 version = 1; + + // Address where shim is listening (e.g., "unix:///run/containerd/shim.sock") + // Containerd will connect to this address for task operations + string address = 2; + + // Protocol used by shim: "ttrpc" or "grpc" + string protocol = 3; + + // Optional: Capabilities supported by this shim instance + // Allows shim to advertise what features it supports + repeated string capabilities = 4; + + // Optional: Additional metadata from shim + map metadata = 5; +} + +message RuncV2Extensions { + // Annotations are spec annotations read from config.json. + map annotations = 1; + + // Enable core scheduling if available + bool sched_core = 2; + + // Cgroup path to place the shim process into + string shim_cgroup = 3; +} diff --git a/api/runtime/boot/v1/doc.go b/api/runtime/boot/v1/doc.go new file mode 100644 index 0000000000000..c6d9c66aa0f67 --- /dev/null +++ b/api/runtime/boot/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 bootstrap diff --git a/api/runtime/boot/v1/helpers.go b/api/runtime/boot/v1/helpers.go new file mode 100644 index 0000000000000..de1a29d6b090f --- /dev/null +++ b/api/runtime/boot/v1/helpers.go @@ -0,0 +1,57 @@ +/* + 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 bootstrap + +import ( + "fmt" + + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/known/anypb" +) + +// AddExtension adds a new extension to the BootstrapParams. +// The message is wrapped in a google.protobuf.Any with its type URL automatically set. +func (p *BootstrapParams) AddExtension(msg proto.Message) error { + anyVal, err := anypb.New(msg) + if err != nil { + return err + } + + p.Extensions = append(p.Extensions, &Extension{Value: anyVal}) + return nil +} + +func GetExtension[T proto.Message](p *BootstrapParams) (T, error) { + var ( + empty T + reflect = empty.ProtoReflect() + name = reflect.Descriptor().FullName() + out = reflect.New().Interface().(T) + ) + + for _, ext := range p.Extensions { + if ext.GetValue().MessageIs(out) { + if err := ext.GetValue().UnmarshalTo(out); err != nil { + return out, fmt.Errorf("failed to unmarshal extension %q: %w", name, err) + } + + return out, nil + } + } + + return out, fmt.Errorf("extension %q not found", name) +} diff --git a/api/runtime/boot/v1/helpers_test.go b/api/runtime/boot/v1/helpers_test.go new file mode 100644 index 0000000000000..7145ccf3b0a6f --- /dev/null +++ b/api/runtime/boot/v1/helpers_test.go @@ -0,0 +1,42 @@ +/* + 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 bootstrap + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestExtensions(t *testing.T) { + params := &BootstrapParams{} + + err := params.AddExtension(&RuncV2Extensions{SchedCore: true}) + require.NoError(t, err) + + got, err := GetExtension[*RuncV2Extensions](params) + require.NoError(t, err) + + assert.True(t, got.SchedCore) +} +func TestExtensionNotFound(t *testing.T) { + params := &BootstrapParams{} + + _, err := GetExtension[*RuncV2Extensions](params) + assert.Error(t, err) +} From 7f39b2d9338b86e84b3c794eef10572b90f35a1b Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Fri, 23 Jan 2026 16:01:22 -0800 Subject: [PATCH 02/28] Update shim to support new bootstrap api Signed-off-by: Maksym Pavlenko --- .../manager/manager_linux.go | 97 ++++++++----------- core/runtime/v2/binary.go | 2 +- core/runtime/v2/example/example.go | 4 +- core/runtime/v2/shim.go | 20 ++-- core/runtime/v2/shim_manager.go | 20 ++-- core/runtime/v2/shim_test.go | 14 +-- pkg/shim/compat.go | 79 +++++++++++++++ pkg/shim/shim.go | 36 +++---- 8 files changed, 161 insertions(+), 111 deletions(-) create mode 100644 pkg/shim/compat.go diff --git a/cmd/containerd-shim-runc-v2/manager/manager_linux.go b/cmd/containerd-shim-runc-v2/manager/manager_linux.go index 0e051a3a13f40..aec8253b1604a 100644 --- a/cmd/containerd-shim-runc-v2/manager/manager_linux.go +++ b/cmd/containerd-shim-runc-v2/manager/manager_linux.go @@ -34,6 +34,7 @@ import ( "github.com/containerd/cgroups/v3" "github.com/containerd/cgroups/v3/cgroup1" cgroupsv2 "github.com/containerd/cgroups/v3/cgroup2" + boot "github.com/containerd/containerd/api/runtime/boot/v1" "github.com/containerd/containerd/api/types" "github.com/containerd/containerd/api/types/runc/options" "github.com/containerd/containerd/v2/cmd/containerd-shim-runc-v2/process" @@ -67,14 +68,6 @@ var groupLabels = []string{ "io.kubernetes.cri.sandbox-id", } -// spec is a shallow version of [oci.Spec] containing only the -// fields we need for the hook. We use a shallow struct to reduce -// the overhead of unmarshaling. -type spec struct { - // Annotations contains arbitrary metadata for the container. - Annotations map[string]string `json:"annotations,omitempty"` -} - type manager struct { name string } @@ -110,20 +103,6 @@ func newCommand(ctx context.Context, id, containerdAddress, containerdTTRPCAddre return cmd, nil } -func readSpec() (*spec, error) { - const configFileName = "config.json" - f, err := os.Open(configFileName) - if err != nil { - return nil, err - } - defer f.Close() - var s spec - if err := json.NewDecoder(f).Decode(&s); err != nil { - return nil, err - } - return &s, nil -} - func (m manager) Name() string { return m.name } @@ -181,22 +160,26 @@ func newShimSocket(ctx context.Context, path, id string, debug bool) (*shimSocke return s, nil } -func (manager) Start(ctx context.Context, id string, opts shim.StartOpts) (_ shim.BootstrapParams, retErr error) { - var params shim.BootstrapParams +func (manager) Start(ctx context.Context, opts *shim.BootstrapParams) (_ *shim.BootstrapResult, retErr error) { + var params shim.BootstrapResult params.Version = 3 params.Protocol = "ttrpc" - cmd, err := newCommand(ctx, id, opts.Address, opts.TTRPCAddress, opts.Debug) + id := opts.GetID() + + cmd, err := newCommand(ctx, id, opts.GetContainerdGrpcAddress(), opts.GetContainerdTtrpcAddress(), opts.GetEnableDebug()) if err != nil { - return params, err + return nil, err } grouping := id - spec, err := readSpec() + + runcExt, err := boot.GetExtension[*boot.RuncV2Extensions](opts) if err != nil { - return params, err + return nil, fmt.Errorf("failed to fetch runc v2 extensions: %w", err) } + for _, group := range groupLabels { - if groupID, ok := spec.Annotations[group]; ok { + if groupID, ok := runcExt.Annotations[group]; ok { grouping = groupID break } @@ -211,35 +194,35 @@ func (manager) Start(ctx context.Context, id string, opts shim.StartOpts) (_ shi } }() - s, err := newShimSocket(ctx, opts.Address, grouping, false) + s, err := newShimSocket(ctx, opts.GetContainerdGrpcAddress(), grouping, false) if err != nil { if errdefs.IsAlreadyExists(err) { params.Address = s.addr - return params, nil + return ¶ms, nil } - return params, err + return nil, err } sockets = append(sockets, s) cmd.ExtraFiles = append(cmd.ExtraFiles, s.f) - if opts.Debug { - s, err = newShimSocket(ctx, opts.Address, grouping, true) + if opts.GetEnableDebug() { + s, err = newShimSocket(ctx, opts.GetContainerdGrpcAddress(), grouping, true) if err != nil { - return params, err + return nil, err } sockets = append(sockets, s) cmd.ExtraFiles = append(cmd.ExtraFiles, s.f) } goruntime.LockOSThread() - if os.Getenv("SCHED_CORE") != "" { + if runcExt.GetSchedCore() { if err := schedcore.Create(schedcore.ProcessGroup); err != nil { - return params, fmt.Errorf("enable sched core support: %w", err) + return nil, fmt.Errorf("enable sched core support: %w", err) } } if err := cmd.Start(); err != nil { - return params, err + return nil, err } goruntime.UnlockOSThread() @@ -252,34 +235,32 @@ func (manager) Start(ctx context.Context, id string, opts shim.StartOpts) (_ shi // make sure to wait after start go cmd.Wait() - if opts, err := shim.ReadRuntimeOptions[*options.Options](os.Stdin); err == nil { - if opts.ShimCgroup != "" { - if cgroups.Mode() == cgroups.Unified { - cg, err := cgroupsv2.Load(opts.ShimCgroup) - if err != nil { - return params, fmt.Errorf("failed to load cgroup %s: %w", opts.ShimCgroup, err) - } - if err := cg.AddProc(uint64(cmd.Process.Pid)); err != nil { - return params, fmt.Errorf("failed to join cgroup %s: %w", opts.ShimCgroup, err) - } - } else { - cg, err := cgroup1.Load(cgroup1.StaticPath(opts.ShimCgroup)) - if err != nil { - return params, fmt.Errorf("failed to load cgroup %s: %w", opts.ShimCgroup, err) - } - if err := cg.AddProc(uint64(cmd.Process.Pid)); err != nil { - return params, fmt.Errorf("failed to join cgroup %s: %w", opts.ShimCgroup, err) - } + if shimCgroup := runcExt.GetShimCgroup(); shimCgroup != "" { + if cgroups.Mode() == cgroups.Unified { + cg, err := cgroupsv2.Load(shimCgroup) + if err != nil { + return nil, fmt.Errorf("failed to load cgroup %s: %w", shimCgroup, err) + } + if err := cg.AddProc(uint64(cmd.Process.Pid)); err != nil { + return nil, fmt.Errorf("failed to join cgroup %s: %w", shimCgroup, err) + } + } else { + cg, err := cgroup1.Load(cgroup1.StaticPath(shimCgroup)) + if err != nil { + return nil, fmt.Errorf("failed to load cgroup %s: %w", shimCgroup, err) + } + if err := cg.AddProc(uint64(cmd.Process.Pid)); err != nil { + return nil, fmt.Errorf("failed to join cgroup %s: %w", shimCgroup, err) } } } if err := shim.AdjustOOMScore(cmd.Process.Pid); err != nil { - return params, fmt.Errorf("failed to adjust OOM score for shim: %w", err) + return nil, fmt.Errorf("failed to adjust OOM score for shim: %w", err) } params.Address = sockets[0].addr - return params, nil + return ¶ms, nil } func (manager) Stop(ctx context.Context, id string) (shim.StopStatus, error) { diff --git a/core/runtime/v2/binary.go b/core/runtime/v2/binary.go index d04881cf85d6b..0aa21ab91dd44 100644 --- a/core/runtime/v2/binary.go +++ b/core/runtime/v2/binary.go @@ -149,7 +149,7 @@ func (b *binary) Start(ctx context.Context, opts *types.Any, onClose func()) (_ bundle: b.bundle, client: conn, address: address, - version: params.Version, + version: int(params.Version), }, nil } diff --git a/core/runtime/v2/example/example.go b/core/runtime/v2/example/example.go index 25fccf93dab3d..2745852ed657b 100644 --- a/core/runtime/v2/example/example.go +++ b/core/runtime/v2/example/example.go @@ -67,8 +67,8 @@ func (m manager) Name() string { return m.name } -func (m manager) Start(ctx context.Context, id string, opts shim.StartOpts) (shim.BootstrapParams, error) { - return shim.BootstrapParams{}, errdefs.ErrNotImplemented +func (m manager) Start(ctx context.Context, opts *shim.BootstrapParams) (*shim.BootstrapResult, error) { + return nil, errdefs.ErrNotImplemented } func (m manager) Stop(ctx context.Context, id string) (shim.StopStatus, error) { diff --git a/core/runtime/v2/shim.go b/core/runtime/v2/shim.go index 1358462ec8cc7..f80177ebd47cf 100644 --- a/core/runtime/v2/shim.go +++ b/core/runtime/v2/shim.go @@ -128,7 +128,7 @@ func loadShim(ctx context.Context, bundle *Bundle, onClose func()) (_ ShimInstan bundle: bundle, client: conn, address: address, - version: params.Version, + version: int(params.Version), } return shim, nil @@ -219,8 +219,8 @@ type clientVersionDowngrader interface { Downgrade() error } -func parseStartResponse(response []byte) (client.BootstrapParams, error) { - var params client.BootstrapParams +func parseStartResponse(response []byte) (*client.BootstrapResult, error) { + var params client.BootstrapResult if err := json.Unmarshal(response, ¶ms); err != nil || params.Version < 2 { // Use TTRPC for legacy shims @@ -230,14 +230,14 @@ func parseStartResponse(response []byte) (client.BootstrapParams, error) { } if params.Version > CurrentShimVersion { - return client.BootstrapParams{}, fmt.Errorf("unsupported shim version (%d): %w", params.Version, errdefs.ErrNotImplemented) + return nil, fmt.Errorf("unsupported shim version (%d): %w", params.Version, errdefs.ErrNotImplemented) } - return params, nil + return ¶ms, nil } // writeBootstrapParams writes shim's bootstrap configuration (e.g. how to connect, version, etc). -func writeBootstrapParams(path string, params client.BootstrapParams) error { +func writeBootstrapParams(path string, params *client.BootstrapResult) error { path, err := filepath.Abs(path) if err != nil { return err @@ -262,15 +262,15 @@ func writeBootstrapParams(path string, params client.BootstrapParams) error { return f.Close() } -func readBootstrapParams(path string) (client.BootstrapParams, error) { +func readBootstrapParams(path string) (*client.BootstrapResult, error) { path, err := filepath.Abs(path) if err != nil { - return client.BootstrapParams{}, err + return nil, err } data, err := os.ReadFile(path) if err != nil { - return client.BootstrapParams{}, err + return nil, err } return parseStartResponse(data) @@ -278,7 +278,7 @@ func readBootstrapParams(path string) (client.BootstrapParams, error) { // makeConnection creates a new TTRPC or GRPC connection object from address. // address can be either a socket path for TTRPC or JSON serialized BootstrapParams. -func makeConnection(ctx context.Context, id string, params client.BootstrapParams, onClose func()) (_ io.Closer, retErr error) { +func makeConnection(ctx context.Context, id string, params *client.BootstrapResult, onClose func()) (_ io.Closer, retErr error) { log.G(ctx).WithFields(log.Fields{ "address": params.Address, "protocol": params.Protocol, diff --git a/core/runtime/v2/shim_manager.go b/core/runtime/v2/shim_manager.go index 637da90d08df9..4aae8bce9f6c4 100644 --- a/core/runtime/v2/shim_manager.go +++ b/core/runtime/v2/shim_manager.go @@ -169,7 +169,7 @@ func (m *ShimManager) ID() string { func (m *ShimManager) Start(ctx context.Context, id string, bundle *Bundle, opts runtime.CreateOpts) (_ ShimInstance, retErr error) { shouldInvokeShimBinary := false - var params shimbinary.BootstrapParams + var params = &shimbinary.BootstrapResult{} if opts.SandboxID != "" { _, sbErr := m.sandboxStore.Get(ctx, opts.SandboxID) if sbErr != nil { @@ -193,8 +193,8 @@ func (m *ShimManager) Start(ctx context.Context, id string, bundle *Bundle, opts return nil, fmt.Errorf("the scheme of sandbox address should be in " + " the form of +, i.e. ttrpc+unix or grpc+vsock") } - params = shimbinary.BootstrapParams{ - Version: int(opts.Version), + params = &shimbinary.BootstrapResult{ + Version: int32(opts.Version), Protocol: protocol, Address: address, } @@ -310,34 +310,34 @@ func (m *ShimManager) startShim(ctx context.Context, bundle *Bundle, id string, // restoreBootstrapParams reads bootstrap.json to restore shim configuration. // If its an old shim, this will perform migration - read address file and write default bootstrap // configuration (version = 2, protocol = ttrpc, and address). -func restoreBootstrapParams(bundlePath string) (shimbinary.BootstrapParams, error) { +func restoreBootstrapParams(bundlePath string) (*shimbinary.BootstrapResult, error) { filePath := filepath.Join(bundlePath, "bootstrap.json") // Read bootstrap.json if exists if _, err := os.Stat(filePath); err == nil { return readBootstrapParams(filePath) } else if !errors.Is(err, os.ErrNotExist) { - return shimbinary.BootstrapParams{}, fmt.Errorf("failed to stat %s: %w", filePath, err) + return nil, fmt.Errorf("failed to stat %s: %w", filePath, err) } // File not found, likely its an older shim. Try migrate. address, err := shimbinary.ReadAddress(filepath.Join(bundlePath, "address")) if err != nil { - return shimbinary.BootstrapParams{}, fmt.Errorf("unable to migrate shim: failed to get socket address for bundle %s: %w", bundlePath, err) + return nil, fmt.Errorf("unable to migrate shim: failed to get socket address for bundle %s: %w", bundlePath, err) } - params := shimbinary.BootstrapParams{ + params := shimbinary.BootstrapResult{ Version: 2, Address: address, Protocol: "ttrpc", } - if err := writeBootstrapParams(filePath, params); err != nil { - return shimbinary.BootstrapParams{}, fmt.Errorf("unable to migrate: failed to write bootstrap.json file: %w", err) + if err := writeBootstrapParams(filePath, ¶ms); err != nil { + return nil, fmt.Errorf("unable to migrate: failed to write bootstrap.json file: %w", err) } - return params, nil + return ¶ms, nil } func (m *ShimManager) resolveRuntimePath(runtime string) (string, error) { diff --git a/core/runtime/v2/shim_test.go b/core/runtime/v2/shim_test.go index 025022a87fc5a..063fb318a3d50 100644 --- a/core/runtime/v2/shim_test.go +++ b/core/runtime/v2/shim_test.go @@ -31,13 +31,13 @@ func TestParseStartResponse(t *testing.T) { for _, tc := range []struct { Name string Response string - Expected client.BootstrapParams + Expected client.BootstrapResult Err error }{ { Name: "v2 shim", Response: "/somedirectory/somesocket", - Expected: client.BootstrapParams{ + Expected: client.BootstrapResult{ Version: 2, Address: "/somedirectory/somesocket", Protocol: "ttrpc", @@ -46,7 +46,7 @@ func TestParseStartResponse(t *testing.T) { { Name: "v2 shim using grpc", Response: `{"version":2,"address":"/somedirectory/somesocket","protocol":"grpc"}`, - Expected: client.BootstrapParams{ + Expected: client.BootstrapResult{ Version: 2, Address: "/somedirectory/somesocket", Protocol: "grpc", @@ -55,7 +55,7 @@ func TestParseStartResponse(t *testing.T) { { Name: "v2 shim using ttrpc", Response: `{"version":2,"address":"/somedirectory/somesocket","protocol":"ttrpc"}`, - Expected: client.BootstrapParams{ + Expected: client.BootstrapResult{ Version: 2, Address: "/somedirectory/somesocket", Protocol: "ttrpc", @@ -64,7 +64,7 @@ func TestParseStartResponse(t *testing.T) { { Name: "invalid shim v2 response", Response: `{"address":"/somedirectory/somesocket","protocol":"ttrpc"}`, - Expected: client.BootstrapParams{ + Expected: client.BootstrapResult{ Version: 2, Address: `{"address":"/somedirectory/somesocket","protocol":"ttrpc"}`, Protocol: "ttrpc", @@ -73,7 +73,7 @@ func TestParseStartResponse(t *testing.T) { { Name: "later unsupported shim", Response: `{"Version": 4,"Address":"/somedirectory/somesocket","Protocol":"ttrpc"}`, - Expected: client.BootstrapParams{}, + Expected: client.BootstrapResult{}, Err: errdefs.ErrNotImplemented, }, } { @@ -109,7 +109,7 @@ func TestRestoreBootstrapParams(t *testing.T) { restored, err := restoreBootstrapParams(bundlePath) require.NoError(t, err) - expected := client.BootstrapParams{ + expected := &client.BootstrapResult{ Version: 2, Address: "unix://123", Protocol: "ttrpc", diff --git a/pkg/shim/compat.go b/pkg/shim/compat.go new file mode 100644 index 0000000000000..5ee1b56e01667 --- /dev/null +++ b/pkg/shim/compat.go @@ -0,0 +1,79 @@ +/* + 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 shim + +// This file contains the compatibility layer between the new shim bootstrap +// protocol (see https://github.com/containerd/containerd/pull/12786) and the +// old shim APIs (prior containerd 2.3), which mainly relies on CLI, env vars, stdin, and spec.json annotations. +// Once settled, this file should be removed. + +import ( + "encoding/json" + "os" + + bootapi "github.com/containerd/containerd/api/runtime/boot/v1" + "github.com/containerd/containerd/api/types/runc/options" +) + +func readBootstrapParamsFromDeprecatedFields(params *BootstrapParams) error { + params.ID = id + params.Namespace = namespaceFlag + params.ContainerdTtrpcAddress = os.Getenv(ttrpcAddressEnv) + params.ContainerdGrpcAddress = os.Getenv(grpcAddressEnv) + params.SocketPath = socketFlag + params.SocketPathDebug = debugSocketFlag + params.ContainerdBinary = containerdBinaryFlag + params.EnableDebug = debugFlag + + // Runc v2 specific fields (implemented as an extensions in the new boot API) + + var runcExt bootapi.RuncV2Extensions + + runcExt.SchedCore = os.Getenv("SCHED_CORE") != "" + + if opts, err := ReadRuntimeOptions[*options.Options](os.Stdin); err == nil { + runcExt.ShimCgroup = opts.ShimCgroup + } + + if spec, err := readSpec(); err == nil { + runcExt.Annotations = spec.Annotations + } + + return params.AddExtension(&runcExt) +} + +// spec is a shallow version of [oci.Spec] used by Runc V2 shim, +// containing only the fields we need for the hook. We use a shallow struct to reduce +// the overhead of unmarshaling. +type spec struct { + // Annotations contains arbitrary metadata for the container. + Annotations map[string]string `json:"annotations,omitempty"` +} + +func readSpec() (*spec, error) { + const configFileName = "config.json" + f, err := os.Open(configFileName) + if err != nil { + return nil, err + } + defer f.Close() + var s spec + if err := json.NewDecoder(f).Decode(&s); err != nil { + return nil, err + } + return &s, nil +} diff --git a/pkg/shim/shim.go b/pkg/shim/shim.go index e57bf5634b497..83e18de8acc79 100644 --- a/pkg/shim/shim.go +++ b/pkg/shim/shim.go @@ -30,8 +30,10 @@ import ( "runtime/debug" "time" + bootapi "github.com/containerd/containerd/api/runtime/boot/v1" shimapi "github.com/containerd/containerd/api/runtime/task/v3" "github.com/containerd/containerd/api/types" + "github.com/containerd/containerd/v2/core/events" "github.com/containerd/containerd/v2/pkg/namespaces" "github.com/containerd/containerd/v2/pkg/protobuf" @@ -51,22 +53,8 @@ type Publisher interface { io.Closer } -// StartOpts describes shim start configuration received from containerd -type StartOpts struct { - Address string - TTRPCAddress string - Debug bool -} - -// BootstrapParams is a JSON payload returned in stdout from shim.Start call. -type BootstrapParams struct { - // Version is the version of shim parameters (expected 2 for shim v2) - Version int `json:"version"` - // Address is a address containerd should use to connect to shim. - Address string `json:"address"` - // Protocol is either TTRPC or GRPC. - Protocol string `json:"protocol"` -} +type BootstrapParams = bootapi.BootstrapParams +type BootstrapResult = bootapi.BootstrapResult type StopStatus struct { Pid int @@ -77,7 +65,7 @@ type StopStatus struct { // Manager is the interface which manages the shim process type Manager interface { Name() string - Start(ctx context.Context, id string, opts StartOpts) (BootstrapParams, error) + Start(ctx context.Context, params *BootstrapParams) (*BootstrapResult, error) Stop(ctx context.Context, id string) (StopStatus, error) Info(ctx context.Context, optionsR io.Reader) (*types.RuntimeInfo, error) } @@ -286,18 +274,20 @@ func run(ctx context.Context, manager Manager, config Config) error { } return nil case "start": - opts := StartOpts{ - Address: addressFlag, - TTRPCAddress: ttrpcAddress, - Debug: debugFlag, + var params bootapi.BootstrapParams + if err := json.NewDecoder(os.Stdin).Decode(¶ms); err != nil { + // TODO: Return error once the new API is stable + if err := readBootstrapParamsFromDeprecatedFields(¶ms); err != nil { + return err + } } - params, err := manager.Start(ctx, id, opts) + result, err := manager.Start(ctx, ¶ms) if err != nil { return err } - data, err := json.Marshal(¶ms) + data, err := json.Marshal(result) if err != nil { return fmt.Errorf("failed to marshal bootstrap params to json: %w", err) } From e72145b192de6542dfb86554cda512e37f46eb5e Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Fri, 23 Jan 2026 16:11:41 -0800 Subject: [PATCH 03/28] Update vendor Signed-off-by: Maksym Pavlenko --- api/go.mod | 3 + api/go.sum | 5 + .../api/runtime/boot/v1/bootstrap.pb.go | 577 ++++++++++++++++++ .../api/runtime/boot/v1/bootstrap.proto | 119 ++++ .../containerd/api/runtime/boot/v1/doc.go | 17 + .../containerd/api/runtime/boot/v1/helpers.go | 57 ++ vendor/modules.txt | 1 + 7 files changed, 779 insertions(+) create mode 100644 vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.pb.go create mode 100644 vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.proto create mode 100644 vendor/github.com/containerd/containerd/api/runtime/boot/v1/doc.go create mode 100644 vendor/github.com/containerd/containerd/api/runtime/boot/v1/helpers.go diff --git a/api/go.mod b/api/go.mod index 8f975f3e3c34d..ea28cfa773e29 100644 --- a/api/go.mod +++ b/api/go.mod @@ -6,6 +6,7 @@ require ( github.com/containerd/ttrpc v1.2.5 github.com/containerd/typeurl/v2 v2.1.1 github.com/opencontainers/image-spec v1.1.1 + github.com/stretchr/testify v1.8.2 google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 google.golang.org/grpc v1.79.3 google.golang.org/protobuf v1.36.10 @@ -13,8 +14,10 @@ require ( require ( github.com/containerd/log v0.1.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect github.com/sirupsen/logrus v1.9.3 // indirect golang.org/x/net v0.48.0 // indirect golang.org/x/sys v0.39.0 // indirect diff --git a/api/go.sum b/api/go.sum index 12cfc45caba1a..003a6f31bb1a2 100644 --- a/api/go.sum +++ b/api/go.sum @@ -36,7 +36,11 @@ github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1 github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -95,6 +99,7 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE= google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.pb.go b/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.pb.go new file mode 100644 index 0000000000000..aa0aafbe25d32 --- /dev/null +++ b/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.pb.go @@ -0,0 +1,577 @@ +// +//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. + +// Bootstrap Protocol +// +// This protocol defines the interface between containerd and shims at startup. +// It replaces the previous scattered configuration mechanisms (CLI args, env vars, +// stdin JSON, spec.json annotations) with a single, versioned, extensible protocol. +// +// Flow: +// 1. containerd spawns the shim process +// 2. containerd writes BootstrapParams as JSON to shim's stdin +// 3. shim initializes and writes BootstrapResult as JSON to stdout +// 4. containerd connects to the address provided in BootstrapResult +// +// Note: JSON serialization is used to keep shim binaries small since the +// encoding/json package is already part of the Go runtime. The proto +// definition serves as the schema for detecting breaking changes and +// maintaining forward/backward compatibility. +// +// This design enables: +// - Forward/backward compatibility via version field +// - Typed extensibility via google.protobuf.Any and Extension +// - Clear capability negotiation between containerd and shims + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: runtime/boot/v1/bootstrap.proto + +package bootstrap + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + anypb "google.golang.org/protobuf/types/known/anypb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// BootstrapParams contains all configuration passed from containerd to shim at startup. +type BootstrapParams struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Container/sandbox ID + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // Namespace for the container + Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"` + // Enable debug messages in logs. + EnableDebug bool `protobuf:"varint,3,opt,name=enable_debug,json=enableDebug,proto3" json:"enable_debug,omitempty"` + // Containerd's TTRPC API address (e.g., "unix:///run/containerd/containerd.sock.ttrpc") + ContainerdTtrpcAddress string `protobuf:"bytes,4,opt,name=containerd_ttrpc_address,json=containerdTtrpcAddress,proto3" json:"containerd_ttrpc_address,omitempty"` + // Containerd's gRPC API address (e.g., "unix:///run/containerd/containerd.sock") + ContainerdGrpcAddress string `protobuf:"bytes,5,opt,name=containerd_grpc_address,json=containerdGrpcAddress,proto3" json:"containerd_grpc_address,omitempty"` + // Socket path to serve. + SocketPath string `protobuf:"bytes,6,opt,name=socket_path,json=socketPath,proto3" json:"socket_path,omitempty"` + // Debug socket path to serve. + SocketPathDebug string `protobuf:"bytes,7,opt,name=socket_path_debug,json=socketPathDebug,proto3" json:"socket_path_debug,omitempty"` + // Path to containerd binary for event publishing + ContainerdBinary string `protobuf:"bytes,8,opt,name=containerd_binary,json=containerdBinary,proto3" json:"containerd_binary,omitempty"` + // Extensible configuration sections for new features + // Each section can contain arbitrary structured data identified by type URL + // Examples: CRI config, NRI config, sandbox config, etc. + Extensions []*Extension `protobuf:"bytes,9,rep,name=extensions,proto3" json:"extensions,omitempty"` +} + +func (x *BootstrapParams) Reset() { + *x = BootstrapParams{} + if protoimpl.UnsafeEnabled { + mi := &file_runtime_boot_v1_bootstrap_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BootstrapParams) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BootstrapParams) ProtoMessage() {} + +func (x *BootstrapParams) ProtoReflect() protoreflect.Message { + mi := &file_runtime_boot_v1_bootstrap_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BootstrapParams.ProtoReflect.Descriptor instead. +func (*BootstrapParams) Descriptor() ([]byte, []int) { + return file_runtime_boot_v1_bootstrap_proto_rawDescGZIP(), []int{0} +} + +func (x *BootstrapParams) GetID() string { + if x != nil { + return x.ID + } + return "" +} + +func (x *BootstrapParams) GetNamespace() string { + if x != nil { + return x.Namespace + } + return "" +} + +func (x *BootstrapParams) GetEnableDebug() bool { + if x != nil { + return x.EnableDebug + } + return false +} + +func (x *BootstrapParams) GetContainerdTtrpcAddress() string { + if x != nil { + return x.ContainerdTtrpcAddress + } + return "" +} + +func (x *BootstrapParams) GetContainerdGrpcAddress() string { + if x != nil { + return x.ContainerdGrpcAddress + } + return "" +} + +func (x *BootstrapParams) GetSocketPath() string { + if x != nil { + return x.SocketPath + } + return "" +} + +func (x *BootstrapParams) GetSocketPathDebug() string { + if x != nil { + return x.SocketPathDebug + } + return "" +} + +func (x *BootstrapParams) GetContainerdBinary() string { + if x != nil { + return x.ContainerdBinary + } + return "" +} + +func (x *BootstrapParams) GetExtensions() []*Extension { + if x != nil { + return x.Extensions + } + return nil +} + +// Extension provides extensibility for new configuration types +// without changing the core BootstrapParams protocol +type Extension struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Configuration data with embedded type URL + // Examples of type URLs: + // - "containerd.io/cri.v1.PodSandboxConfig" + // - "containerd.io/nri.v1.PluginConfig" + // - "containerd.io/sandbox.v1.SandboxConfig" + Value *anypb.Any `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *Extension) Reset() { + *x = Extension{} + if protoimpl.UnsafeEnabled { + mi := &file_runtime_boot_v1_bootstrap_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Extension) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Extension) ProtoMessage() {} + +func (x *Extension) ProtoReflect() protoreflect.Message { + mi := &file_runtime_boot_v1_bootstrap_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Extension.ProtoReflect.Descriptor instead. +func (*Extension) Descriptor() ([]byte, []int) { + return file_runtime_boot_v1_bootstrap_proto_rawDescGZIP(), []int{1} +} + +func (x *Extension) GetValue() *anypb.Any { + if x != nil { + return x.Value + } + return nil +} + +// BootstrapResult is returned by shim via stdout after successful startup +type BootstrapResult struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Version of shim parameters (expected 2 for shim v2) + Version int32 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"` + // Address where shim is listening (e.g., "unix:///run/containerd/shim.sock") + // Containerd will connect to this address for task operations + Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` + // Protocol used by shim: "ttrpc" or "grpc" + Protocol string `protobuf:"bytes,3,opt,name=protocol,proto3" json:"protocol,omitempty"` + // Optional: Capabilities supported by this shim instance + // Allows shim to advertise what features it supports + Capabilities []string `protobuf:"bytes,4,rep,name=capabilities,proto3" json:"capabilities,omitempty"` + // Optional: Additional metadata from shim + Metadata map[string]string `protobuf:"bytes,5,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (x *BootstrapResult) Reset() { + *x = BootstrapResult{} + if protoimpl.UnsafeEnabled { + mi := &file_runtime_boot_v1_bootstrap_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BootstrapResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BootstrapResult) ProtoMessage() {} + +func (x *BootstrapResult) ProtoReflect() protoreflect.Message { + mi := &file_runtime_boot_v1_bootstrap_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BootstrapResult.ProtoReflect.Descriptor instead. +func (*BootstrapResult) Descriptor() ([]byte, []int) { + return file_runtime_boot_v1_bootstrap_proto_rawDescGZIP(), []int{2} +} + +func (x *BootstrapResult) GetVersion() int32 { + if x != nil { + return x.Version + } + return 0 +} + +func (x *BootstrapResult) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +func (x *BootstrapResult) GetProtocol() string { + if x != nil { + return x.Protocol + } + return "" +} + +func (x *BootstrapResult) GetCapabilities() []string { + if x != nil { + return x.Capabilities + } + return nil +} + +func (x *BootstrapResult) GetMetadata() map[string]string { + if x != nil { + return x.Metadata + } + return nil +} + +type RuncV2Extensions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Annotations are spec annotations read from config.json. + Annotations map[string]string `protobuf:"bytes,1,rep,name=annotations,proto3" json:"annotations,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // Enable core scheduling if available + SchedCore bool `protobuf:"varint,2,opt,name=sched_core,json=schedCore,proto3" json:"sched_core,omitempty"` + // Cgroup path to place the shim process into + ShimCgroup string `protobuf:"bytes,3,opt,name=shim_cgroup,json=shimCgroup,proto3" json:"shim_cgroup,omitempty"` +} + +func (x *RuncV2Extensions) Reset() { + *x = RuncV2Extensions{} + if protoimpl.UnsafeEnabled { + mi := &file_runtime_boot_v1_bootstrap_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RuncV2Extensions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RuncV2Extensions) ProtoMessage() {} + +func (x *RuncV2Extensions) ProtoReflect() protoreflect.Message { + mi := &file_runtime_boot_v1_bootstrap_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RuncV2Extensions.ProtoReflect.Descriptor instead. +func (*RuncV2Extensions) Descriptor() ([]byte, []int) { + return file_runtime_boot_v1_bootstrap_proto_rawDescGZIP(), []int{3} +} + +func (x *RuncV2Extensions) GetAnnotations() map[string]string { + if x != nil { + return x.Annotations + } + return nil +} + +func (x *RuncV2Extensions) GetSchedCore() bool { + if x != nil { + return x.SchedCore + } + return false +} + +func (x *RuncV2Extensions) GetShimCgroup() string { + if x != nil { + return x.ShimCgroup + } + return "" +} + +var File_runtime_boot_v1_bootstrap_proto protoreflect.FileDescriptor + +var file_runtime_boot_v1_bootstrap_proto_rawDesc = []byte{ + 0x0a, 0x1f, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x2f, 0x76, + 0x31, 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x1f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, + 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, + 0x76, 0x31, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9a, 0x03, + 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, + 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, + 0x21, 0x0a, 0x0c, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x64, 0x65, 0x62, 0x75, 0x67, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x44, 0x65, 0x62, + 0x75, 0x67, 0x12, 0x38, 0x0a, 0x18, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, + 0x5f, 0x74, 0x74, 0x72, 0x70, 0x63, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x16, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, + 0x54, 0x74, 0x72, 0x70, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x36, 0x0a, 0x17, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, 0x67, 0x72, 0x70, 0x63, 0x5f, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x63, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x47, 0x72, 0x70, 0x63, 0x41, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x5f, 0x70, + 0x61, 0x74, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x6f, 0x63, 0x6b, 0x65, + 0x74, 0x50, 0x61, 0x74, 0x68, 0x12, 0x2a, 0x0a, 0x11, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x5f, + 0x70, 0x61, 0x74, 0x68, 0x5f, 0x64, 0x65, 0x62, 0x75, 0x67, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0f, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x50, 0x61, 0x74, 0x68, 0x44, 0x65, 0x62, 0x75, + 0x67, 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, + 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x12, 0x4a, + 0x0a, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x09, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, + 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, + 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0a, + 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x37, 0x0a, 0x09, 0x45, 0x78, + 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x22, 0x9e, 0x02, 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, + 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x61, 0x70, 0x61, 0x62, + 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x63, + 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x5a, 0x0a, 0x08, 0x6d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3e, 0x2e, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, + 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, + 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x2e, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x3a, 0x02, 0x38, 0x01, 0x22, 0xf8, 0x01, 0x0a, 0x10, 0x52, 0x75, 0x6e, 0x63, 0x56, 0x32, 0x45, + 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x64, 0x0a, 0x0b, 0x61, 0x6e, 0x6e, + 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x42, + 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, + 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, + 0x2e, 0x52, 0x75, 0x6e, 0x63, 0x56, 0x32, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, + 0x73, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x52, 0x0b, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, + 0x1d, 0x0a, 0x0a, 0x73, 0x63, 0x68, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x09, 0x73, 0x63, 0x68, 0x65, 0x64, 0x43, 0x6f, 0x72, 0x65, 0x12, 0x1f, + 0x0a, 0x0b, 0x73, 0x68, 0x69, 0x6d, 0x5f, 0x63, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x68, 0x69, 0x6d, 0x43, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x1a, + 0x3e, 0x0a, 0x10, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, + 0x45, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, + 0x65, 0x72, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2f, + 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2f, 0x76, 0x31, 0x3b, 0x62, 0x6f, 0x6f, + 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_runtime_boot_v1_bootstrap_proto_rawDescOnce sync.Once + file_runtime_boot_v1_bootstrap_proto_rawDescData = file_runtime_boot_v1_bootstrap_proto_rawDesc +) + +func file_runtime_boot_v1_bootstrap_proto_rawDescGZIP() []byte { + file_runtime_boot_v1_bootstrap_proto_rawDescOnce.Do(func() { + file_runtime_boot_v1_bootstrap_proto_rawDescData = protoimpl.X.CompressGZIP(file_runtime_boot_v1_bootstrap_proto_rawDescData) + }) + return file_runtime_boot_v1_bootstrap_proto_rawDescData +} + +var file_runtime_boot_v1_bootstrap_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_runtime_boot_v1_bootstrap_proto_goTypes = []interface{}{ + (*BootstrapParams)(nil), // 0: containerd.runtime.bootstrap.v1.BootstrapParams + (*Extension)(nil), // 1: containerd.runtime.bootstrap.v1.Extension + (*BootstrapResult)(nil), // 2: containerd.runtime.bootstrap.v1.BootstrapResult + (*RuncV2Extensions)(nil), // 3: containerd.runtime.bootstrap.v1.RuncV2Extensions + nil, // 4: containerd.runtime.bootstrap.v1.BootstrapResult.MetadataEntry + nil, // 5: containerd.runtime.bootstrap.v1.RuncV2Extensions.AnnotationsEntry + (*anypb.Any)(nil), // 6: google.protobuf.Any +} +var file_runtime_boot_v1_bootstrap_proto_depIdxs = []int32{ + 1, // 0: containerd.runtime.bootstrap.v1.BootstrapParams.extensions:type_name -> containerd.runtime.bootstrap.v1.Extension + 6, // 1: containerd.runtime.bootstrap.v1.Extension.value:type_name -> google.protobuf.Any + 4, // 2: containerd.runtime.bootstrap.v1.BootstrapResult.metadata:type_name -> containerd.runtime.bootstrap.v1.BootstrapResult.MetadataEntry + 5, // 3: containerd.runtime.bootstrap.v1.RuncV2Extensions.annotations:type_name -> containerd.runtime.bootstrap.v1.RuncV2Extensions.AnnotationsEntry + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_runtime_boot_v1_bootstrap_proto_init() } +func file_runtime_boot_v1_bootstrap_proto_init() { + if File_runtime_boot_v1_bootstrap_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_runtime_boot_v1_bootstrap_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BootstrapParams); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_runtime_boot_v1_bootstrap_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Extension); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_runtime_boot_v1_bootstrap_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BootstrapResult); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_runtime_boot_v1_bootstrap_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RuncV2Extensions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_runtime_boot_v1_bootstrap_proto_rawDesc, + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_runtime_boot_v1_bootstrap_proto_goTypes, + DependencyIndexes: file_runtime_boot_v1_bootstrap_proto_depIdxs, + MessageInfos: file_runtime_boot_v1_bootstrap_proto_msgTypes, + }.Build() + File_runtime_boot_v1_bootstrap_proto = out.File + file_runtime_boot_v1_bootstrap_proto_rawDesc = nil + file_runtime_boot_v1_bootstrap_proto_goTypes = nil + file_runtime_boot_v1_bootstrap_proto_depIdxs = nil +} diff --git a/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.proto b/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.proto new file mode 100644 index 0000000000000..ff0aff8a08222 --- /dev/null +++ b/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.proto @@ -0,0 +1,119 @@ +/* + 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. +*/ + +// Bootstrap Protocol +// +// This protocol defines the interface between containerd and shims at startup. +// It replaces the previous scattered configuration mechanisms (CLI args, env vars, +// stdin JSON, spec.json annotations) with a single, versioned, extensible protocol. +// +// Flow: +// 1. containerd spawns the shim process +// 2. containerd writes BootstrapParams as JSON to shim's stdin +// 3. shim initializes and writes BootstrapResult as JSON to stdout +// 4. containerd connects to the address provided in BootstrapResult +// +// Note: JSON serialization is used to keep shim binaries small since the +// encoding/json package is already part of the Go runtime. The proto +// definition serves as the schema for detecting breaking changes and +// maintaining forward/backward compatibility. +// +// This design enables: +// - Forward/backward compatibility via version field +// - Typed extensibility via google.protobuf.Any and Extension +// - Clear capability negotiation between containerd and shims + +syntax = "proto3"; + +package containerd.runtime.bootstrap.v1; + +import "google/protobuf/any.proto"; + +option go_package = "github.com/containerd/containerd/api/runtime/bootstrap/v1;bootstrap"; + +// BootstrapParams contains all configuration passed from containerd to shim at startup. +message BootstrapParams { + // Container/sandbox ID + string id = 1; + + // Namespace for the container + string namespace = 2; + + // Enable debug messages in logs. + bool enable_debug = 3; + + // Containerd's TTRPC API address (e.g., "unix:///run/containerd/containerd.sock.ttrpc") + string containerd_ttrpc_address = 4; + + // Containerd's gRPC API address (e.g., "unix:///run/containerd/containerd.sock") + string containerd_grpc_address = 5; + + // Socket path to serve. + string socket_path = 6; + + // Debug socket path to serve. + string socket_path_debug = 7; + + // Path to containerd binary for event publishing + string containerd_binary = 8; + + // Extensible configuration sections for new features + // Each section can contain arbitrary structured data identified by type URL + // Examples: CRI config, NRI config, sandbox config, etc. + repeated Extension extensions = 9; +} + +// Extension provides extensibility for new configuration types +// without changing the core BootstrapParams protocol +message Extension { + // Configuration data with embedded type URL + // Examples of type URLs: + // - "containerd.io/cri.v1.PodSandboxConfig" + // - "containerd.io/nri.v1.PluginConfig" + // - "containerd.io/sandbox.v1.SandboxConfig" + google.protobuf.Any value = 1; +} + +// BootstrapResult is returned by shim via stdout after successful startup +message BootstrapResult { + // Version of shim parameters (expected 2 for shim v2) + int32 version = 1; + + // Address where shim is listening (e.g., "unix:///run/containerd/shim.sock") + // Containerd will connect to this address for task operations + string address = 2; + + // Protocol used by shim: "ttrpc" or "grpc" + string protocol = 3; + + // Optional: Capabilities supported by this shim instance + // Allows shim to advertise what features it supports + repeated string capabilities = 4; + + // Optional: Additional metadata from shim + map metadata = 5; +} + +message RuncV2Extensions { + // Annotations are spec annotations read from config.json. + map annotations = 1; + + // Enable core scheduling if available + bool sched_core = 2; + + // Cgroup path to place the shim process into + string shim_cgroup = 3; +} diff --git a/vendor/github.com/containerd/containerd/api/runtime/boot/v1/doc.go b/vendor/github.com/containerd/containerd/api/runtime/boot/v1/doc.go new file mode 100644 index 0000000000000..c6d9c66aa0f67 --- /dev/null +++ b/vendor/github.com/containerd/containerd/api/runtime/boot/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 bootstrap diff --git a/vendor/github.com/containerd/containerd/api/runtime/boot/v1/helpers.go b/vendor/github.com/containerd/containerd/api/runtime/boot/v1/helpers.go new file mode 100644 index 0000000000000..de1a29d6b090f --- /dev/null +++ b/vendor/github.com/containerd/containerd/api/runtime/boot/v1/helpers.go @@ -0,0 +1,57 @@ +/* + 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 bootstrap + +import ( + "fmt" + + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/known/anypb" +) + +// AddExtension adds a new extension to the BootstrapParams. +// The message is wrapped in a google.protobuf.Any with its type URL automatically set. +func (p *BootstrapParams) AddExtension(msg proto.Message) error { + anyVal, err := anypb.New(msg) + if err != nil { + return err + } + + p.Extensions = append(p.Extensions, &Extension{Value: anyVal}) + return nil +} + +func GetExtension[T proto.Message](p *BootstrapParams) (T, error) { + var ( + empty T + reflect = empty.ProtoReflect() + name = reflect.Descriptor().FullName() + out = reflect.New().Interface().(T) + ) + + for _, ext := range p.Extensions { + if ext.GetValue().MessageIs(out) { + if err := ext.GetValue().UnmarshalTo(out); err != nil { + return out, fmt.Errorf("failed to unmarshal extension %q: %w", name, err) + } + + return out, nil + } + } + + return out, fmt.Errorf("extension %q not found", name) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 9224856091373..cd3efd36eb163 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -117,6 +117,7 @@ github.com/containerd/console # github.com/containerd/containerd/api v1.11.0-beta.0 => ./api ## explicit; go 1.24.0 github.com/containerd/containerd/api/events +github.com/containerd/containerd/api/runtime/boot/v1 github.com/containerd/containerd/api/runtime/sandbox/v1 github.com/containerd/containerd/api/runtime/task/v2 github.com/containerd/containerd/api/runtime/task/v3 From 5ea993b48d29e620dba6f90746a98ff0a4a29f65 Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Fri, 23 Jan 2026 17:23:40 -0800 Subject: [PATCH 04/28] Pass runc options as a separate extension Signed-off-by: Maksym Pavlenko --- api/runtime/boot/v1/bootstrap.pb.go | 69 +++++++------------ api/runtime/boot/v1/bootstrap.proto | 10 +-- api/runtime/boot/v1/helpers.go | 36 +++++----- api/runtime/boot/v1/helpers_test.go | 30 ++++++-- .../manager/manager_linux.go | 15 ++-- pkg/shim/compat.go | 22 +++--- .../api/runtime/boot/v1/bootstrap.pb.go | 69 +++++++------------ .../api/runtime/boot/v1/bootstrap.proto | 10 +-- .../containerd/api/runtime/boot/v1/helpers.go | 36 +++++----- 9 files changed, 142 insertions(+), 155 deletions(-) diff --git a/api/runtime/boot/v1/bootstrap.pb.go b/api/runtime/boot/v1/bootstrap.pb.go index aa0aafbe25d32..01cd447bde7cf 100644 --- a/api/runtime/boot/v1/bootstrap.pb.go +++ b/api/runtime/boot/v1/bootstrap.pb.go @@ -327,12 +327,8 @@ type RuncV2Extensions struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Annotations are spec annotations read from config.json. - Annotations map[string]string `protobuf:"bytes,1,rep,name=annotations,proto3" json:"annotations,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - // Enable core scheduling if available - SchedCore bool `protobuf:"varint,2,opt,name=sched_core,json=schedCore,proto3" json:"sched_core,omitempty"` - // Cgroup path to place the shim process into - ShimCgroup string `protobuf:"bytes,3,opt,name=shim_cgroup,json=shimCgroup,proto3" json:"shim_cgroup,omitempty"` + // Spec annotations read from config.json. + SpecAnnotations map[string]string `protobuf:"bytes,1,rep,name=spec_annotations,json=specAnnotations,proto3" json:"spec_annotations,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (x *RuncV2Extensions) Reset() { @@ -367,27 +363,13 @@ func (*RuncV2Extensions) Descriptor() ([]byte, []int) { return file_runtime_boot_v1_bootstrap_proto_rawDescGZIP(), []int{3} } -func (x *RuncV2Extensions) GetAnnotations() map[string]string { +func (x *RuncV2Extensions) GetSpecAnnotations() map[string]string { if x != nil { - return x.Annotations + return x.SpecAnnotations } return nil } -func (x *RuncV2Extensions) GetSchedCore() bool { - if x != nil { - return x.SchedCore - } - return false -} - -func (x *RuncV2Extensions) GetShimCgroup() string { - if x != nil { - return x.ShimCgroup - } - return "" -} - var File_runtime_boot_v1_bootstrap_proto protoreflect.FileDescriptor var file_runtime_boot_v1_bootstrap_proto_rawDesc = []byte{ @@ -444,27 +426,24 @@ var file_runtime_boot_v1_bootstrap_proto_rawDesc = []byte{ 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x3a, 0x02, 0x38, 0x01, 0x22, 0xf8, 0x01, 0x0a, 0x10, 0x52, 0x75, 0x6e, 0x63, 0x56, 0x32, 0x45, - 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x64, 0x0a, 0x0b, 0x61, 0x6e, 0x6e, - 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x42, - 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, - 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, - 0x2e, 0x52, 0x75, 0x6e, 0x63, 0x56, 0x32, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x73, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, - 0x72, 0x79, 0x52, 0x0b, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, - 0x1d, 0x0a, 0x0a, 0x73, 0x63, 0x68, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x09, 0x73, 0x63, 0x68, 0x65, 0x64, 0x43, 0x6f, 0x72, 0x65, 0x12, 0x1f, - 0x0a, 0x0b, 0x73, 0x68, 0x69, 0x6d, 0x5f, 0x63, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x68, 0x69, 0x6d, 0x43, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x1a, - 0x3e, 0x0a, 0x10, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, - 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, - 0x45, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, - 0x65, 0x72, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2f, - 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2f, 0x76, 0x31, 0x3b, 0x62, 0x6f, 0x6f, - 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x3a, 0x02, 0x38, 0x01, 0x22, 0xc9, 0x01, 0x0a, 0x10, 0x52, 0x75, 0x6e, 0x63, 0x56, 0x32, 0x45, + 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x71, 0x0a, 0x10, 0x73, 0x70, 0x65, + 0x63, 0x5f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x46, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, + 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, + 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x75, 0x6e, 0x63, 0x56, 0x32, 0x45, 0x78, 0x74, 0x65, + 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x70, 0x65, 0x63, 0x41, 0x6e, 0x6e, 0x6f, 0x74, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0f, 0x73, 0x70, 0x65, + 0x63, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x42, 0x0a, 0x14, + 0x53, 0x70, 0x65, 0x63, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, + 0x42, 0x45, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, + 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, + 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2f, 0x76, 0x31, 0x3b, 0x62, 0x6f, + 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -486,14 +465,14 @@ var file_runtime_boot_v1_bootstrap_proto_goTypes = []interface{}{ (*BootstrapResult)(nil), // 2: containerd.runtime.bootstrap.v1.BootstrapResult (*RuncV2Extensions)(nil), // 3: containerd.runtime.bootstrap.v1.RuncV2Extensions nil, // 4: containerd.runtime.bootstrap.v1.BootstrapResult.MetadataEntry - nil, // 5: containerd.runtime.bootstrap.v1.RuncV2Extensions.AnnotationsEntry + nil, // 5: containerd.runtime.bootstrap.v1.RuncV2Extensions.SpecAnnotationsEntry (*anypb.Any)(nil), // 6: google.protobuf.Any } var file_runtime_boot_v1_bootstrap_proto_depIdxs = []int32{ 1, // 0: containerd.runtime.bootstrap.v1.BootstrapParams.extensions:type_name -> containerd.runtime.bootstrap.v1.Extension 6, // 1: containerd.runtime.bootstrap.v1.Extension.value:type_name -> google.protobuf.Any 4, // 2: containerd.runtime.bootstrap.v1.BootstrapResult.metadata:type_name -> containerd.runtime.bootstrap.v1.BootstrapResult.MetadataEntry - 5, // 3: containerd.runtime.bootstrap.v1.RuncV2Extensions.annotations:type_name -> containerd.runtime.bootstrap.v1.RuncV2Extensions.AnnotationsEntry + 5, // 3: containerd.runtime.bootstrap.v1.RuncV2Extensions.spec_annotations:type_name -> containerd.runtime.bootstrap.v1.RuncV2Extensions.SpecAnnotationsEntry 4, // [4:4] is the sub-list for method output_type 4, // [4:4] is the sub-list for method input_type 4, // [4:4] is the sub-list for extension type_name diff --git a/api/runtime/boot/v1/bootstrap.proto b/api/runtime/boot/v1/bootstrap.proto index ff0aff8a08222..9f6ed47f4feea 100644 --- a/api/runtime/boot/v1/bootstrap.proto +++ b/api/runtime/boot/v1/bootstrap.proto @@ -108,12 +108,6 @@ message BootstrapResult { } message RuncV2Extensions { - // Annotations are spec annotations read from config.json. - map annotations = 1; - - // Enable core scheduling if available - bool sched_core = 2; - - // Cgroup path to place the shim process into - string shim_cgroup = 3; + // Spec annotations read from config.json. + map spec_annotations = 1; } diff --git a/api/runtime/boot/v1/helpers.go b/api/runtime/boot/v1/helpers.go index de1a29d6b090f..92d0d6246d52e 100644 --- a/api/runtime/boot/v1/helpers.go +++ b/api/runtime/boot/v1/helpers.go @@ -25,33 +25,37 @@ import ( // AddExtension adds a new extension to the BootstrapParams. // The message is wrapped in a google.protobuf.Any with its type URL automatically set. +// If the message is already an *anypb.Any, it is used directly without double-wrapping. func (p *BootstrapParams) AddExtension(msg proto.Message) error { - anyVal, err := anypb.New(msg) - if err != nil { - return err + var anyVal *anypb.Any + if a, ok := msg.(*anypb.Any); ok { + // Already an Any, use it directly + anyVal = a + } else { + var err error + anyVal, err = anypb.New(msg) + if err != nil { + return err + } } p.Extensions = append(p.Extensions, &Extension{Value: anyVal}) return nil } -func GetExtension[T proto.Message](p *BootstrapParams) (T, error) { - var ( - empty T - reflect = empty.ProtoReflect() - name = reflect.Descriptor().FullName() - out = reflect.New().Interface().(T) - ) +// FindExtension finds an extension matching the type of dst and unmarshals it. +// Returns true if found, false if not found. +func (p *BootstrapParams) FindExtension(dst proto.Message) error { + name := dst.ProtoReflect().Descriptor().FullName() for _, ext := range p.Extensions { - if ext.GetValue().MessageIs(out) { - if err := ext.GetValue().UnmarshalTo(out); err != nil { - return out, fmt.Errorf("failed to unmarshal extension %q: %w", name, err) + if ext.GetValue().MessageIs(dst) { + if err := ext.GetValue().UnmarshalTo(dst); err != nil { + return fmt.Errorf("failed to unmarshal extension %q: %w", name, err) } - - return out, nil + return nil } } - return out, fmt.Errorf("extension %q not found", name) + return nil } diff --git a/api/runtime/boot/v1/helpers_test.go b/api/runtime/boot/v1/helpers_test.go index 7145ccf3b0a6f..30dddb2068219 100644 --- a/api/runtime/boot/v1/helpers_test.go +++ b/api/runtime/boot/v1/helpers_test.go @@ -21,6 +21,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "google.golang.org/protobuf/types/known/anypb" ) func TestExtensions(t *testing.T) { @@ -29,14 +30,35 @@ func TestExtensions(t *testing.T) { err := params.AddExtension(&RuncV2Extensions{SchedCore: true}) require.NoError(t, err) - got, err := GetExtension[*RuncV2Extensions](params) + got := &RuncV2Extensions{} + err = params.FindExtension(got) require.NoError(t, err) - assert.True(t, got.SchedCore) } + func TestExtensionNotFound(t *testing.T) { params := &BootstrapParams{} - _, err := GetExtension[*RuncV2Extensions](params) - assert.Error(t, err) + got := &RuncV2Extensions{} + err := params.FindExtension(got) + require.NoError(t, err) +} + +func TestAddExtensionWithAny(t *testing.T) { + params := &BootstrapParams{} + + ext := &RuncV2Extensions{SchedCore: true, ShimCgroup: "/test/cgroup"} + anyVal, err := anypb.New(ext) + require.NoError(t, err) + + err = params.AddExtension(anyVal) + require.NoError(t, err) + + got := &RuncV2Extensions{} + err = params.FindExtension(got) + require.NoError(t, err) + assert.True(t, got.SchedCore) + assert.Equal(t, "/test/cgroup", got.ShimCgroup) + + assert.Contains(t, params.Extensions[0].Value.TypeUrl, "RuncV2Extensions") } diff --git a/cmd/containerd-shim-runc-v2/manager/manager_linux.go b/cmd/containerd-shim-runc-v2/manager/manager_linux.go index aec8253b1604a..7362b13ce2de0 100644 --- a/cmd/containerd-shim-runc-v2/manager/manager_linux.go +++ b/cmd/containerd-shim-runc-v2/manager/manager_linux.go @@ -173,13 +173,13 @@ func (manager) Start(ctx context.Context, opts *shim.BootstrapParams) (_ *shim.B } grouping := id - runcExt, err := boot.GetExtension[*boot.RuncV2Extensions](opts) - if err != nil { + var runcExt boot.RuncV2Extensions + if err := opts.FindExtension(&runcExt); err != nil { return nil, fmt.Errorf("failed to fetch runc v2 extensions: %w", err) } for _, group := range groupLabels { - if groupID, ok := runcExt.Annotations[group]; ok { + if groupID, ok := runcExt.SpecAnnotations[group]; ok { grouping = groupID break } @@ -215,7 +215,7 @@ func (manager) Start(ctx context.Context, opts *shim.BootstrapParams) (_ *shim.B } goruntime.LockOSThread() - if runcExt.GetSchedCore() { + if os.Getenv("SCHED_CORE") != "" { if err := schedcore.Create(schedcore.ProcessGroup); err != nil { return nil, fmt.Errorf("enable sched core support: %w", err) } @@ -235,7 +235,12 @@ func (manager) Start(ctx context.Context, opts *shim.BootstrapParams) (_ *shim.B // make sure to wait after start go cmd.Wait() - if shimCgroup := runcExt.GetShimCgroup(); shimCgroup != "" { + var runcOpts options.Options + if err := opts.FindExtension(&runcOpts); err != nil { + return nil, fmt.Errorf("failed to fetch runc options: %w", err) + } + + if shimCgroup := runcOpts.GetShimCgroup(); shimCgroup != "" { if cgroups.Mode() == cgroups.Unified { cg, err := cgroupsv2.Load(shimCgroup) if err != nil { diff --git a/pkg/shim/compat.go b/pkg/shim/compat.go index 5ee1b56e01667..25e5bb5573396 100644 --- a/pkg/shim/compat.go +++ b/pkg/shim/compat.go @@ -23,6 +23,7 @@ package shim import ( "encoding/json" + "fmt" "os" bootapi "github.com/containerd/containerd/api/runtime/boot/v1" @@ -39,21 +40,26 @@ func readBootstrapParamsFromDeprecatedFields(params *BootstrapParams) error { params.ContainerdBinary = containerdBinaryFlag params.EnableDebug = debugFlag - // Runc v2 specific fields (implemented as an extensions in the new boot API) - - var runcExt bootapi.RuncV2Extensions - - runcExt.SchedCore = os.Getenv("SCHED_CORE") != "" + // Runc v2 specific extensions + os.Stdin.Seek(0, 0) // Reset as we previously tried to read bootstrap params from it if opts, err := ReadRuntimeOptions[*options.Options](os.Stdin); err == nil { - runcExt.ShimCgroup = opts.ShimCgroup + if err := params.AddExtension(opts); err != nil { + return fmt.Errorf("unable to add runc options: %w", err) + } } + var runcExt bootapi.RuncV2Extensions + if spec, err := readSpec(); err == nil { - runcExt.Annotations = spec.Annotations + runcExt.SpecAnnotations = spec.Annotations + } + + if err := params.AddExtension(&runcExt); err != nil { + return fmt.Errorf("unable to add runc v2 extensions: %w", err) } - return params.AddExtension(&runcExt) + return nil } // spec is a shallow version of [oci.Spec] used by Runc V2 shim, diff --git a/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.pb.go b/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.pb.go index aa0aafbe25d32..01cd447bde7cf 100644 --- a/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.pb.go +++ b/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.pb.go @@ -327,12 +327,8 @@ type RuncV2Extensions struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Annotations are spec annotations read from config.json. - Annotations map[string]string `protobuf:"bytes,1,rep,name=annotations,proto3" json:"annotations,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - // Enable core scheduling if available - SchedCore bool `protobuf:"varint,2,opt,name=sched_core,json=schedCore,proto3" json:"sched_core,omitempty"` - // Cgroup path to place the shim process into - ShimCgroup string `protobuf:"bytes,3,opt,name=shim_cgroup,json=shimCgroup,proto3" json:"shim_cgroup,omitempty"` + // Spec annotations read from config.json. + SpecAnnotations map[string]string `protobuf:"bytes,1,rep,name=spec_annotations,json=specAnnotations,proto3" json:"spec_annotations,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (x *RuncV2Extensions) Reset() { @@ -367,27 +363,13 @@ func (*RuncV2Extensions) Descriptor() ([]byte, []int) { return file_runtime_boot_v1_bootstrap_proto_rawDescGZIP(), []int{3} } -func (x *RuncV2Extensions) GetAnnotations() map[string]string { +func (x *RuncV2Extensions) GetSpecAnnotations() map[string]string { if x != nil { - return x.Annotations + return x.SpecAnnotations } return nil } -func (x *RuncV2Extensions) GetSchedCore() bool { - if x != nil { - return x.SchedCore - } - return false -} - -func (x *RuncV2Extensions) GetShimCgroup() string { - if x != nil { - return x.ShimCgroup - } - return "" -} - var File_runtime_boot_v1_bootstrap_proto protoreflect.FileDescriptor var file_runtime_boot_v1_bootstrap_proto_rawDesc = []byte{ @@ -444,27 +426,24 @@ var file_runtime_boot_v1_bootstrap_proto_rawDesc = []byte{ 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x3a, 0x02, 0x38, 0x01, 0x22, 0xf8, 0x01, 0x0a, 0x10, 0x52, 0x75, 0x6e, 0x63, 0x56, 0x32, 0x45, - 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x64, 0x0a, 0x0b, 0x61, 0x6e, 0x6e, - 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x42, - 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, - 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, - 0x2e, 0x52, 0x75, 0x6e, 0x63, 0x56, 0x32, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x73, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, - 0x72, 0x79, 0x52, 0x0b, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, - 0x1d, 0x0a, 0x0a, 0x73, 0x63, 0x68, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x09, 0x73, 0x63, 0x68, 0x65, 0x64, 0x43, 0x6f, 0x72, 0x65, 0x12, 0x1f, - 0x0a, 0x0b, 0x73, 0x68, 0x69, 0x6d, 0x5f, 0x63, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x68, 0x69, 0x6d, 0x43, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x1a, - 0x3e, 0x0a, 0x10, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, - 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, - 0x45, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, - 0x65, 0x72, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2f, - 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2f, 0x76, 0x31, 0x3b, 0x62, 0x6f, 0x6f, - 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x3a, 0x02, 0x38, 0x01, 0x22, 0xc9, 0x01, 0x0a, 0x10, 0x52, 0x75, 0x6e, 0x63, 0x56, 0x32, 0x45, + 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x71, 0x0a, 0x10, 0x73, 0x70, 0x65, + 0x63, 0x5f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x46, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, + 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, + 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x75, 0x6e, 0x63, 0x56, 0x32, 0x45, 0x78, 0x74, 0x65, + 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x70, 0x65, 0x63, 0x41, 0x6e, 0x6e, 0x6f, 0x74, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0f, 0x73, 0x70, 0x65, + 0x63, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x42, 0x0a, 0x14, + 0x53, 0x70, 0x65, 0x63, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, + 0x42, 0x45, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, + 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, + 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2f, 0x76, 0x31, 0x3b, 0x62, 0x6f, + 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -486,14 +465,14 @@ var file_runtime_boot_v1_bootstrap_proto_goTypes = []interface{}{ (*BootstrapResult)(nil), // 2: containerd.runtime.bootstrap.v1.BootstrapResult (*RuncV2Extensions)(nil), // 3: containerd.runtime.bootstrap.v1.RuncV2Extensions nil, // 4: containerd.runtime.bootstrap.v1.BootstrapResult.MetadataEntry - nil, // 5: containerd.runtime.bootstrap.v1.RuncV2Extensions.AnnotationsEntry + nil, // 5: containerd.runtime.bootstrap.v1.RuncV2Extensions.SpecAnnotationsEntry (*anypb.Any)(nil), // 6: google.protobuf.Any } var file_runtime_boot_v1_bootstrap_proto_depIdxs = []int32{ 1, // 0: containerd.runtime.bootstrap.v1.BootstrapParams.extensions:type_name -> containerd.runtime.bootstrap.v1.Extension 6, // 1: containerd.runtime.bootstrap.v1.Extension.value:type_name -> google.protobuf.Any 4, // 2: containerd.runtime.bootstrap.v1.BootstrapResult.metadata:type_name -> containerd.runtime.bootstrap.v1.BootstrapResult.MetadataEntry - 5, // 3: containerd.runtime.bootstrap.v1.RuncV2Extensions.annotations:type_name -> containerd.runtime.bootstrap.v1.RuncV2Extensions.AnnotationsEntry + 5, // 3: containerd.runtime.bootstrap.v1.RuncV2Extensions.spec_annotations:type_name -> containerd.runtime.bootstrap.v1.RuncV2Extensions.SpecAnnotationsEntry 4, // [4:4] is the sub-list for method output_type 4, // [4:4] is the sub-list for method input_type 4, // [4:4] is the sub-list for extension type_name diff --git a/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.proto b/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.proto index ff0aff8a08222..9f6ed47f4feea 100644 --- a/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.proto +++ b/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.proto @@ -108,12 +108,6 @@ message BootstrapResult { } message RuncV2Extensions { - // Annotations are spec annotations read from config.json. - map annotations = 1; - - // Enable core scheduling if available - bool sched_core = 2; - - // Cgroup path to place the shim process into - string shim_cgroup = 3; + // Spec annotations read from config.json. + map spec_annotations = 1; } diff --git a/vendor/github.com/containerd/containerd/api/runtime/boot/v1/helpers.go b/vendor/github.com/containerd/containerd/api/runtime/boot/v1/helpers.go index de1a29d6b090f..92d0d6246d52e 100644 --- a/vendor/github.com/containerd/containerd/api/runtime/boot/v1/helpers.go +++ b/vendor/github.com/containerd/containerd/api/runtime/boot/v1/helpers.go @@ -25,33 +25,37 @@ import ( // AddExtension adds a new extension to the BootstrapParams. // The message is wrapped in a google.protobuf.Any with its type URL automatically set. +// If the message is already an *anypb.Any, it is used directly without double-wrapping. func (p *BootstrapParams) AddExtension(msg proto.Message) error { - anyVal, err := anypb.New(msg) - if err != nil { - return err + var anyVal *anypb.Any + if a, ok := msg.(*anypb.Any); ok { + // Already an Any, use it directly + anyVal = a + } else { + var err error + anyVal, err = anypb.New(msg) + if err != nil { + return err + } } p.Extensions = append(p.Extensions, &Extension{Value: anyVal}) return nil } -func GetExtension[T proto.Message](p *BootstrapParams) (T, error) { - var ( - empty T - reflect = empty.ProtoReflect() - name = reflect.Descriptor().FullName() - out = reflect.New().Interface().(T) - ) +// FindExtension finds an extension matching the type of dst and unmarshals it. +// Returns true if found, false if not found. +func (p *BootstrapParams) FindExtension(dst proto.Message) error { + name := dst.ProtoReflect().Descriptor().FullName() for _, ext := range p.Extensions { - if ext.GetValue().MessageIs(out) { - if err := ext.GetValue().UnmarshalTo(out); err != nil { - return out, fmt.Errorf("failed to unmarshal extension %q: %w", name, err) + if ext.GetValue().MessageIs(dst) { + if err := ext.GetValue().UnmarshalTo(dst); err != nil { + return fmt.Errorf("failed to unmarshal extension %q: %w", name, err) } - - return out, nil + return nil } } - return out, fmt.Errorf("extension %q not found", name) + return nil } From 3831fc80630879870327fde99f66b12959c973f0 Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Fri, 23 Jan 2026 17:56:18 -0800 Subject: [PATCH 05/28] Fix reading from stdin Signed-off-by: Maksym Pavlenko --- api/runtime/boot/v1/helpers_test.go | 9 ++++----- pkg/shim/compat.go | 6 +++--- pkg/shim/shim.go | 11 +++++++++-- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/api/runtime/boot/v1/helpers_test.go b/api/runtime/boot/v1/helpers_test.go index 30dddb2068219..ae7cec5c387cb 100644 --- a/api/runtime/boot/v1/helpers_test.go +++ b/api/runtime/boot/v1/helpers_test.go @@ -27,13 +27,13 @@ import ( func TestExtensions(t *testing.T) { params := &BootstrapParams{} - err := params.AddExtension(&RuncV2Extensions{SchedCore: true}) + err := params.AddExtension(&RuncV2Extensions{SpecAnnotations: map[string]string{"test": "value"}}) require.NoError(t, err) got := &RuncV2Extensions{} err = params.FindExtension(got) require.NoError(t, err) - assert.True(t, got.SchedCore) + assert.Equal(t, "value", got.SpecAnnotations["test"]) } func TestExtensionNotFound(t *testing.T) { @@ -47,7 +47,7 @@ func TestExtensionNotFound(t *testing.T) { func TestAddExtensionWithAny(t *testing.T) { params := &BootstrapParams{} - ext := &RuncV2Extensions{SchedCore: true, ShimCgroup: "/test/cgroup"} + ext := &RuncV2Extensions{SpecAnnotations: map[string]string{"test": "annotation"}} anyVal, err := anypb.New(ext) require.NoError(t, err) @@ -57,8 +57,7 @@ func TestAddExtensionWithAny(t *testing.T) { got := &RuncV2Extensions{} err = params.FindExtension(got) require.NoError(t, err) - assert.True(t, got.SchedCore) - assert.Equal(t, "/test/cgroup", got.ShimCgroup) + assert.Equal(t, "annotation", got.SpecAnnotations["test"]) assert.Contains(t, params.Extensions[0].Value.TypeUrl, "RuncV2Extensions") } diff --git a/pkg/shim/compat.go b/pkg/shim/compat.go index 25e5bb5573396..1f77e75831eaa 100644 --- a/pkg/shim/compat.go +++ b/pkg/shim/compat.go @@ -22,6 +22,7 @@ package shim // Once settled, this file should be removed. import ( + "bytes" "encoding/json" "fmt" "os" @@ -30,7 +31,7 @@ import ( "github.com/containerd/containerd/api/types/runc/options" ) -func readBootstrapParamsFromDeprecatedFields(params *BootstrapParams) error { +func readBootstrapParamsFromDeprecatedFields(input []byte, params *BootstrapParams) error { params.ID = id params.Namespace = namespaceFlag params.ContainerdTtrpcAddress = os.Getenv(ttrpcAddressEnv) @@ -42,8 +43,7 @@ func readBootstrapParamsFromDeprecatedFields(params *BootstrapParams) error { // Runc v2 specific extensions - os.Stdin.Seek(0, 0) // Reset as we previously tried to read bootstrap params from it - if opts, err := ReadRuntimeOptions[*options.Options](os.Stdin); err == nil { + if opts, err := ReadRuntimeOptions[*options.Options](bytes.NewBuffer(input)); err == nil { if err := params.AddExtension(opts); err != nil { return fmt.Errorf("unable to add runc options: %w", err) } diff --git a/pkg/shim/shim.go b/pkg/shim/shim.go index 83e18de8acc79..033207dc2fb71 100644 --- a/pkg/shim/shim.go +++ b/pkg/shim/shim.go @@ -274,10 +274,17 @@ func run(ctx context.Context, manager Manager, config Config) error { } return nil case "start": + // We try reading stdin twice: first for the new boot API, then runc Options. + // The stdin pipe is not seekable, so this should be read into memory first. + input, err := io.ReadAll(os.Stdin) + if err != nil { + return fmt.Errorf("failed to read stdin: %w", err) + } + var params bootapi.BootstrapParams - if err := json.NewDecoder(os.Stdin).Decode(¶ms); err != nil { + if err := json.Unmarshal(input, ¶ms); err != nil { // TODO: Return error once the new API is stable - if err := readBootstrapParamsFromDeprecatedFields(¶ms); err != nil { + if err := readBootstrapParamsFromDeprecatedFields(input, ¶ms); err != nil { return err } } From fc8062f3792e7bc056c874b4d93ecf911360da71 Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Fri, 23 Jan 2026 18:20:50 -0800 Subject: [PATCH 06/28] Rename CommandConfig field to better reflect their purpose Signed-off-by: Maksym Pavlenko --- core/runtime/v2/binary.go | 12 ++++++------ pkg/shim/util.go | 18 +++++++++++------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/core/runtime/v2/binary.go b/core/runtime/v2/binary.go index 0aa21ab91dd44..69f7f8138c16f 100644 --- a/core/runtime/v2/binary.go +++ b/core/runtime/v2/binary.go @@ -71,10 +71,10 @@ func (b *binary) Start(ctx context.Context, opts *types.Any, onClose func()) (_ cmd, err := client.Command( ctx, &client.CommandConfig{ - Runtime: b.runtime, - Address: b.containerdAddress, + RuntimePath: b.runtime, + GRPCAddress: b.containerdAddress, TTRPCAddress: b.containerdTTRPCAddress, - Path: b.bundle.Path, + WorkDir: b.bundle.Path, Opts: opts, Args: args, Env: b.env, @@ -177,10 +177,10 @@ func (b *binary) Delete(ctx context.Context) (*runtime.Exit, error) { cmd, err := client.Command(ctx, &client.CommandConfig{ - Runtime: b.runtime, - Address: b.containerdAddress, + RuntimePath: b.runtime, + GRPCAddress: b.containerdAddress, TTRPCAddress: b.containerdTTRPCAddress, - Path: bundlePath, + WorkDir: bundlePath, Opts: nil, Args: args, }) diff --git a/pkg/shim/util.go b/pkg/shim/util.go index 613c37f4320bc..c3a5c324c6799 100644 --- a/pkg/shim/util.go +++ b/pkg/shim/util.go @@ -40,16 +40,20 @@ import ( ) type CommandConfig struct { - Runtime string - Address string + RuntimePath string + GRPCAddress string TTRPCAddress string - Path string + WorkDir string Args []string Opts *types.Any Env []string } // Command returns the shim command with the provided args and configuration +// +// TODO(refactor): move this function to core containerd runtime. This function is only used +// by the containerd daemon for the initial shim launches (e.g. shim -start) and makes +// no sense for shim implementations. func Command(ctx context.Context, config *CommandConfig) (*exec.Cmd, error) { ns, err := namespaces.NamespaceRequired(ctx) if err != nil { @@ -61,18 +65,18 @@ func Command(ctx context.Context, config *CommandConfig) (*exec.Cmd, error) { } args := []string{ "-namespace", ns, - "-address", config.Address, + "-address", config.GRPCAddress, "-publish-binary", self, } args = append(args, config.Args...) - cmd := exec.CommandContext(ctx, config.Runtime, args...) - cmd.Dir = config.Path + cmd := exec.CommandContext(ctx, config.RuntimePath, args...) + cmd.Dir = config.WorkDir cmd.Env = append( os.Environ(), "GOMAXPROCS=2", fmt.Sprintf("%s=2", maxVersionEnv), fmt.Sprintf("%s=%s", ttrpcAddressEnv, config.TTRPCAddress), - fmt.Sprintf("%s=%s", grpcAddressEnv, config.Address), + fmt.Sprintf("%s=%s", grpcAddressEnv, config.GRPCAddress), fmt.Sprintf("%s=%s", namespaceEnv, ns), ) if len(config.Env) > 0 { From fa02acee2094494436d4e6dcf5a800286d60726a Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Sat, 24 Jan 2026 12:06:06 -0800 Subject: [PATCH 07/28] Generate shim CLI flags under Command Signed-off-by: Maksym Pavlenko --- core/runtime/v2/binary.go | 23 ++++++++++++----------- pkg/shim/shim.go | 2 +- pkg/shim/util.go | 25 ++++++++++++++++++++++++- 3 files changed, 37 insertions(+), 13 deletions(-) diff --git a/core/runtime/v2/binary.go b/core/runtime/v2/binary.go index 69f7f8138c16f..2972beea0e76e 100644 --- a/core/runtime/v2/binary.go +++ b/core/runtime/v2/binary.go @@ -61,23 +61,24 @@ type binary struct { } func (b *binary) Start(ctx context.Context, opts *types.Any, onClose func()) (_ *shim, err error) { - args := []string{"-id", b.bundle.ID} + debug := false switch log.GetLevel() { case log.DebugLevel, log.TraceLevel: - args = append(args, "-debug") + debug = true } - args = append(args, "start") cmd, err := client.Command( ctx, &client.CommandConfig{ + ID: b.bundle.ID, RuntimePath: b.runtime, GRPCAddress: b.containerdAddress, TTRPCAddress: b.containerdTTRPCAddress, WorkDir: b.bundle.Path, Opts: opts, - Args: args, Env: b.env, + Debug: debug, + Action: "start", }) if err != nil { return nil, err @@ -165,24 +166,24 @@ func (b *binary) Delete(ctx context.Context) (*runtime.Exit, error) { if gruntime.GOOS != "windows" && gruntime.GOOS != "freebsd" { bundlePath = b.bundle.Path } - args := []string{ - "-id", b.bundle.ID, - "-bundle", b.bundle.Path, - } + + debug := false switch log.GetLevel() { case log.DebugLevel, log.TraceLevel: - args = append(args, "-debug") + debug = true } - args = append(args, "delete") cmd, err := client.Command(ctx, &client.CommandConfig{ + ID: b.bundle.ID, RuntimePath: b.runtime, + BundlePath: b.bundle.Path, GRPCAddress: b.containerdAddress, TTRPCAddress: b.containerdTTRPCAddress, WorkDir: bundlePath, Opts: nil, - Args: args, + Debug: debug, + Action: "delete", }) if err != nil { diff --git a/pkg/shim/shim.go b/pkg/shim/shim.go index 033207dc2fb71..f8df287269705 100644 --- a/pkg/shim/shim.go +++ b/pkg/shim/shim.go @@ -140,7 +140,7 @@ func parseFlags() { flag.StringVar(&id, "id", "", "id of the task") flag.StringVar(&socketFlag, "socket", "", "socket path to serve") flag.StringVar(&debugSocketFlag, "debug-socket", "", "debug socket path to serve") - flag.StringVar(&bundlePath, "bundle", "", "path to the bundle if not workdir") + flag.StringVar(&bundlePath, "bundle", "", "path to the bundle if not workdir") // Provided only during -delete action flag.StringVar(&addressFlag, "address", "", "grpc address back to main containerd") flag.StringVar(&containerdBinaryFlag, "publish-binary", "", diff --git a/pkg/shim/util.go b/pkg/shim/util.go index c3a5c324c6799..9550b823cc8ea 100644 --- a/pkg/shim/util.go +++ b/pkg/shim/util.go @@ -40,13 +40,17 @@ import ( ) type CommandConfig struct { + ID string RuntimePath string + BundlePath string GRPCAddress string TTRPCAddress string WorkDir string Args []string Opts *types.Any Env []string + Debug bool + Action string // Either "start" or "delete" } // Command returns the shim command with the provided args and configuration @@ -67,8 +71,27 @@ func Command(ctx context.Context, config *CommandConfig) (*exec.Cmd, error) { "-namespace", ns, "-address", config.GRPCAddress, "-publish-binary", self, + "-id", config.ID, } - args = append(args, config.Args...) + + if config.BundlePath != "" { + args = append(args, "-bundle", config.BundlePath) + } + + if config.Debug { + args = append(args, "-debug") + } + + if config.Action == "" { + return nil, errors.New("action must be specified in CommandConfig") + } + + args = append(args, config.Action) + + if len(config.Args) > 0 { + args = append(args, config.Args...) + } + cmd := exec.CommandContext(ctx, config.RuntimePath, args...) cmd.Dir = config.WorkDir cmd.Env = append( From 9e9a095feb43c6b6a84fe1f4b2331977ebb92b91 Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Sat, 24 Jan 2026 12:12:31 -0800 Subject: [PATCH 08/28] Read spec annotations from file Revert changes related to reading annotations in runc v2 shim, because this requires a special path for runc shim. This complicates migration to the new bootstrap API. Signed-off-by: Maksym Pavlenko --- api/runtime/boot/v1/bootstrap.pb.go | 115 +++--------------- api/runtime/boot/v1/bootstrap.proto | 5 - .../manager/manager_linux.go | 32 ++++- pkg/shim/compat.go | 36 +----- 4 files changed, 47 insertions(+), 141 deletions(-) diff --git a/api/runtime/boot/v1/bootstrap.pb.go b/api/runtime/boot/v1/bootstrap.pb.go index 01cd447bde7cf..c775f09a65ed4 100644 --- a/api/runtime/boot/v1/bootstrap.pb.go +++ b/api/runtime/boot/v1/bootstrap.pb.go @@ -322,54 +322,6 @@ func (x *BootstrapResult) GetMetadata() map[string]string { return nil } -type RuncV2Extensions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Spec annotations read from config.json. - SpecAnnotations map[string]string `protobuf:"bytes,1,rep,name=spec_annotations,json=specAnnotations,proto3" json:"spec_annotations,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` -} - -func (x *RuncV2Extensions) Reset() { - *x = RuncV2Extensions{} - if protoimpl.UnsafeEnabled { - mi := &file_runtime_boot_v1_bootstrap_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RuncV2Extensions) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RuncV2Extensions) ProtoMessage() {} - -func (x *RuncV2Extensions) ProtoReflect() protoreflect.Message { - mi := &file_runtime_boot_v1_bootstrap_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RuncV2Extensions.ProtoReflect.Descriptor instead. -func (*RuncV2Extensions) Descriptor() ([]byte, []int) { - return file_runtime_boot_v1_bootstrap_proto_rawDescGZIP(), []int{3} -} - -func (x *RuncV2Extensions) GetSpecAnnotations() map[string]string { - if x != nil { - return x.SpecAnnotations - } - return nil -} - var File_runtime_boot_v1_bootstrap_proto protoreflect.FileDescriptor var file_runtime_boot_v1_bootstrap_proto_rawDesc = []byte{ @@ -426,24 +378,12 @@ var file_runtime_boot_v1_bootstrap_proto_rawDesc = []byte{ 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x3a, 0x02, 0x38, 0x01, 0x22, 0xc9, 0x01, 0x0a, 0x10, 0x52, 0x75, 0x6e, 0x63, 0x56, 0x32, 0x45, - 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x71, 0x0a, 0x10, 0x73, 0x70, 0x65, - 0x63, 0x5f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x46, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, - 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, - 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x75, 0x6e, 0x63, 0x56, 0x32, 0x45, 0x78, 0x74, 0x65, - 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x70, 0x65, 0x63, 0x41, 0x6e, 0x6e, 0x6f, 0x74, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0f, 0x73, 0x70, 0x65, - 0x63, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x42, 0x0a, 0x14, - 0x53, 0x70, 0x65, 0x63, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, - 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, - 0x42, 0x45, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, - 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, - 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, - 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2f, 0x76, 0x31, 0x3b, 0x62, 0x6f, - 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x3a, 0x02, 0x38, 0x01, 0x42, 0x45, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x75, 0x6e, + 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2f, 0x76, + 0x31, 0x3b, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -458,26 +398,23 @@ func file_runtime_boot_v1_bootstrap_proto_rawDescGZIP() []byte { return file_runtime_boot_v1_bootstrap_proto_rawDescData } -var file_runtime_boot_v1_bootstrap_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_runtime_boot_v1_bootstrap_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_runtime_boot_v1_bootstrap_proto_goTypes = []interface{}{ - (*BootstrapParams)(nil), // 0: containerd.runtime.bootstrap.v1.BootstrapParams - (*Extension)(nil), // 1: containerd.runtime.bootstrap.v1.Extension - (*BootstrapResult)(nil), // 2: containerd.runtime.bootstrap.v1.BootstrapResult - (*RuncV2Extensions)(nil), // 3: containerd.runtime.bootstrap.v1.RuncV2Extensions - nil, // 4: containerd.runtime.bootstrap.v1.BootstrapResult.MetadataEntry - nil, // 5: containerd.runtime.bootstrap.v1.RuncV2Extensions.SpecAnnotationsEntry - (*anypb.Any)(nil), // 6: google.protobuf.Any + (*BootstrapParams)(nil), // 0: containerd.runtime.bootstrap.v1.BootstrapParams + (*Extension)(nil), // 1: containerd.runtime.bootstrap.v1.Extension + (*BootstrapResult)(nil), // 2: containerd.runtime.bootstrap.v1.BootstrapResult + nil, // 3: containerd.runtime.bootstrap.v1.BootstrapResult.MetadataEntry + (*anypb.Any)(nil), // 4: google.protobuf.Any } var file_runtime_boot_v1_bootstrap_proto_depIdxs = []int32{ 1, // 0: containerd.runtime.bootstrap.v1.BootstrapParams.extensions:type_name -> containerd.runtime.bootstrap.v1.Extension - 6, // 1: containerd.runtime.bootstrap.v1.Extension.value:type_name -> google.protobuf.Any - 4, // 2: containerd.runtime.bootstrap.v1.BootstrapResult.metadata:type_name -> containerd.runtime.bootstrap.v1.BootstrapResult.MetadataEntry - 5, // 3: containerd.runtime.bootstrap.v1.RuncV2Extensions.spec_annotations:type_name -> containerd.runtime.bootstrap.v1.RuncV2Extensions.SpecAnnotationsEntry - 4, // [4:4] is the sub-list for method output_type - 4, // [4:4] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name + 4, // 1: containerd.runtime.bootstrap.v1.Extension.value:type_name -> google.protobuf.Any + 3, // 2: containerd.runtime.bootstrap.v1.BootstrapResult.metadata:type_name -> containerd.runtime.bootstrap.v1.BootstrapResult.MetadataEntry + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name } func init() { file_runtime_boot_v1_bootstrap_proto_init() } @@ -522,18 +459,6 @@ func file_runtime_boot_v1_bootstrap_proto_init() { return nil } } - file_runtime_boot_v1_bootstrap_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RuncV2Extensions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } } type x struct{} out := protoimpl.TypeBuilder{ @@ -541,7 +466,7 @@ func file_runtime_boot_v1_bootstrap_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_runtime_boot_v1_bootstrap_proto_rawDesc, NumEnums: 0, - NumMessages: 6, + NumMessages: 4, NumExtensions: 0, NumServices: 0, }, diff --git a/api/runtime/boot/v1/bootstrap.proto b/api/runtime/boot/v1/bootstrap.proto index 9f6ed47f4feea..3fd2a8127e3c1 100644 --- a/api/runtime/boot/v1/bootstrap.proto +++ b/api/runtime/boot/v1/bootstrap.proto @@ -106,8 +106,3 @@ message BootstrapResult { // Optional: Additional metadata from shim map metadata = 5; } - -message RuncV2Extensions { - // Spec annotations read from config.json. - map spec_annotations = 1; -} diff --git a/cmd/containerd-shim-runc-v2/manager/manager_linux.go b/cmd/containerd-shim-runc-v2/manager/manager_linux.go index 7362b13ce2de0..0047a41ed8709 100644 --- a/cmd/containerd-shim-runc-v2/manager/manager_linux.go +++ b/cmd/containerd-shim-runc-v2/manager/manager_linux.go @@ -34,7 +34,6 @@ import ( "github.com/containerd/cgroups/v3" "github.com/containerd/cgroups/v3/cgroup1" cgroupsv2 "github.com/containerd/cgroups/v3/cgroup2" - boot "github.com/containerd/containerd/api/runtime/boot/v1" "github.com/containerd/containerd/api/types" "github.com/containerd/containerd/api/types/runc/options" "github.com/containerd/containerd/v2/cmd/containerd-shim-runc-v2/process" @@ -68,6 +67,14 @@ var groupLabels = []string{ "io.kubernetes.cri.sandbox-id", } +// spec is a shallow version of [oci.Spec] containing only the +// fields we need for the hook. We use a shallow struct to reduce +// the overhead of unmarshaling. +type spec struct { + // Annotations contains arbitrary metadata for the container. + Annotations map[string]string `json:"annotations,omitempty"` +} + type manager struct { name string } @@ -103,6 +110,20 @@ func newCommand(ctx context.Context, id, containerdAddress, containerdTTRPCAddre return cmd, nil } +func readSpec() (*spec, error) { + const configFileName = "config.json" + f, err := os.Open(configFileName) + if err != nil { + return nil, err + } + defer f.Close() + var s spec + if err := json.NewDecoder(f).Decode(&s); err != nil { + return nil, err + } + return &s, nil +} + func (m manager) Name() string { return m.name } @@ -172,14 +193,13 @@ func (manager) Start(ctx context.Context, opts *shim.BootstrapParams) (_ *shim.B return nil, err } grouping := id - - var runcExt boot.RuncV2Extensions - if err := opts.FindExtension(&runcExt); err != nil { - return nil, fmt.Errorf("failed to fetch runc v2 extensions: %w", err) + spec, err := readSpec() + if err != nil { + return nil, err } for _, group := range groupLabels { - if groupID, ok := runcExt.SpecAnnotations[group]; ok { + if groupID, ok := spec.Annotations[group]; ok { grouping = groupID break } diff --git a/pkg/shim/compat.go b/pkg/shim/compat.go index 1f77e75831eaa..05d1eeea9f112 100644 --- a/pkg/shim/compat.go +++ b/pkg/shim/compat.go @@ -23,11 +23,9 @@ package shim import ( "bytes" - "encoding/json" "fmt" "os" - bootapi "github.com/containerd/containerd/api/runtime/boot/v1" "github.com/containerd/containerd/api/types/runc/options" ) @@ -41,7 +39,7 @@ func readBootstrapParamsFromDeprecatedFields(input []byte, params *BootstrapPara params.ContainerdBinary = containerdBinaryFlag params.EnableDebug = debugFlag - // Runc v2 specific extensions + // Task options if opts, err := ReadRuntimeOptions[*options.Options](bytes.NewBuffer(input)); err == nil { if err := params.AddExtension(opts); err != nil { @@ -49,37 +47,5 @@ func readBootstrapParamsFromDeprecatedFields(input []byte, params *BootstrapPara } } - var runcExt bootapi.RuncV2Extensions - - if spec, err := readSpec(); err == nil { - runcExt.SpecAnnotations = spec.Annotations - } - - if err := params.AddExtension(&runcExt); err != nil { - return fmt.Errorf("unable to add runc v2 extensions: %w", err) - } - return nil } - -// spec is a shallow version of [oci.Spec] used by Runc V2 shim, -// containing only the fields we need for the hook. We use a shallow struct to reduce -// the overhead of unmarshaling. -type spec struct { - // Annotations contains arbitrary metadata for the container. - Annotations map[string]string `json:"annotations,omitempty"` -} - -func readSpec() (*spec, error) { - const configFileName = "config.json" - f, err := os.Open(configFileName) - if err != nil { - return nil, err - } - defer f.Close() - var s spec - if err := json.NewDecoder(f).Decode(&s); err != nil { - return nil, err - } - return &s, nil -} From acb8c8ea1ef1f79f0b9c49ef25f8b5e87dd8d7c9 Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Sat, 24 Jan 2026 12:14:20 -0800 Subject: [PATCH 09/28] Update vendor Signed-off-by: Maksym Pavlenko --- .../api/runtime/boot/v1/bootstrap.pb.go | 115 +++--------------- .../api/runtime/boot/v1/bootstrap.proto | 5 - 2 files changed, 20 insertions(+), 100 deletions(-) diff --git a/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.pb.go b/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.pb.go index 01cd447bde7cf..c775f09a65ed4 100644 --- a/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.pb.go +++ b/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.pb.go @@ -322,54 +322,6 @@ func (x *BootstrapResult) GetMetadata() map[string]string { return nil } -type RuncV2Extensions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Spec annotations read from config.json. - SpecAnnotations map[string]string `protobuf:"bytes,1,rep,name=spec_annotations,json=specAnnotations,proto3" json:"spec_annotations,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` -} - -func (x *RuncV2Extensions) Reset() { - *x = RuncV2Extensions{} - if protoimpl.UnsafeEnabled { - mi := &file_runtime_boot_v1_bootstrap_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RuncV2Extensions) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RuncV2Extensions) ProtoMessage() {} - -func (x *RuncV2Extensions) ProtoReflect() protoreflect.Message { - mi := &file_runtime_boot_v1_bootstrap_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RuncV2Extensions.ProtoReflect.Descriptor instead. -func (*RuncV2Extensions) Descriptor() ([]byte, []int) { - return file_runtime_boot_v1_bootstrap_proto_rawDescGZIP(), []int{3} -} - -func (x *RuncV2Extensions) GetSpecAnnotations() map[string]string { - if x != nil { - return x.SpecAnnotations - } - return nil -} - var File_runtime_boot_v1_bootstrap_proto protoreflect.FileDescriptor var file_runtime_boot_v1_bootstrap_proto_rawDesc = []byte{ @@ -426,24 +378,12 @@ var file_runtime_boot_v1_bootstrap_proto_rawDesc = []byte{ 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x3a, 0x02, 0x38, 0x01, 0x22, 0xc9, 0x01, 0x0a, 0x10, 0x52, 0x75, 0x6e, 0x63, 0x56, 0x32, 0x45, - 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x71, 0x0a, 0x10, 0x73, 0x70, 0x65, - 0x63, 0x5f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x46, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, - 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, - 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x75, 0x6e, 0x63, 0x56, 0x32, 0x45, 0x78, 0x74, 0x65, - 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x70, 0x65, 0x63, 0x41, 0x6e, 0x6e, 0x6f, 0x74, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0f, 0x73, 0x70, 0x65, - 0x63, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x42, 0x0a, 0x14, - 0x53, 0x70, 0x65, 0x63, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, - 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, - 0x42, 0x45, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, - 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, - 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, - 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2f, 0x76, 0x31, 0x3b, 0x62, 0x6f, - 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x3a, 0x02, 0x38, 0x01, 0x42, 0x45, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x75, 0x6e, + 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2f, 0x76, + 0x31, 0x3b, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -458,26 +398,23 @@ func file_runtime_boot_v1_bootstrap_proto_rawDescGZIP() []byte { return file_runtime_boot_v1_bootstrap_proto_rawDescData } -var file_runtime_boot_v1_bootstrap_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_runtime_boot_v1_bootstrap_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_runtime_boot_v1_bootstrap_proto_goTypes = []interface{}{ - (*BootstrapParams)(nil), // 0: containerd.runtime.bootstrap.v1.BootstrapParams - (*Extension)(nil), // 1: containerd.runtime.bootstrap.v1.Extension - (*BootstrapResult)(nil), // 2: containerd.runtime.bootstrap.v1.BootstrapResult - (*RuncV2Extensions)(nil), // 3: containerd.runtime.bootstrap.v1.RuncV2Extensions - nil, // 4: containerd.runtime.bootstrap.v1.BootstrapResult.MetadataEntry - nil, // 5: containerd.runtime.bootstrap.v1.RuncV2Extensions.SpecAnnotationsEntry - (*anypb.Any)(nil), // 6: google.protobuf.Any + (*BootstrapParams)(nil), // 0: containerd.runtime.bootstrap.v1.BootstrapParams + (*Extension)(nil), // 1: containerd.runtime.bootstrap.v1.Extension + (*BootstrapResult)(nil), // 2: containerd.runtime.bootstrap.v1.BootstrapResult + nil, // 3: containerd.runtime.bootstrap.v1.BootstrapResult.MetadataEntry + (*anypb.Any)(nil), // 4: google.protobuf.Any } var file_runtime_boot_v1_bootstrap_proto_depIdxs = []int32{ 1, // 0: containerd.runtime.bootstrap.v1.BootstrapParams.extensions:type_name -> containerd.runtime.bootstrap.v1.Extension - 6, // 1: containerd.runtime.bootstrap.v1.Extension.value:type_name -> google.protobuf.Any - 4, // 2: containerd.runtime.bootstrap.v1.BootstrapResult.metadata:type_name -> containerd.runtime.bootstrap.v1.BootstrapResult.MetadataEntry - 5, // 3: containerd.runtime.bootstrap.v1.RuncV2Extensions.spec_annotations:type_name -> containerd.runtime.bootstrap.v1.RuncV2Extensions.SpecAnnotationsEntry - 4, // [4:4] is the sub-list for method output_type - 4, // [4:4] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name + 4, // 1: containerd.runtime.bootstrap.v1.Extension.value:type_name -> google.protobuf.Any + 3, // 2: containerd.runtime.bootstrap.v1.BootstrapResult.metadata:type_name -> containerd.runtime.bootstrap.v1.BootstrapResult.MetadataEntry + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name } func init() { file_runtime_boot_v1_bootstrap_proto_init() } @@ -522,18 +459,6 @@ func file_runtime_boot_v1_bootstrap_proto_init() { return nil } } - file_runtime_boot_v1_bootstrap_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RuncV2Extensions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } } type x struct{} out := protoimpl.TypeBuilder{ @@ -541,7 +466,7 @@ func file_runtime_boot_v1_bootstrap_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_runtime_boot_v1_bootstrap_proto_rawDesc, NumEnums: 0, - NumMessages: 6, + NumMessages: 4, NumExtensions: 0, NumServices: 0, }, diff --git a/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.proto b/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.proto index 9f6ed47f4feea..3fd2a8127e3c1 100644 --- a/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.proto +++ b/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.proto @@ -106,8 +106,3 @@ message BootstrapResult { // Optional: Additional metadata from shim map metadata = 5; } - -message RuncV2Extensions { - // Spec annotations read from config.json. - map spec_annotations = 1; -} From b7ef291edcc5d4beac49f8748e0606d32d83ca0c Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Sat, 24 Jan 2026 14:42:41 -0800 Subject: [PATCH 10/28] Provide bootstrap params when launching shims Signed-off-by: Maksym Pavlenko --- pkg/shim/util.go | 46 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/pkg/shim/util.go b/pkg/shim/util.go index 9550b823cc8ea..9ab39b548324f 100644 --- a/pkg/shim/util.go +++ b/pkg/shim/util.go @@ -19,6 +19,7 @@ package shim import ( "bytes" "context" + "encoding/json" "errors" "fmt" "io" @@ -32,6 +33,7 @@ import ( "github.com/containerd/ttrpc" "github.com/containerd/typeurl/v2" + bootapi "github.com/containerd/containerd/api/runtime/boot/v1" "github.com/containerd/containerd/v2/pkg/atomicfile" "github.com/containerd/containerd/v2/pkg/namespaces" "github.com/containerd/containerd/v2/pkg/protobuf/proto" @@ -67,21 +69,20 @@ func Command(ctx context.Context, config *CommandConfig) (*exec.Cmd, error) { if err != nil { return nil, err } + + // TODO: Deprecate this in 2.3 and remove in the next LTS in favor of Bootstrap protocol. args := []string{ "-namespace", ns, "-address", config.GRPCAddress, "-publish-binary", self, "-id", config.ID, } - if config.BundlePath != "" { args = append(args, "-bundle", config.BundlePath) } - if config.Debug { args = append(args, "-debug") } - if config.Action == "" { return nil, errors.New("action must be specified in CommandConfig") } @@ -98,6 +99,7 @@ func Command(ctx context.Context, config *CommandConfig) (*exec.Cmd, error) { os.Environ(), "GOMAXPROCS=2", fmt.Sprintf("%s=2", maxVersionEnv), + // TODO: Deprecate this in 2.3 and remove in the next LTS in favor of Bootstrap protocol. fmt.Sprintf("%s=%s", ttrpcAddressEnv, config.TTRPCAddress), fmt.Sprintf("%s=%s", grpcAddressEnv, config.GRPCAddress), fmt.Sprintf("%s=%s", namespaceEnv, ns), @@ -106,13 +108,43 @@ func Command(ctx context.Context, config *CommandConfig) (*exec.Cmd, error) { cmd.Env = append(cmd.Env, config.Env...) } cmd.SysProcAttr = getSysProcAttr() - if config.Opts != nil { - d, err := proto.Marshal(config.Opts) + + // Special path when upgrading from 1.7 runc v1 shims to 2.x containerd. + // v1 shims would fail if passed wrong stdin data. + // TODO: Deprecate and remove in the next LTS + if strings.Contains(config.RuntimePath, "shim-runc-v1") || strings.Contains(config.RuntimePath, "shim-runhcs-v1") { + if config.Opts != nil { + d, err := proto.Marshal(config.Opts) + if err != nil { + return nil, err + } + cmd.Stdin = bytes.NewReader(d) + } + } else if config.Action == "start" { + // Use the new Bootstrap protocol for all newer shims. + params := bootapi.BootstrapParams{ + ID: config.ID, + Namespace: ns, + EnableDebug: config.Debug, + ContainerdGrpcAddress: config.GRPCAddress, + ContainerdTtrpcAddress: config.TTRPCAddress, + ContainerdBinary: self, + } + + if config.Opts != nil { + if err := params.AddExtension(config.Opts); err != nil { + return nil, fmt.Errorf("unable to add runtime options extensions: %w", err) + } + } + + data, err := json.Marshal(¶ms) if err != nil { - return nil, err + return nil, fmt.Errorf("unable to marshal bootstrap params: %w", err) } - cmd.Stdin = bytes.NewReader(d) + + cmd.Stdin = bytes.NewReader(data) } + return cmd, nil } From f71c2e4211c9cbae06c582222d200c8756a84845 Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Sat, 7 Feb 2026 12:29:10 -0800 Subject: [PATCH 11/28] Reformat and clean proto files Signed-off-by: Maksym Pavlenko --- api/next.txtpb | 776 ++++++++++++++++++ api/runtime/boot/v1/bootstrap.pb.go | 95 +-- api/runtime/boot/v1/bootstrap.proto | 94 +-- pkg/shim/compat.go | 2 - .../api/runtime/boot/v1/bootstrap.pb.go | 95 +-- .../api/runtime/boot/v1/bootstrap.proto | 94 +-- 6 files changed, 936 insertions(+), 220 deletions(-) diff --git a/api/next.txtpb b/api/next.txtpb index 5eb612df9f4ef..d71dedc712673 100644 --- a/api/next.txtpb +++ b/api/next.txtpb @@ -24926,6 +24926,782 @@ file: { is_syntax_unspecified: false } } +file: { + name: "runtime/boot/v1/bootstrap.proto" + package: "containerd.runtime.bootstrap.v1" + dependency: "google/protobuf/any.proto" + message_type: { + name: "BootstrapParams" + field: { + name: "id" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "id" + } + field: { + name: "namespace" + number: 2 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "namespace" + } + field: { + name: "enable_debug" + number: 3 + label: LABEL_OPTIONAL + type: TYPE_BOOL + json_name: "enableDebug" + } + field: { + name: "containerd_ttrpc_address" + number: 4 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "containerdTtrpcAddress" + } + field: { + name: "containerd_grpc_address" + number: 5 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "containerdGrpcAddress" + } + field: { + name: "containerd_binary" + number: 8 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "containerdBinary" + } + field: { + name: "extensions" + number: 9 + label: LABEL_REPEATED + type: TYPE_MESSAGE + type_name: ".containerd.runtime.bootstrap.v1.Extension" + json_name: "extensions" + } + } + message_type: { + name: "Extension" + field: { + name: "value" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: ".google.protobuf.Any" + json_name: "value" + } + } + message_type: { + name: "BootstrapResult" + field: { + name: "version" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_INT32 + json_name: "version" + } + field: { + name: "address" + number: 2 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "address" + } + field: { + name: "protocol" + number: 3 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "protocol" + } + field: { + name: "capabilities" + number: 4 + label: LABEL_REPEATED + type: TYPE_STRING + json_name: "capabilities" + } + field: { + name: "metadata" + number: 5 + label: LABEL_REPEATED + type: TYPE_MESSAGE + type_name: ".containerd.runtime.bootstrap.v1.BootstrapResult.MetadataEntry" + json_name: "metadata" + } + nested_type: { + name: "MetadataEntry" + 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 + } + } + } + options: { + go_package: "github.com/containerd/containerd/api/runtime/bootstrap/v1;bootstrap" + } + source_code_info: { + location: { + span: 38 + span: 0 + span: 101 + span: 1 + } + location: { + path: 12 + span: 38 + span: 0 + span: 18 + leading_detached_comments: "\nCopyright The containerd Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n" + leading_detached_comments: " Bootstrap Protocol\n\n This protocol defines the interface between containerd and shims at startup.\n It replaces the previous scattered configuration mechanisms (CLI args, env vars,\n stdin JSON, spec.json annotations) with a single, versioned, extensible protocol.\n\n Flow:\n 1. containerd spawns the shim process\n 2. containerd writes BootstrapParams as JSON to shim's stdin\n 3. shim initializes and writes BootstrapResult as JSON to stdout\n 4. containerd connects to the address provided in BootstrapResult\n\n Note: JSON serialization is used to keep shim binaries small since the\n encoding/json package is already part of the Go runtime. The proto\n definition serves as the schema for detecting breaking changes and\n maintaining forward/backward compatibility.\n\n This design enables:\n - Forward/backward compatibility via version field\n - Typed extensibility via google.protobuf.Any and Extension\n - Clear capability negotiation between containerd and shims\n" + } + location: { + path: 2 + span: 40 + span: 0 + span: 40 + } + location: { + path: 3 + path: 0 + span: 42 + span: 0 + span: 35 + } + location: { + path: 8 + span: 44 + span: 0 + span: 90 + } + location: { + path: 8 + path: 11 + span: 44 + span: 0 + span: 90 + } + location: { + path: 4 + path: 0 + span: 47 + span: 0 + span: 70 + span: 1 + leading_comments: " BootstrapParams contains all configuration passed from containerd to shim at startup.\n" + } + location: { + path: 4 + path: 0 + path: 1 + span: 47 + span: 8 + span: 23 + } + location: { + path: 4 + path: 0 + path: 2 + path: 0 + span: 49 + span: 2 + span: 16 + leading_comments: " Container/sandbox ID\n" + } + location: { + path: 4 + path: 0 + path: 2 + path: 0 + path: 5 + span: 49 + span: 2 + span: 8 + } + location: { + path: 4 + path: 0 + path: 2 + path: 0 + path: 1 + span: 49 + span: 9 + span: 11 + } + location: { + path: 4 + path: 0 + path: 2 + path: 0 + path: 3 + span: 49 + span: 14 + span: 15 + } + location: { + path: 4 + path: 0 + path: 2 + path: 1 + span: 52 + span: 2 + span: 23 + leading_comments: " Namespace for the container\n" + } + location: { + path: 4 + path: 0 + path: 2 + path: 1 + path: 5 + span: 52 + span: 2 + span: 8 + } + location: { + path: 4 + path: 0 + path: 2 + path: 1 + path: 1 + span: 52 + span: 9 + span: 18 + } + location: { + path: 4 + path: 0 + path: 2 + path: 1 + path: 3 + span: 52 + span: 21 + span: 22 + } + location: { + path: 4 + path: 0 + path: 2 + path: 2 + span: 55 + span: 2 + span: 24 + leading_comments: " Enable debug messages in logs.\n" + } + location: { + path: 4 + path: 0 + path: 2 + path: 2 + path: 5 + span: 55 + span: 2 + span: 6 + } + location: { + path: 4 + path: 0 + path: 2 + path: 2 + path: 1 + span: 55 + span: 7 + span: 19 + } + location: { + path: 4 + path: 0 + path: 2 + path: 2 + path: 3 + span: 55 + span: 22 + span: 23 + } + location: { + path: 4 + path: 0 + path: 2 + path: 3 + span: 58 + span: 2 + span: 38 + leading_comments: " Containerd's TTRPC API address (e.g., \"unix:///run/containerd/containerd.sock.ttrpc\")\n" + } + location: { + path: 4 + path: 0 + path: 2 + path: 3 + path: 5 + span: 58 + span: 2 + span: 8 + } + location: { + path: 4 + path: 0 + path: 2 + path: 3 + path: 1 + span: 58 + span: 9 + span: 33 + } + location: { + path: 4 + path: 0 + path: 2 + path: 3 + path: 3 + span: 58 + span: 36 + span: 37 + } + location: { + path: 4 + path: 0 + path: 2 + path: 4 + span: 61 + span: 2 + span: 37 + leading_comments: " Containerd's gRPC API address (e.g., \"unix:///run/containerd/containerd.sock\")\n" + } + location: { + path: 4 + path: 0 + path: 2 + path: 4 + path: 5 + span: 61 + span: 2 + span: 8 + } + location: { + path: 4 + path: 0 + path: 2 + path: 4 + path: 1 + span: 61 + span: 9 + span: 32 + } + location: { + path: 4 + path: 0 + path: 2 + path: 4 + path: 3 + span: 61 + span: 35 + span: 36 + } + location: { + path: 4 + path: 0 + path: 2 + path: 5 + span: 64 + span: 2 + span: 31 + leading_comments: " Path to containerd binary for event publishing\n" + } + location: { + path: 4 + path: 0 + path: 2 + path: 5 + path: 5 + span: 64 + span: 2 + span: 8 + } + location: { + path: 4 + path: 0 + path: 2 + path: 5 + path: 1 + span: 64 + span: 9 + span: 26 + } + location: { + path: 4 + path: 0 + path: 2 + path: 5 + path: 3 + span: 64 + span: 29 + span: 30 + } + location: { + path: 4 + path: 0 + path: 2 + path: 6 + span: 69 + span: 2 + span: 36 + leading_comments: " Extensible configuration sections for new features\n Each section can contain arbitrary structured data identified by type URL\n Examples: CRI config, NRI config, sandbox config, etc.\n" + } + location: { + path: 4 + path: 0 + path: 2 + path: 6 + path: 4 + span: 69 + span: 2 + span: 10 + } + location: { + path: 4 + path: 0 + path: 2 + path: 6 + path: 6 + span: 69 + span: 11 + span: 20 + } + location: { + path: 4 + path: 0 + path: 2 + path: 6 + path: 1 + span: 69 + span: 21 + span: 31 + } + location: { + path: 4 + path: 0 + path: 2 + path: 6 + path: 3 + span: 69 + span: 34 + span: 35 + } + location: { + path: 4 + path: 1 + span: 74 + span: 0 + span: 81 + span: 1 + leading_comments: " Extension provides extensibility for new configuration types\n without changing the core BootstrapParams protocol\n" + } + location: { + path: 4 + path: 1 + path: 1 + span: 74 + span: 8 + span: 17 + } + location: { + path: 4 + path: 1 + path: 2 + path: 0 + span: 80 + span: 2 + span: 32 + leading_comments: " Configuration data with embedded type URL\n Examples of type URLs:\n - \"containerd.io/cri.v1.PodSandboxConfig\"\n - \"containerd.io/nri.v1.PluginConfig\"\n - \"containerd.io/sandbox.v1.SandboxConfig\"\n" + } + location: { + path: 4 + path: 1 + path: 2 + path: 0 + path: 6 + span: 80 + span: 2 + span: 21 + } + location: { + path: 4 + path: 1 + path: 2 + path: 0 + path: 1 + span: 80 + span: 22 + span: 27 + } + location: { + path: 4 + path: 1 + path: 2 + path: 0 + path: 3 + span: 80 + span: 30 + span: 31 + } + location: { + path: 4 + path: 2 + span: 84 + span: 0 + span: 101 + span: 1 + leading_comments: " BootstrapResult is returned by shim via stdout after successful startup\n" + } + location: { + path: 4 + path: 2 + path: 1 + span: 84 + span: 8 + span: 23 + } + location: { + path: 4 + path: 2 + path: 2 + path: 0 + span: 86 + span: 2 + span: 20 + leading_comments: " Version of shim parameters (expected 2 for shim v2)\n" + } + location: { + path: 4 + path: 2 + path: 2 + path: 0 + path: 5 + span: 86 + span: 2 + span: 7 + } + location: { + path: 4 + path: 2 + path: 2 + path: 0 + path: 1 + span: 86 + span: 8 + span: 15 + } + location: { + path: 4 + path: 2 + path: 2 + path: 0 + path: 3 + span: 86 + span: 18 + span: 19 + } + location: { + path: 4 + path: 2 + path: 2 + path: 1 + span: 90 + span: 2 + span: 21 + leading_comments: " Address where shim is listening (e.g., \"unix:///run/containerd/shim.sock\")\n Containerd will connect to this address for task operations\n" + } + location: { + path: 4 + path: 2 + path: 2 + path: 1 + path: 5 + span: 90 + span: 2 + span: 8 + } + location: { + path: 4 + path: 2 + path: 2 + path: 1 + path: 1 + span: 90 + span: 9 + span: 16 + } + location: { + path: 4 + path: 2 + path: 2 + path: 1 + path: 3 + span: 90 + span: 19 + span: 20 + } + location: { + path: 4 + path: 2 + path: 2 + path: 2 + span: 93 + span: 2 + span: 22 + leading_comments: " Protocol used by shim: \"ttrpc\" or \"grpc\"\n" + } + location: { + path: 4 + path: 2 + path: 2 + path: 2 + path: 5 + span: 93 + span: 2 + span: 8 + } + location: { + path: 4 + path: 2 + path: 2 + path: 2 + path: 1 + span: 93 + span: 9 + span: 17 + } + location: { + path: 4 + path: 2 + path: 2 + path: 2 + path: 3 + span: 93 + span: 20 + span: 21 + } + location: { + path: 4 + path: 2 + path: 2 + path: 3 + span: 97 + span: 2 + span: 35 + leading_comments: " Optional: Capabilities supported by this shim instance\n Allows shim to advertise what features it supports\n" + } + location: { + path: 4 + path: 2 + path: 2 + path: 3 + path: 4 + span: 97 + span: 2 + span: 10 + } + location: { + path: 4 + path: 2 + path: 2 + path: 3 + path: 5 + span: 97 + span: 11 + span: 17 + } + location: { + path: 4 + path: 2 + path: 2 + path: 3 + path: 1 + span: 97 + span: 18 + span: 30 + } + location: { + path: 4 + path: 2 + path: 2 + path: 3 + path: 3 + span: 97 + span: 33 + span: 34 + } + location: { + path: 4 + path: 2 + path: 2 + path: 4 + span: 100 + span: 2 + span: 35 + leading_comments: " Optional: Additional metadata from shim\n" + } + location: { + path: 4 + path: 2 + path: 2 + path: 4 + path: 6 + span: 100 + span: 2 + span: 21 + } + location: { + path: 4 + path: 2 + path: 2 + path: 4 + path: 1 + span: 100 + span: 22 + span: 30 + } + location: { + path: 4 + path: 2 + path: 2 + path: 4 + path: 3 + span: 100 + span: 33 + span: 34 + } + } + syntax: "proto3" + buf_extension: { + is_import: false + module_info: { + name: { + remote: "buf.build" + owner: "containerd" + repository: "api-dev" + } + } + is_syntax_unspecified: false + } +} file: { name: "types/metrics.proto" package: "containerd.types" diff --git a/api/runtime/boot/v1/bootstrap.pb.go b/api/runtime/boot/v1/bootstrap.pb.go index c775f09a65ed4..28c4cad8b8aec 100644 --- a/api/runtime/boot/v1/bootstrap.pb.go +++ b/api/runtime/boot/v1/bootstrap.pb.go @@ -74,10 +74,6 @@ type BootstrapParams struct { ContainerdTtrpcAddress string `protobuf:"bytes,4,opt,name=containerd_ttrpc_address,json=containerdTtrpcAddress,proto3" json:"containerd_ttrpc_address,omitempty"` // Containerd's gRPC API address (e.g., "unix:///run/containerd/containerd.sock") ContainerdGrpcAddress string `protobuf:"bytes,5,opt,name=containerd_grpc_address,json=containerdGrpcAddress,proto3" json:"containerd_grpc_address,omitempty"` - // Socket path to serve. - SocketPath string `protobuf:"bytes,6,opt,name=socket_path,json=socketPath,proto3" json:"socket_path,omitempty"` - // Debug socket path to serve. - SocketPathDebug string `protobuf:"bytes,7,opt,name=socket_path_debug,json=socketPathDebug,proto3" json:"socket_path_debug,omitempty"` // Path to containerd binary for event publishing ContainerdBinary string `protobuf:"bytes,8,opt,name=containerd_binary,json=containerdBinary,proto3" json:"containerd_binary,omitempty"` // Extensible configuration sections for new features @@ -153,20 +149,6 @@ func (x *BootstrapParams) GetContainerdGrpcAddress() string { return "" } -func (x *BootstrapParams) GetSocketPath() string { - if x != nil { - return x.SocketPath - } - return "" -} - -func (x *BootstrapParams) GetSocketPathDebug() string { - if x != nil { - return x.SocketPathDebug - } - return "" -} - func (x *BootstrapParams) GetContainerdBinary() string { if x != nil { return x.ContainerdBinary @@ -330,7 +312,7 @@ var file_runtime_boot_v1_bootstrap_proto_rawDesc = []byte{ 0x6f, 0x12, 0x1f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9a, 0x03, + 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xcd, 0x02, 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, @@ -344,46 +326,41 @@ var file_runtime_boot_v1_bootstrap_proto_rawDesc = []byte{ 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x47, 0x72, 0x70, 0x63, 0x41, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x5f, 0x70, - 0x61, 0x74, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x6f, 0x63, 0x6b, 0x65, - 0x74, 0x50, 0x61, 0x74, 0x68, 0x12, 0x2a, 0x0a, 0x11, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x5f, - 0x70, 0x61, 0x74, 0x68, 0x5f, 0x64, 0x65, 0x62, 0x75, 0x67, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0f, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x50, 0x61, 0x74, 0x68, 0x44, 0x65, 0x62, 0x75, - 0x67, 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, - 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x12, 0x4a, - 0x0a, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x09, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, - 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, - 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0a, - 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x37, 0x0a, 0x09, 0x45, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x22, 0x9e, 0x02, 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, - 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x61, 0x70, 0x61, 0x62, - 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x63, - 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x5a, 0x0a, 0x08, 0x6d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3e, 0x2e, - 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, - 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, - 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x2e, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x3a, 0x02, 0x38, 0x01, 0x42, 0x45, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x75, 0x6e, - 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2f, 0x76, - 0x31, 0x3b, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x72, 0x65, 0x73, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x64, 0x5f, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x10, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x42, 0x69, 0x6e, 0x61, 0x72, + 0x79, 0x12, 0x4a, 0x0a, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, + 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, + 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, + 0x6e, 0x52, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x37, 0x0a, + 0x09, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x9e, 0x02, 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x74, 0x73, + 0x74, 0x72, 0x61, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1a, + 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x61, + 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x0c, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x5a, + 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x3e, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, + 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, + 0x76, 0x31, 0x2e, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x52, 0x65, 0x73, 0x75, + 0x6c, 0x74, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, + 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x45, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, + 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, + 0x70, 0x2f, 0x76, 0x31, 0x3b, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/runtime/boot/v1/bootstrap.proto b/api/runtime/boot/v1/bootstrap.proto index 3fd2a8127e3c1..530904ef370c5 100644 --- a/api/runtime/boot/v1/bootstrap.proto +++ b/api/runtime/boot/v1/bootstrap.proto @@ -1,17 +1,17 @@ /* - Copyright The containerd Authors. + 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 + 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 + 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. + 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. */ // Bootstrap Protocol @@ -46,63 +46,57 @@ option go_package = "github.com/containerd/containerd/api/runtime/bootstrap/v1;b // BootstrapParams contains all configuration passed from containerd to shim at startup. message BootstrapParams { - // Container/sandbox ID - string id = 1; + // Container/sandbox ID + string id = 1; - // Namespace for the container - string namespace = 2; + // Namespace for the container + string namespace = 2; - // Enable debug messages in logs. - bool enable_debug = 3; + // Enable debug messages in logs. + bool enable_debug = 3; - // Containerd's TTRPC API address (e.g., "unix:///run/containerd/containerd.sock.ttrpc") - string containerd_ttrpc_address = 4; + // Containerd's TTRPC API address (e.g., "unix:///run/containerd/containerd.sock.ttrpc") + string containerd_ttrpc_address = 4; - // Containerd's gRPC API address (e.g., "unix:///run/containerd/containerd.sock") - string containerd_grpc_address = 5; + // Containerd's gRPC API address (e.g., "unix:///run/containerd/containerd.sock") + string containerd_grpc_address = 5; - // Socket path to serve. - string socket_path = 6; + // Path to containerd binary for event publishing + string containerd_binary = 8; - // Debug socket path to serve. - string socket_path_debug = 7; - - // Path to containerd binary for event publishing - string containerd_binary = 8; - - // Extensible configuration sections for new features - // Each section can contain arbitrary structured data identified by type URL - // Examples: CRI config, NRI config, sandbox config, etc. - repeated Extension extensions = 9; + // Extensible configuration sections for new features + // Each section can contain arbitrary structured data identified by type URL + // Examples: CRI config, NRI config, sandbox config, etc. + repeated Extension extensions = 9; } // Extension provides extensibility for new configuration types // without changing the core BootstrapParams protocol message Extension { - // Configuration data with embedded type URL - // Examples of type URLs: - // - "containerd.io/cri.v1.PodSandboxConfig" - // - "containerd.io/nri.v1.PluginConfig" - // - "containerd.io/sandbox.v1.SandboxConfig" - google.protobuf.Any value = 1; + // Configuration data with embedded type URL + // Examples of type URLs: + // - "containerd.io/cri.v1.PodSandboxConfig" + // - "containerd.io/nri.v1.PluginConfig" + // - "containerd.io/sandbox.v1.SandboxConfig" + google.protobuf.Any value = 1; } // BootstrapResult is returned by shim via stdout after successful startup message BootstrapResult { - // Version of shim parameters (expected 2 for shim v2) - int32 version = 1; + // Version of shim parameters (expected 2 for shim v2) + int32 version = 1; - // Address where shim is listening (e.g., "unix:///run/containerd/shim.sock") - // Containerd will connect to this address for task operations - string address = 2; + // Address where shim is listening (e.g., "unix:///run/containerd/shim.sock") + // Containerd will connect to this address for task operations + string address = 2; - // Protocol used by shim: "ttrpc" or "grpc" - string protocol = 3; + // Protocol used by shim: "ttrpc" or "grpc" + string protocol = 3; - // Optional: Capabilities supported by this shim instance - // Allows shim to advertise what features it supports - repeated string capabilities = 4; + // Optional: Capabilities supported by this shim instance + // Allows shim to advertise what features it supports + repeated string capabilities = 4; - // Optional: Additional metadata from shim - map metadata = 5; + // Optional: Additional metadata from shim + map metadata = 5; } diff --git a/pkg/shim/compat.go b/pkg/shim/compat.go index 05d1eeea9f112..7622d553cc4e2 100644 --- a/pkg/shim/compat.go +++ b/pkg/shim/compat.go @@ -34,8 +34,6 @@ func readBootstrapParamsFromDeprecatedFields(input []byte, params *BootstrapPara params.Namespace = namespaceFlag params.ContainerdTtrpcAddress = os.Getenv(ttrpcAddressEnv) params.ContainerdGrpcAddress = os.Getenv(grpcAddressEnv) - params.SocketPath = socketFlag - params.SocketPathDebug = debugSocketFlag params.ContainerdBinary = containerdBinaryFlag params.EnableDebug = debugFlag diff --git a/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.pb.go b/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.pb.go index c775f09a65ed4..28c4cad8b8aec 100644 --- a/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.pb.go +++ b/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.pb.go @@ -74,10 +74,6 @@ type BootstrapParams struct { ContainerdTtrpcAddress string `protobuf:"bytes,4,opt,name=containerd_ttrpc_address,json=containerdTtrpcAddress,proto3" json:"containerd_ttrpc_address,omitempty"` // Containerd's gRPC API address (e.g., "unix:///run/containerd/containerd.sock") ContainerdGrpcAddress string `protobuf:"bytes,5,opt,name=containerd_grpc_address,json=containerdGrpcAddress,proto3" json:"containerd_grpc_address,omitempty"` - // Socket path to serve. - SocketPath string `protobuf:"bytes,6,opt,name=socket_path,json=socketPath,proto3" json:"socket_path,omitempty"` - // Debug socket path to serve. - SocketPathDebug string `protobuf:"bytes,7,opt,name=socket_path_debug,json=socketPathDebug,proto3" json:"socket_path_debug,omitempty"` // Path to containerd binary for event publishing ContainerdBinary string `protobuf:"bytes,8,opt,name=containerd_binary,json=containerdBinary,proto3" json:"containerd_binary,omitempty"` // Extensible configuration sections for new features @@ -153,20 +149,6 @@ func (x *BootstrapParams) GetContainerdGrpcAddress() string { return "" } -func (x *BootstrapParams) GetSocketPath() string { - if x != nil { - return x.SocketPath - } - return "" -} - -func (x *BootstrapParams) GetSocketPathDebug() string { - if x != nil { - return x.SocketPathDebug - } - return "" -} - func (x *BootstrapParams) GetContainerdBinary() string { if x != nil { return x.ContainerdBinary @@ -330,7 +312,7 @@ var file_runtime_boot_v1_bootstrap_proto_rawDesc = []byte{ 0x6f, 0x12, 0x1f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9a, 0x03, + 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xcd, 0x02, 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, @@ -344,46 +326,41 @@ var file_runtime_boot_v1_bootstrap_proto_rawDesc = []byte{ 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x47, 0x72, 0x70, 0x63, 0x41, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x5f, 0x70, - 0x61, 0x74, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x6f, 0x63, 0x6b, 0x65, - 0x74, 0x50, 0x61, 0x74, 0x68, 0x12, 0x2a, 0x0a, 0x11, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x5f, - 0x70, 0x61, 0x74, 0x68, 0x5f, 0x64, 0x65, 0x62, 0x75, 0x67, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0f, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x50, 0x61, 0x74, 0x68, 0x44, 0x65, 0x62, 0x75, - 0x67, 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, - 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x12, 0x4a, - 0x0a, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x09, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, - 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, - 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0a, - 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x37, 0x0a, 0x09, 0x45, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x22, 0x9e, 0x02, 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, - 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x61, 0x70, 0x61, 0x62, - 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x63, - 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x5a, 0x0a, 0x08, 0x6d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3e, 0x2e, - 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, - 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, - 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x2e, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x3a, 0x02, 0x38, 0x01, 0x42, 0x45, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x75, 0x6e, - 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2f, 0x76, - 0x31, 0x3b, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x72, 0x65, 0x73, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x64, 0x5f, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x10, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x42, 0x69, 0x6e, 0x61, 0x72, + 0x79, 0x12, 0x4a, 0x0a, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, + 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, + 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, + 0x6e, 0x52, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x37, 0x0a, + 0x09, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x9e, 0x02, 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x74, 0x73, + 0x74, 0x72, 0x61, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1a, + 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x61, + 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x0c, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x5a, + 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x3e, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, + 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, + 0x76, 0x31, 0x2e, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x52, 0x65, 0x73, 0x75, + 0x6c, 0x74, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, + 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x45, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, + 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, + 0x70, 0x2f, 0x76, 0x31, 0x3b, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.proto b/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.proto index 3fd2a8127e3c1..530904ef370c5 100644 --- a/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.proto +++ b/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.proto @@ -1,17 +1,17 @@ /* - Copyright The containerd Authors. + 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 + 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 + 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. + 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. */ // Bootstrap Protocol @@ -46,63 +46,57 @@ option go_package = "github.com/containerd/containerd/api/runtime/bootstrap/v1;b // BootstrapParams contains all configuration passed from containerd to shim at startup. message BootstrapParams { - // Container/sandbox ID - string id = 1; + // Container/sandbox ID + string id = 1; - // Namespace for the container - string namespace = 2; + // Namespace for the container + string namespace = 2; - // Enable debug messages in logs. - bool enable_debug = 3; + // Enable debug messages in logs. + bool enable_debug = 3; - // Containerd's TTRPC API address (e.g., "unix:///run/containerd/containerd.sock.ttrpc") - string containerd_ttrpc_address = 4; + // Containerd's TTRPC API address (e.g., "unix:///run/containerd/containerd.sock.ttrpc") + string containerd_ttrpc_address = 4; - // Containerd's gRPC API address (e.g., "unix:///run/containerd/containerd.sock") - string containerd_grpc_address = 5; + // Containerd's gRPC API address (e.g., "unix:///run/containerd/containerd.sock") + string containerd_grpc_address = 5; - // Socket path to serve. - string socket_path = 6; + // Path to containerd binary for event publishing + string containerd_binary = 8; - // Debug socket path to serve. - string socket_path_debug = 7; - - // Path to containerd binary for event publishing - string containerd_binary = 8; - - // Extensible configuration sections for new features - // Each section can contain arbitrary structured data identified by type URL - // Examples: CRI config, NRI config, sandbox config, etc. - repeated Extension extensions = 9; + // Extensible configuration sections for new features + // Each section can contain arbitrary structured data identified by type URL + // Examples: CRI config, NRI config, sandbox config, etc. + repeated Extension extensions = 9; } // Extension provides extensibility for new configuration types // without changing the core BootstrapParams protocol message Extension { - // Configuration data with embedded type URL - // Examples of type URLs: - // - "containerd.io/cri.v1.PodSandboxConfig" - // - "containerd.io/nri.v1.PluginConfig" - // - "containerd.io/sandbox.v1.SandboxConfig" - google.protobuf.Any value = 1; + // Configuration data with embedded type URL + // Examples of type URLs: + // - "containerd.io/cri.v1.PodSandboxConfig" + // - "containerd.io/nri.v1.PluginConfig" + // - "containerd.io/sandbox.v1.SandboxConfig" + google.protobuf.Any value = 1; } // BootstrapResult is returned by shim via stdout after successful startup message BootstrapResult { - // Version of shim parameters (expected 2 for shim v2) - int32 version = 1; + // Version of shim parameters (expected 2 for shim v2) + int32 version = 1; - // Address where shim is listening (e.g., "unix:///run/containerd/shim.sock") - // Containerd will connect to this address for task operations - string address = 2; + // Address where shim is listening (e.g., "unix:///run/containerd/shim.sock") + // Containerd will connect to this address for task operations + string address = 2; - // Protocol used by shim: "ttrpc" or "grpc" - string protocol = 3; + // Protocol used by shim: "ttrpc" or "grpc" + string protocol = 3; - // Optional: Capabilities supported by this shim instance - // Allows shim to advertise what features it supports - repeated string capabilities = 4; + // Optional: Capabilities supported by this shim instance + // Allows shim to advertise what features it supports + repeated string capabilities = 4; - // Optional: Additional metadata from shim - map metadata = 5; + // Optional: Additional metadata from shim + map metadata = 5; } From 31d0bbbad7723c8555b299f1dc12f7173390b2ec Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Sat, 7 Feb 2026 12:36:21 -0800 Subject: [PATCH 12/28] Include containerd version when launching shim Signed-off-by: Maksym Pavlenko --- api/next.txtpb | 165 +++++++++++------- api/runtime/boot/v1/bootstrap.pb.go | 106 ++++++----- api/runtime/boot/v1/bootstrap.proto | 11 +- pkg/shim/util.go | 2 + .../api/runtime/boot/v1/bootstrap.pb.go | 106 ++++++----- .../api/runtime/boot/v1/bootstrap.proto | 11 +- 6 files changed, 240 insertions(+), 161 deletions(-) diff --git a/api/next.txtpb b/api/next.txtpb index d71dedc712673..fb05f87ae9206 100644 --- a/api/next.txtpb +++ b/api/next.txtpb @@ -24954,29 +24954,36 @@ file: { json_name: "enableDebug" } field: { - name: "containerd_ttrpc_address" + name: "containerd_version" number: 4 label: LABEL_OPTIONAL type: TYPE_STRING + json_name: "containerdVersion" + } + field: { + name: "containerd_ttrpc_address" + number: 5 + label: LABEL_OPTIONAL + type: TYPE_STRING json_name: "containerdTtrpcAddress" } field: { name: "containerd_grpc_address" - number: 5 + number: 6 label: LABEL_OPTIONAL type: TYPE_STRING json_name: "containerdGrpcAddress" } field: { name: "containerd_binary" - number: 8 + number: 7 label: LABEL_OPTIONAL type: TYPE_STRING json_name: "containerdBinary" } field: { name: "extensions" - number: 9 + number: 8 label: LABEL_REPEATED type: TYPE_MESSAGE type_name: ".containerd.runtime.bootstrap.v1.Extension" @@ -25060,7 +25067,7 @@ file: { location: { span: 38 span: 0 - span: 101 + span: 104 span: 1 } location: { @@ -25102,7 +25109,7 @@ file: { path: 0 span: 47 span: 0 - span: 70 + span: 73 span: 1 leading_comments: " BootstrapParams contains all configuration passed from containerd to shim at startup.\n" } @@ -25241,8 +25248,8 @@ file: { path: 3 span: 58 span: 2 - span: 38 - leading_comments: " Containerd's TTRPC API address (e.g., \"unix:///run/containerd/containerd.sock.ttrpc\")\n" + span: 32 + leading_comments: " containerd daemon version that is launching this shim.\n" } location: { path: 4 @@ -25262,7 +25269,7 @@ file: { path: 1 span: 58 span: 9 - span: 33 + span: 27 } location: { path: 4 @@ -25271,8 +25278,8 @@ file: { path: 3 path: 3 span: 58 - span: 36 - span: 37 + span: 30 + span: 31 } location: { path: 4 @@ -25281,8 +25288,8 @@ file: { path: 4 span: 61 span: 2 - span: 37 - leading_comments: " Containerd's gRPC API address (e.g., \"unix:///run/containerd/containerd.sock\")\n" + span: 38 + leading_comments: " Containerd's TTRPC API address (e.g., \"unix:///run/containerd/containerd.sock.ttrpc\")\n" } location: { path: 4 @@ -25302,7 +25309,7 @@ file: { path: 1 span: 61 span: 9 - span: 32 + span: 33 } location: { path: 4 @@ -25311,8 +25318,8 @@ file: { path: 4 path: 3 span: 61 - span: 35 span: 36 + span: 37 } location: { path: 4 @@ -25321,8 +25328,8 @@ file: { path: 5 span: 64 span: 2 - span: 31 - leading_comments: " Path to containerd binary for event publishing\n" + span: 37 + leading_comments: " Containerd's gRPC API address (e.g., \"unix:///run/containerd/containerd.sock\")\n" } location: { path: 4 @@ -25342,7 +25349,7 @@ file: { path: 1 span: 64 span: 9 - span: 26 + span: 32 } location: { path: 4 @@ -25351,6 +25358,46 @@ file: { path: 5 path: 3 span: 64 + span: 35 + span: 36 + } + location: { + path: 4 + path: 0 + path: 2 + path: 6 + span: 67 + span: 2 + span: 31 + leading_comments: " Path to containerd binary for event publishing\n" + } + location: { + path: 4 + path: 0 + path: 2 + path: 6 + path: 5 + span: 67 + span: 2 + span: 8 + } + location: { + path: 4 + path: 0 + path: 2 + path: 6 + path: 1 + span: 67 + span: 9 + span: 26 + } + location: { + path: 4 + path: 0 + path: 2 + path: 6 + path: 3 + span: 67 span: 29 span: 30 } @@ -25358,8 +25405,8 @@ file: { path: 4 path: 0 path: 2 - path: 6 - span: 69 + path: 7 + span: 72 span: 2 span: 36 leading_comments: " Extensible configuration sections for new features\n Each section can contain arbitrary structured data identified by type URL\n Examples: CRI config, NRI config, sandbox config, etc.\n" @@ -25368,9 +25415,9 @@ file: { path: 4 path: 0 path: 2 - path: 6 + path: 7 path: 4 - span: 69 + span: 72 span: 2 span: 10 } @@ -25378,9 +25425,9 @@ file: { path: 4 path: 0 path: 2 + path: 7 path: 6 - path: 6 - span: 69 + span: 72 span: 11 span: 20 } @@ -25388,9 +25435,9 @@ file: { path: 4 path: 0 path: 2 - path: 6 + path: 7 path: 1 - span: 69 + span: 72 span: 21 span: 31 } @@ -25398,18 +25445,18 @@ file: { path: 4 path: 0 path: 2 - path: 6 + path: 7 path: 3 - span: 69 + span: 72 span: 34 span: 35 } location: { path: 4 path: 1 - span: 74 + span: 77 span: 0 - span: 81 + span: 84 span: 1 leading_comments: " Extension provides extensibility for new configuration types\n without changing the core BootstrapParams protocol\n" } @@ -25417,7 +25464,7 @@ file: { path: 4 path: 1 path: 1 - span: 74 + span: 77 span: 8 span: 17 } @@ -25426,7 +25473,7 @@ file: { path: 1 path: 2 path: 0 - span: 80 + span: 83 span: 2 span: 32 leading_comments: " Configuration data with embedded type URL\n Examples of type URLs:\n - \"containerd.io/cri.v1.PodSandboxConfig\"\n - \"containerd.io/nri.v1.PluginConfig\"\n - \"containerd.io/sandbox.v1.SandboxConfig\"\n" @@ -25437,7 +25484,7 @@ file: { path: 2 path: 0 path: 6 - span: 80 + span: 83 span: 2 span: 21 } @@ -25447,7 +25494,7 @@ file: { path: 2 path: 0 path: 1 - span: 80 + span: 83 span: 22 span: 27 } @@ -25457,16 +25504,16 @@ file: { path: 2 path: 0 path: 3 - span: 80 + span: 83 span: 30 span: 31 } location: { path: 4 path: 2 - span: 84 + span: 87 span: 0 - span: 101 + span: 104 span: 1 leading_comments: " BootstrapResult is returned by shim via stdout after successful startup\n" } @@ -25474,7 +25521,7 @@ file: { path: 4 path: 2 path: 1 - span: 84 + span: 87 span: 8 span: 23 } @@ -25483,7 +25530,7 @@ file: { path: 2 path: 2 path: 0 - span: 86 + span: 89 span: 2 span: 20 leading_comments: " Version of shim parameters (expected 2 for shim v2)\n" @@ -25494,7 +25541,7 @@ file: { path: 2 path: 0 path: 5 - span: 86 + span: 89 span: 2 span: 7 } @@ -25504,7 +25551,7 @@ file: { path: 2 path: 0 path: 1 - span: 86 + span: 89 span: 8 span: 15 } @@ -25514,7 +25561,7 @@ file: { path: 2 path: 0 path: 3 - span: 86 + span: 89 span: 18 span: 19 } @@ -25523,7 +25570,7 @@ file: { path: 2 path: 2 path: 1 - span: 90 + span: 93 span: 2 span: 21 leading_comments: " Address where shim is listening (e.g., \"unix:///run/containerd/shim.sock\")\n Containerd will connect to this address for task operations\n" @@ -25534,7 +25581,7 @@ file: { path: 2 path: 1 path: 5 - span: 90 + span: 93 span: 2 span: 8 } @@ -25544,7 +25591,7 @@ file: { path: 2 path: 1 path: 1 - span: 90 + span: 93 span: 9 span: 16 } @@ -25554,7 +25601,7 @@ file: { path: 2 path: 1 path: 3 - span: 90 + span: 93 span: 19 span: 20 } @@ -25563,7 +25610,7 @@ file: { path: 2 path: 2 path: 2 - span: 93 + span: 96 span: 2 span: 22 leading_comments: " Protocol used by shim: \"ttrpc\" or \"grpc\"\n" @@ -25574,7 +25621,7 @@ file: { path: 2 path: 2 path: 5 - span: 93 + span: 96 span: 2 span: 8 } @@ -25584,7 +25631,7 @@ file: { path: 2 path: 2 path: 1 - span: 93 + span: 96 span: 9 span: 17 } @@ -25594,7 +25641,7 @@ file: { path: 2 path: 2 path: 3 - span: 93 + span: 96 span: 20 span: 21 } @@ -25603,7 +25650,7 @@ file: { path: 2 path: 2 path: 3 - span: 97 + span: 100 span: 2 span: 35 leading_comments: " Optional: Capabilities supported by this shim instance\n Allows shim to advertise what features it supports\n" @@ -25614,7 +25661,7 @@ file: { path: 2 path: 3 path: 4 - span: 97 + span: 100 span: 2 span: 10 } @@ -25624,7 +25671,7 @@ file: { path: 2 path: 3 path: 5 - span: 97 + span: 100 span: 11 span: 17 } @@ -25634,7 +25681,7 @@ file: { path: 2 path: 3 path: 1 - span: 97 + span: 100 span: 18 span: 30 } @@ -25644,7 +25691,7 @@ file: { path: 2 path: 3 path: 3 - span: 97 + span: 100 span: 33 span: 34 } @@ -25653,7 +25700,7 @@ file: { path: 2 path: 2 path: 4 - span: 100 + span: 103 span: 2 span: 35 leading_comments: " Optional: Additional metadata from shim\n" @@ -25664,7 +25711,7 @@ file: { path: 2 path: 4 path: 6 - span: 100 + span: 103 span: 2 span: 21 } @@ -25674,7 +25721,7 @@ file: { path: 2 path: 4 path: 1 - span: 100 + span: 103 span: 22 span: 30 } @@ -25684,7 +25731,7 @@ file: { path: 2 path: 4 path: 3 - span: 100 + span: 103 span: 33 span: 34 } diff --git a/api/runtime/boot/v1/bootstrap.pb.go b/api/runtime/boot/v1/bootstrap.pb.go index 28c4cad8b8aec..7848151affeda 100644 --- a/api/runtime/boot/v1/bootstrap.pb.go +++ b/api/runtime/boot/v1/bootstrap.pb.go @@ -70,16 +70,18 @@ type BootstrapParams struct { Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"` // Enable debug messages in logs. EnableDebug bool `protobuf:"varint,3,opt,name=enable_debug,json=enableDebug,proto3" json:"enable_debug,omitempty"` + // containerd daemon version that is launching this shim. + ContainerdVersion string `protobuf:"bytes,4,opt,name=containerd_version,json=containerdVersion,proto3" json:"containerd_version,omitempty"` // Containerd's TTRPC API address (e.g., "unix:///run/containerd/containerd.sock.ttrpc") - ContainerdTtrpcAddress string `protobuf:"bytes,4,opt,name=containerd_ttrpc_address,json=containerdTtrpcAddress,proto3" json:"containerd_ttrpc_address,omitempty"` + ContainerdTtrpcAddress string `protobuf:"bytes,5,opt,name=containerd_ttrpc_address,json=containerdTtrpcAddress,proto3" json:"containerd_ttrpc_address,omitempty"` // Containerd's gRPC API address (e.g., "unix:///run/containerd/containerd.sock") - ContainerdGrpcAddress string `protobuf:"bytes,5,opt,name=containerd_grpc_address,json=containerdGrpcAddress,proto3" json:"containerd_grpc_address,omitempty"` + ContainerdGrpcAddress string `protobuf:"bytes,6,opt,name=containerd_grpc_address,json=containerdGrpcAddress,proto3" json:"containerd_grpc_address,omitempty"` // Path to containerd binary for event publishing - ContainerdBinary string `protobuf:"bytes,8,opt,name=containerd_binary,json=containerdBinary,proto3" json:"containerd_binary,omitempty"` + ContainerdBinary string `protobuf:"bytes,7,opt,name=containerd_binary,json=containerdBinary,proto3" json:"containerd_binary,omitempty"` // Extensible configuration sections for new features // Each section can contain arbitrary structured data identified by type URL // Examples: CRI config, NRI config, sandbox config, etc. - Extensions []*Extension `protobuf:"bytes,9,rep,name=extensions,proto3" json:"extensions,omitempty"` + Extensions []*Extension `protobuf:"bytes,8,rep,name=extensions,proto3" json:"extensions,omitempty"` } func (x *BootstrapParams) Reset() { @@ -135,6 +137,13 @@ func (x *BootstrapParams) GetEnableDebug() bool { return false } +func (x *BootstrapParams) GetContainerdVersion() string { + if x != nil { + return x.ContainerdVersion + } + return "" +} + func (x *BootstrapParams) GetContainerdTtrpcAddress() string { if x != nil { return x.ContainerdTtrpcAddress @@ -312,55 +321,58 @@ var file_runtime_boot_v1_bootstrap_proto_rawDesc = []byte{ 0x6f, 0x12, 0x1f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xcd, 0x02, + 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xfc, 0x02, 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x64, 0x65, 0x62, 0x75, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x44, 0x65, 0x62, - 0x75, 0x67, 0x12, 0x38, 0x0a, 0x18, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, - 0x5f, 0x74, 0x74, 0x72, 0x70, 0x63, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x16, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, - 0x54, 0x74, 0x72, 0x70, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x36, 0x0a, 0x17, - 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, 0x67, 0x72, 0x70, 0x63, 0x5f, - 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x63, - 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x47, 0x72, 0x70, 0x63, 0x41, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, - 0x72, 0x64, 0x5f, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x10, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x42, 0x69, 0x6e, 0x61, 0x72, - 0x79, 0x12, 0x4a, 0x0a, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, - 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, - 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, - 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x52, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x37, 0x0a, - 0x09, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x9e, 0x02, 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x74, 0x73, - 0x74, 0x72, 0x61, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1a, - 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x61, - 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x0c, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x5a, - 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x3e, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, - 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, - 0x76, 0x31, 0x2e, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x52, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, - 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x45, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, - 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, - 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, - 0x70, 0x2f, 0x76, 0x31, 0x3b, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x75, 0x67, 0x12, 0x2d, 0x0a, 0x12, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, + 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x12, 0x38, 0x0a, 0x18, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, + 0x74, 0x74, 0x72, 0x70, 0x63, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x16, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x54, + 0x74, 0x72, 0x70, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x36, 0x0a, 0x17, 0x63, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x47, 0x72, 0x70, 0x63, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x64, 0x5f, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x79, + 0x12, 0x4a, 0x0a, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, + 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, + 0x52, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x37, 0x0a, 0x09, + 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x9e, 0x02, 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, + 0x72, 0x61, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1a, 0x0a, + 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x61, 0x70, + 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x0c, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x5a, 0x0a, + 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x3e, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, + 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, + 0x31, 0x2e, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, + 0x74, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, + 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x45, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, + 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, + 0x2f, 0x76, 0x31, 0x3b, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/runtime/boot/v1/bootstrap.proto b/api/runtime/boot/v1/bootstrap.proto index 530904ef370c5..9857e07e6a22a 100644 --- a/api/runtime/boot/v1/bootstrap.proto +++ b/api/runtime/boot/v1/bootstrap.proto @@ -55,19 +55,22 @@ message BootstrapParams { // Enable debug messages in logs. bool enable_debug = 3; + // containerd daemon version that is launching this shim. + string containerd_version = 4; + // Containerd's TTRPC API address (e.g., "unix:///run/containerd/containerd.sock.ttrpc") - string containerd_ttrpc_address = 4; + string containerd_ttrpc_address = 5; // Containerd's gRPC API address (e.g., "unix:///run/containerd/containerd.sock") - string containerd_grpc_address = 5; + string containerd_grpc_address = 6; // Path to containerd binary for event publishing - string containerd_binary = 8; + string containerd_binary = 7; // Extensible configuration sections for new features // Each section can contain arbitrary structured data identified by type URL // Examples: CRI config, NRI config, sandbox config, etc. - repeated Extension extensions = 9; + repeated Extension extensions = 8; } // Extension provides extensibility for new configuration types diff --git a/pkg/shim/util.go b/pkg/shim/util.go index 9ab39b548324f..9a7aae363226e 100644 --- a/pkg/shim/util.go +++ b/pkg/shim/util.go @@ -38,6 +38,7 @@ import ( "github.com/containerd/containerd/v2/pkg/namespaces" "github.com/containerd/containerd/v2/pkg/protobuf/proto" "github.com/containerd/containerd/v2/pkg/protobuf/types" + "github.com/containerd/containerd/v2/version" "github.com/containerd/errdefs" ) @@ -126,6 +127,7 @@ func Command(ctx context.Context, config *CommandConfig) (*exec.Cmd, error) { ID: config.ID, Namespace: ns, EnableDebug: config.Debug, + ContainerdVersion: version.Version, ContainerdGrpcAddress: config.GRPCAddress, ContainerdTtrpcAddress: config.TTRPCAddress, ContainerdBinary: self, diff --git a/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.pb.go b/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.pb.go index 28c4cad8b8aec..7848151affeda 100644 --- a/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.pb.go +++ b/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.pb.go @@ -70,16 +70,18 @@ type BootstrapParams struct { Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"` // Enable debug messages in logs. EnableDebug bool `protobuf:"varint,3,opt,name=enable_debug,json=enableDebug,proto3" json:"enable_debug,omitempty"` + // containerd daemon version that is launching this shim. + ContainerdVersion string `protobuf:"bytes,4,opt,name=containerd_version,json=containerdVersion,proto3" json:"containerd_version,omitempty"` // Containerd's TTRPC API address (e.g., "unix:///run/containerd/containerd.sock.ttrpc") - ContainerdTtrpcAddress string `protobuf:"bytes,4,opt,name=containerd_ttrpc_address,json=containerdTtrpcAddress,proto3" json:"containerd_ttrpc_address,omitempty"` + ContainerdTtrpcAddress string `protobuf:"bytes,5,opt,name=containerd_ttrpc_address,json=containerdTtrpcAddress,proto3" json:"containerd_ttrpc_address,omitempty"` // Containerd's gRPC API address (e.g., "unix:///run/containerd/containerd.sock") - ContainerdGrpcAddress string `protobuf:"bytes,5,opt,name=containerd_grpc_address,json=containerdGrpcAddress,proto3" json:"containerd_grpc_address,omitempty"` + ContainerdGrpcAddress string `protobuf:"bytes,6,opt,name=containerd_grpc_address,json=containerdGrpcAddress,proto3" json:"containerd_grpc_address,omitempty"` // Path to containerd binary for event publishing - ContainerdBinary string `protobuf:"bytes,8,opt,name=containerd_binary,json=containerdBinary,proto3" json:"containerd_binary,omitempty"` + ContainerdBinary string `protobuf:"bytes,7,opt,name=containerd_binary,json=containerdBinary,proto3" json:"containerd_binary,omitempty"` // Extensible configuration sections for new features // Each section can contain arbitrary structured data identified by type URL // Examples: CRI config, NRI config, sandbox config, etc. - Extensions []*Extension `protobuf:"bytes,9,rep,name=extensions,proto3" json:"extensions,omitempty"` + Extensions []*Extension `protobuf:"bytes,8,rep,name=extensions,proto3" json:"extensions,omitempty"` } func (x *BootstrapParams) Reset() { @@ -135,6 +137,13 @@ func (x *BootstrapParams) GetEnableDebug() bool { return false } +func (x *BootstrapParams) GetContainerdVersion() string { + if x != nil { + return x.ContainerdVersion + } + return "" +} + func (x *BootstrapParams) GetContainerdTtrpcAddress() string { if x != nil { return x.ContainerdTtrpcAddress @@ -312,55 +321,58 @@ var file_runtime_boot_v1_bootstrap_proto_rawDesc = []byte{ 0x6f, 0x12, 0x1f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xcd, 0x02, + 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xfc, 0x02, 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x64, 0x65, 0x62, 0x75, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x44, 0x65, 0x62, - 0x75, 0x67, 0x12, 0x38, 0x0a, 0x18, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, - 0x5f, 0x74, 0x74, 0x72, 0x70, 0x63, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x16, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, - 0x54, 0x74, 0x72, 0x70, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x36, 0x0a, 0x17, - 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, 0x67, 0x72, 0x70, 0x63, 0x5f, - 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x63, - 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x47, 0x72, 0x70, 0x63, 0x41, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, - 0x72, 0x64, 0x5f, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x10, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x42, 0x69, 0x6e, 0x61, 0x72, - 0x79, 0x12, 0x4a, 0x0a, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, - 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, - 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, - 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x52, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x37, 0x0a, - 0x09, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x9e, 0x02, 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x74, 0x73, - 0x74, 0x72, 0x61, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1a, - 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x61, - 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x0c, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x5a, - 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x3e, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, - 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, - 0x76, 0x31, 0x2e, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x52, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, - 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x45, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, - 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, - 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, - 0x70, 0x2f, 0x76, 0x31, 0x3b, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x75, 0x67, 0x12, 0x2d, 0x0a, 0x12, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, + 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x12, 0x38, 0x0a, 0x18, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, + 0x74, 0x74, 0x72, 0x70, 0x63, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x16, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x54, + 0x74, 0x72, 0x70, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x36, 0x0a, 0x17, 0x63, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x47, 0x72, 0x70, 0x63, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x64, 0x5f, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x79, + 0x12, 0x4a, 0x0a, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, + 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, + 0x52, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x37, 0x0a, 0x09, + 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x9e, 0x02, 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, + 0x72, 0x61, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1a, 0x0a, + 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x61, 0x70, + 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x0c, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x5a, 0x0a, + 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x3e, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, + 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, + 0x31, 0x2e, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, + 0x74, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, + 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x45, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, + 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, + 0x2f, 0x76, 0x31, 0x3b, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.proto b/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.proto index 530904ef370c5..9857e07e6a22a 100644 --- a/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.proto +++ b/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.proto @@ -55,19 +55,22 @@ message BootstrapParams { // Enable debug messages in logs. bool enable_debug = 3; + // containerd daemon version that is launching this shim. + string containerd_version = 4; + // Containerd's TTRPC API address (e.g., "unix:///run/containerd/containerd.sock.ttrpc") - string containerd_ttrpc_address = 4; + string containerd_ttrpc_address = 5; // Containerd's gRPC API address (e.g., "unix:///run/containerd/containerd.sock") - string containerd_grpc_address = 5; + string containerd_grpc_address = 6; // Path to containerd binary for event publishing - string containerd_binary = 8; + string containerd_binary = 7; // Extensible configuration sections for new features // Each section can contain arbitrary structured data identified by type URL // Examples: CRI config, NRI config, sandbox config, etc. - repeated Extension extensions = 9; + repeated Extension extensions = 8; } // Extension provides extensibility for new configuration types From d957b1bf53914443e28a3a7ab63824ea2e6c22ed Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Sat, 7 Feb 2026 13:10:32 -0800 Subject: [PATCH 13/28] Use log level instead of debug flag Signed-off-by: Maksym Pavlenko --- api/next.txtpb | 30 ++--- api/runtime/boot/v1/bootstrap.pb.go | 116 +++++++++--------- api/runtime/boot/v1/bootstrap.proto | 6 +- .../manager/manager_linux.go | 12 +- core/runtime/v2/binary.go | 16 +-- pkg/shim/compat.go | 8 +- pkg/shim/util.go | 10 +- .../api/runtime/boot/v1/bootstrap.pb.go | 116 +++++++++--------- .../api/runtime/boot/v1/bootstrap.proto | 6 +- 9 files changed, 160 insertions(+), 160 deletions(-) diff --git a/api/next.txtpb b/api/next.txtpb index fb05f87ae9206..c0b40e5953514 100644 --- a/api/next.txtpb +++ b/api/next.txtpb @@ -24933,11 +24933,11 @@ file: { message_type: { name: "BootstrapParams" field: { - name: "id" + name: "instance_id" number: 1 label: LABEL_OPTIONAL type: TYPE_STRING - json_name: "id" + json_name: "instanceId" } field: { name: "namespace" @@ -24947,11 +24947,11 @@ file: { json_name: "namespace" } field: { - name: "enable_debug" + name: "log_level" number: 3 label: LABEL_OPTIONAL - type: TYPE_BOOL - json_name: "enableDebug" + type: TYPE_STRING + json_name: "logLevel" } field: { name: "containerd_version" @@ -25128,7 +25128,7 @@ file: { path: 0 span: 49 span: 2 - span: 16 + span: 25 leading_comments: " Container/sandbox ID\n" } location: { @@ -25149,7 +25149,7 @@ file: { path: 1 span: 49 span: 9 - span: 11 + span: 20 } location: { path: 4 @@ -25158,8 +25158,8 @@ file: { path: 0 path: 3 span: 49 - span: 14 - span: 15 + span: 23 + span: 24 } location: { path: 4 @@ -25208,8 +25208,8 @@ file: { path: 2 span: 55 span: 2 - span: 24 - leading_comments: " Enable debug messages in logs.\n" + span: 23 + leading_comments: " Requested shim log level.\n" } location: { path: 4 @@ -25219,7 +25219,7 @@ file: { path: 5 span: 55 span: 2 - span: 6 + span: 8 } location: { path: 4 @@ -25228,8 +25228,8 @@ file: { path: 2 path: 1 span: 55 - span: 7 - span: 19 + span: 9 + span: 18 } location: { path: 4 @@ -25238,8 +25238,8 @@ file: { path: 2 path: 3 span: 55 + span: 21 span: 22 - span: 23 } location: { path: 4 diff --git a/api/runtime/boot/v1/bootstrap.pb.go b/api/runtime/boot/v1/bootstrap.pb.go index 7848151affeda..0bde5d32006c7 100644 --- a/api/runtime/boot/v1/bootstrap.pb.go +++ b/api/runtime/boot/v1/bootstrap.pb.go @@ -65,11 +65,11 @@ type BootstrapParams struct { unknownFields protoimpl.UnknownFields // Container/sandbox ID - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + InstanceID string `protobuf:"bytes,1,opt,name=instance_id,json=instanceId,proto3" json:"instance_id,omitempty"` // Namespace for the container Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"` - // Enable debug messages in logs. - EnableDebug bool `protobuf:"varint,3,opt,name=enable_debug,json=enableDebug,proto3" json:"enable_debug,omitempty"` + // Requested shim log level. + LogLevel string `protobuf:"bytes,3,opt,name=log_level,json=logLevel,proto3" json:"log_level,omitempty"` // containerd daemon version that is launching this shim. ContainerdVersion string `protobuf:"bytes,4,opt,name=containerd_version,json=containerdVersion,proto3" json:"containerd_version,omitempty"` // Containerd's TTRPC API address (e.g., "unix:///run/containerd/containerd.sock.ttrpc") @@ -116,9 +116,9 @@ func (*BootstrapParams) Descriptor() ([]byte, []int) { return file_runtime_boot_v1_bootstrap_proto_rawDescGZIP(), []int{0} } -func (x *BootstrapParams) GetID() string { +func (x *BootstrapParams) GetInstanceID() string { if x != nil { - return x.ID + return x.InstanceID } return "" } @@ -130,11 +130,11 @@ func (x *BootstrapParams) GetNamespace() string { return "" } -func (x *BootstrapParams) GetEnableDebug() bool { +func (x *BootstrapParams) GetLogLevel() string { if x != nil { - return x.EnableDebug + return x.LogLevel } - return false + return "" } func (x *BootstrapParams) GetContainerdVersion() string { @@ -321,58 +321,58 @@ var file_runtime_boot_v1_bootstrap_proto_rawDesc = []byte{ 0x6f, 0x12, 0x1f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xfc, 0x02, + 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x87, 0x03, 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, - 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, - 0x21, 0x0a, 0x0c, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x64, 0x65, 0x62, 0x75, 0x67, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x44, 0x65, 0x62, - 0x75, 0x67, 0x12, 0x2d, 0x0a, 0x12, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, - 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, - 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x12, 0x38, 0x0a, 0x18, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, - 0x74, 0x74, 0x72, 0x70, 0x63, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x16, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x54, - 0x74, 0x72, 0x70, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x36, 0x0a, 0x17, 0x63, - 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x61, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x47, 0x72, 0x70, 0x63, 0x41, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, - 0x64, 0x5f, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, - 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x79, - 0x12, 0x4a, 0x0a, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, - 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, - 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x52, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x37, 0x0a, 0x09, - 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x9e, 0x02, 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, - 0x72, 0x61, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1a, 0x0a, - 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x61, 0x70, - 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, - 0x0c, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x5a, 0x0a, - 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x3e, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, + 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, + 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, + 0x12, 0x1b, 0x0a, 0x09, 0x6c, 0x6f, 0x67, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x6f, 0x67, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x2d, 0x0a, + 0x12, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x64, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x38, 0x0a, 0x18, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, 0x74, 0x74, 0x72, 0x70, 0x63, + 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x16, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x54, 0x74, 0x72, 0x70, 0x63, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x36, 0x0a, 0x17, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, + 0x6e, 0x65, 0x72, 0x64, 0x5f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, + 0x65, 0x72, 0x64, 0x47, 0x72, 0x70, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2b, + 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, 0x62, 0x69, 0x6e, + 0x61, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x64, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x12, 0x4a, 0x0a, 0x0a, 0x65, + 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x2a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, - 0x31, 0x2e, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, - 0x74, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, - 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x45, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, - 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, - 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, - 0x2f, 0x76, 0x31, 0x3b, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x31, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x65, 0x78, 0x74, + 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x37, 0x0a, 0x09, 0x45, 0x78, 0x74, 0x65, 0x6e, + 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x22, 0x9e, 0x02, 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x52, 0x65, + 0x73, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x18, + 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, + 0x74, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x61, 0x70, 0x61, + 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x5a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3e, 0x2e, 0x63, 0x6f, 0x6e, + 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, + 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x6f, 0x6f, + 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x2e, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, + 0x01, 0x42, 0x45, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, + 0x65, 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2f, 0x76, 0x31, 0x3b, 0x62, + 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/runtime/boot/v1/bootstrap.proto b/api/runtime/boot/v1/bootstrap.proto index 9857e07e6a22a..1cb27129f16cc 100644 --- a/api/runtime/boot/v1/bootstrap.proto +++ b/api/runtime/boot/v1/bootstrap.proto @@ -47,13 +47,13 @@ option go_package = "github.com/containerd/containerd/api/runtime/bootstrap/v1;b // BootstrapParams contains all configuration passed from containerd to shim at startup. message BootstrapParams { // Container/sandbox ID - string id = 1; + string instance_id = 1; // Namespace for the container string namespace = 2; - // Enable debug messages in logs. - bool enable_debug = 3; + // Requested shim log level. + string log_level = 3; // containerd daemon version that is launching this shim. string containerd_version = 4; diff --git a/cmd/containerd-shim-runc-v2/manager/manager_linux.go b/cmd/containerd-shim-runc-v2/manager/manager_linux.go index 0047a41ed8709..4382915ebeb4b 100644 --- a/cmd/containerd-shim-runc-v2/manager/manager_linux.go +++ b/cmd/containerd-shim-runc-v2/manager/manager_linux.go @@ -186,9 +186,15 @@ func (manager) Start(ctx context.Context, opts *shim.BootstrapParams) (_ *shim.B params.Version = 3 params.Protocol = "ttrpc" - id := opts.GetID() + id := opts.GetInstanceID() - cmd, err := newCommand(ctx, id, opts.GetContainerdGrpcAddress(), opts.GetContainerdTtrpcAddress(), opts.GetEnableDebug()) + debugLog := false + switch log.GetLevel() { + case log.DebugLevel, log.TraceLevel: + debugLog = true + } + + cmd, err := newCommand(ctx, id, opts.GetContainerdGrpcAddress(), opts.GetContainerdTtrpcAddress(), debugLog) if err != nil { return nil, err } @@ -225,7 +231,7 @@ func (manager) Start(ctx context.Context, opts *shim.BootstrapParams) (_ *shim.B sockets = append(sockets, s) cmd.ExtraFiles = append(cmd.ExtraFiles, s.f) - if opts.GetEnableDebug() { + if debugLog { s, err = newShimSocket(ctx, opts.GetContainerdGrpcAddress(), grouping, true) if err != nil { return nil, err diff --git a/core/runtime/v2/binary.go b/core/runtime/v2/binary.go index 2972beea0e76e..ed5a4e41f74cd 100644 --- a/core/runtime/v2/binary.go +++ b/core/runtime/v2/binary.go @@ -61,12 +61,6 @@ type binary struct { } func (b *binary) Start(ctx context.Context, opts *types.Any, onClose func()) (_ *shim, err error) { - debug := false - switch log.GetLevel() { - case log.DebugLevel, log.TraceLevel: - debug = true - } - cmd, err := client.Command( ctx, &client.CommandConfig{ @@ -77,7 +71,7 @@ func (b *binary) Start(ctx context.Context, opts *types.Any, onClose func()) (_ WorkDir: b.bundle.Path, Opts: opts, Env: b.env, - Debug: debug, + LogLevel: log.GetLevel(), Action: "start", }) if err != nil { @@ -167,12 +161,6 @@ func (b *binary) Delete(ctx context.Context) (*runtime.Exit, error) { bundlePath = b.bundle.Path } - debug := false - switch log.GetLevel() { - case log.DebugLevel, log.TraceLevel: - debug = true - } - cmd, err := client.Command(ctx, &client.CommandConfig{ ID: b.bundle.ID, @@ -182,7 +170,7 @@ func (b *binary) Delete(ctx context.Context) (*runtime.Exit, error) { TTRPCAddress: b.containerdTTRPCAddress, WorkDir: bundlePath, Opts: nil, - Debug: debug, + LogLevel: log.GetLevel(), Action: "delete", }) diff --git a/pkg/shim/compat.go b/pkg/shim/compat.go index 7622d553cc4e2..fa57c4839f2cb 100644 --- a/pkg/shim/compat.go +++ b/pkg/shim/compat.go @@ -27,15 +27,19 @@ import ( "os" "github.com/containerd/containerd/api/types/runc/options" + "github.com/containerd/log" ) func readBootstrapParamsFromDeprecatedFields(input []byte, params *BootstrapParams) error { - params.ID = id + params.InstanceID = id params.Namespace = namespaceFlag params.ContainerdTtrpcAddress = os.Getenv(ttrpcAddressEnv) params.ContainerdGrpcAddress = os.Getenv(grpcAddressEnv) params.ContainerdBinary = containerdBinaryFlag - params.EnableDebug = debugFlag + + if debugFlag { + params.LogLevel = log.DebugLevel.String() + } // Task options diff --git a/pkg/shim/util.go b/pkg/shim/util.go index 9a7aae363226e..6cf2f5b959f4b 100644 --- a/pkg/shim/util.go +++ b/pkg/shim/util.go @@ -40,6 +40,7 @@ import ( "github.com/containerd/containerd/v2/pkg/protobuf/types" "github.com/containerd/containerd/v2/version" "github.com/containerd/errdefs" + "github.com/containerd/log" ) type CommandConfig struct { @@ -52,7 +53,7 @@ type CommandConfig struct { Args []string Opts *types.Any Env []string - Debug bool + LogLevel log.Level Action string // Either "start" or "delete" } @@ -81,7 +82,8 @@ func Command(ctx context.Context, config *CommandConfig) (*exec.Cmd, error) { if config.BundlePath != "" { args = append(args, "-bundle", config.BundlePath) } - if config.Debug { + switch config.LogLevel { + case log.DebugLevel, log.TraceLevel: args = append(args, "-debug") } if config.Action == "" { @@ -124,9 +126,9 @@ func Command(ctx context.Context, config *CommandConfig) (*exec.Cmd, error) { } else if config.Action == "start" { // Use the new Bootstrap protocol for all newer shims. params := bootapi.BootstrapParams{ - ID: config.ID, + InstanceID: config.ID, Namespace: ns, - EnableDebug: config.Debug, + LogLevel: config.LogLevel.String(), ContainerdVersion: version.Version, ContainerdGrpcAddress: config.GRPCAddress, ContainerdTtrpcAddress: config.TTRPCAddress, diff --git a/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.pb.go b/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.pb.go index 7848151affeda..0bde5d32006c7 100644 --- a/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.pb.go +++ b/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.pb.go @@ -65,11 +65,11 @@ type BootstrapParams struct { unknownFields protoimpl.UnknownFields // Container/sandbox ID - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + InstanceID string `protobuf:"bytes,1,opt,name=instance_id,json=instanceId,proto3" json:"instance_id,omitempty"` // Namespace for the container Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"` - // Enable debug messages in logs. - EnableDebug bool `protobuf:"varint,3,opt,name=enable_debug,json=enableDebug,proto3" json:"enable_debug,omitempty"` + // Requested shim log level. + LogLevel string `protobuf:"bytes,3,opt,name=log_level,json=logLevel,proto3" json:"log_level,omitempty"` // containerd daemon version that is launching this shim. ContainerdVersion string `protobuf:"bytes,4,opt,name=containerd_version,json=containerdVersion,proto3" json:"containerd_version,omitempty"` // Containerd's TTRPC API address (e.g., "unix:///run/containerd/containerd.sock.ttrpc") @@ -116,9 +116,9 @@ func (*BootstrapParams) Descriptor() ([]byte, []int) { return file_runtime_boot_v1_bootstrap_proto_rawDescGZIP(), []int{0} } -func (x *BootstrapParams) GetID() string { +func (x *BootstrapParams) GetInstanceID() string { if x != nil { - return x.ID + return x.InstanceID } return "" } @@ -130,11 +130,11 @@ func (x *BootstrapParams) GetNamespace() string { return "" } -func (x *BootstrapParams) GetEnableDebug() bool { +func (x *BootstrapParams) GetLogLevel() string { if x != nil { - return x.EnableDebug + return x.LogLevel } - return false + return "" } func (x *BootstrapParams) GetContainerdVersion() string { @@ -321,58 +321,58 @@ var file_runtime_boot_v1_bootstrap_proto_rawDesc = []byte{ 0x6f, 0x12, 0x1f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xfc, 0x02, + 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x87, 0x03, 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, - 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, - 0x21, 0x0a, 0x0c, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x64, 0x65, 0x62, 0x75, 0x67, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x44, 0x65, 0x62, - 0x75, 0x67, 0x12, 0x2d, 0x0a, 0x12, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, - 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, - 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x12, 0x38, 0x0a, 0x18, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, - 0x74, 0x74, 0x72, 0x70, 0x63, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x16, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x54, - 0x74, 0x72, 0x70, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x36, 0x0a, 0x17, 0x63, - 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x61, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x47, 0x72, 0x70, 0x63, 0x41, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, - 0x64, 0x5f, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, - 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x79, - 0x12, 0x4a, 0x0a, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, - 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, - 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x52, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x37, 0x0a, 0x09, - 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x9e, 0x02, 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, - 0x72, 0x61, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1a, 0x0a, - 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x61, 0x70, - 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, - 0x0c, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x5a, 0x0a, - 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x3e, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, + 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, + 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, + 0x12, 0x1b, 0x0a, 0x09, 0x6c, 0x6f, 0x67, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x6f, 0x67, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x2d, 0x0a, + 0x12, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x64, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x38, 0x0a, 0x18, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, 0x74, 0x74, 0x72, 0x70, 0x63, + 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x16, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x54, 0x74, 0x72, 0x70, 0x63, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x36, 0x0a, 0x17, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, + 0x6e, 0x65, 0x72, 0x64, 0x5f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, + 0x65, 0x72, 0x64, 0x47, 0x72, 0x70, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2b, + 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, 0x62, 0x69, 0x6e, + 0x61, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x64, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x12, 0x4a, 0x0a, 0x0a, 0x65, + 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x2a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, - 0x31, 0x2e, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, - 0x74, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, - 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x45, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, - 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, - 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, - 0x2f, 0x76, 0x31, 0x3b, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x31, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x65, 0x78, 0x74, + 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x37, 0x0a, 0x09, 0x45, 0x78, 0x74, 0x65, 0x6e, + 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x22, 0x9e, 0x02, 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x52, 0x65, + 0x73, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x18, + 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, + 0x74, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x61, 0x70, 0x61, + 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x5a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3e, 0x2e, 0x63, 0x6f, 0x6e, + 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, + 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x6f, 0x6f, + 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x2e, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, + 0x01, 0x42, 0x45, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, + 0x65, 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2f, 0x76, 0x31, 0x3b, 0x62, + 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.proto b/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.proto index 9857e07e6a22a..1cb27129f16cc 100644 --- a/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.proto +++ b/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.proto @@ -47,13 +47,13 @@ option go_package = "github.com/containerd/containerd/api/runtime/bootstrap/v1;b // BootstrapParams contains all configuration passed from containerd to shim at startup. message BootstrapParams { // Container/sandbox ID - string id = 1; + string instance_id = 1; // Namespace for the container string namespace = 2; - // Enable debug messages in logs. - bool enable_debug = 3; + // Requested shim log level. + string log_level = 3; // containerd daemon version that is launching this shim. string containerd_version = 4; From 58022a748ad7e92f23ef444031742ae700823c88 Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Fri, 13 Mar 2026 10:59:20 -0700 Subject: [PATCH 14/28] Parse log level when starting shim instance Signed-off-by: Maksym Pavlenko --- cmd/containerd-shim-runc-v2/manager/manager_linux.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cmd/containerd-shim-runc-v2/manager/manager_linux.go b/cmd/containerd-shim-runc-v2/manager/manager_linux.go index 4382915ebeb4b..b33a2a191d7ab 100644 --- a/cmd/containerd-shim-runc-v2/manager/manager_linux.go +++ b/cmd/containerd-shim-runc-v2/manager/manager_linux.go @@ -48,6 +48,7 @@ import ( "github.com/containerd/log" "github.com/containerd/typeurl/v2" "github.com/opencontainers/runtime-spec/specs-go/features" + "github.com/sirupsen/logrus" "golang.org/x/sys/unix" ) @@ -188,11 +189,11 @@ func (manager) Start(ctx context.Context, opts *shim.BootstrapParams) (_ *shim.B id := opts.GetInstanceID() - debugLog := false - switch log.GetLevel() { - case log.DebugLevel, log.TraceLevel: - debugLog = true + lvl, err := logrus.ParseLevel(opts.LogLevel) + if err != nil { + return nil, err } + debugLog := lvl == log.DebugLevel || lvl == log.TraceLevel cmd, err := newCommand(ctx, id, opts.GetContainerdGrpcAddress(), opts.GetContainerdTtrpcAddress(), debugLog) if err != nil { From 0f55bdd49c41ba2a43d6595bdd827b6ba4ed4987 Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Fri, 13 Mar 2026 11:17:46 -0700 Subject: [PATCH 15/28] Fix extensions API and update tests Signed-off-by: Maksym Pavlenko --- api/runtime/boot/v1/helpers.go | 9 ++--- api/runtime/boot/v1/helpers_test.go | 26 +++++++------ .../manager/manager_linux.go | 38 +++++++++---------- .../containerd/api/runtime/boot/v1/helpers.go | 9 ++--- 4 files changed, 42 insertions(+), 40 deletions(-) diff --git a/api/runtime/boot/v1/helpers.go b/api/runtime/boot/v1/helpers.go index 92d0d6246d52e..e8ce0350be159 100644 --- a/api/runtime/boot/v1/helpers.go +++ b/api/runtime/boot/v1/helpers.go @@ -44,18 +44,17 @@ func (p *BootstrapParams) AddExtension(msg proto.Message) error { } // FindExtension finds an extension matching the type of dst and unmarshals it. -// Returns true if found, false if not found. -func (p *BootstrapParams) FindExtension(dst proto.Message) error { +func (p *BootstrapParams) FindExtension(dst proto.Message) (bool, error) { name := dst.ProtoReflect().Descriptor().FullName() for _, ext := range p.Extensions { if ext.GetValue().MessageIs(dst) { if err := ext.GetValue().UnmarshalTo(dst); err != nil { - return fmt.Errorf("failed to unmarshal extension %q: %w", name, err) + return false, fmt.Errorf("failed to unmarshal extension %q: %w", name, err) } - return nil + return true, nil } } - return nil + return false, nil } diff --git a/api/runtime/boot/v1/helpers_test.go b/api/runtime/boot/v1/helpers_test.go index ae7cec5c387cb..00bb0d9623dd4 100644 --- a/api/runtime/boot/v1/helpers_test.go +++ b/api/runtime/boot/v1/helpers_test.go @@ -21,43 +21,47 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + options "github.com/containerd/containerd/api/types/runc/options" "google.golang.org/protobuf/types/known/anypb" ) func TestExtensions(t *testing.T) { params := &BootstrapParams{} - err := params.AddExtension(&RuncV2Extensions{SpecAnnotations: map[string]string{"test": "value"}}) + err := params.AddExtension(&options.Options{ShimCgroup: "test-cgroup"}) require.NoError(t, err) - got := &RuncV2Extensions{} - err = params.FindExtension(got) + got := &options.Options{} + found, err := params.FindExtension(got) require.NoError(t, err) - assert.Equal(t, "value", got.SpecAnnotations["test"]) + assert.True(t, found) + assert.Equal(t, "test-cgroup", got.ShimCgroup) } func TestExtensionNotFound(t *testing.T) { params := &BootstrapParams{} - got := &RuncV2Extensions{} - err := params.FindExtension(got) + got := &options.Options{} + found, err := params.FindExtension(got) require.NoError(t, err) + assert.False(t, found) } func TestAddExtensionWithAny(t *testing.T) { params := &BootstrapParams{} - ext := &RuncV2Extensions{SpecAnnotations: map[string]string{"test": "annotation"}} + ext := &options.Options{ShimCgroup: "test-cgroup"} anyVal, err := anypb.New(ext) require.NoError(t, err) err = params.AddExtension(anyVal) require.NoError(t, err) - got := &RuncV2Extensions{} - err = params.FindExtension(got) + got := &options.Options{} + found, err := params.FindExtension(got) require.NoError(t, err) - assert.Equal(t, "annotation", got.SpecAnnotations["test"]) + assert.True(t, found) + assert.Equal(t, "test-cgroup", got.ShimCgroup) - assert.Contains(t, params.Extensions[0].Value.TypeUrl, "RuncV2Extensions") + assert.Contains(t, params.Extensions[0].Value.TypeUrl, "Options") } diff --git a/cmd/containerd-shim-runc-v2/manager/manager_linux.go b/cmd/containerd-shim-runc-v2/manager/manager_linux.go index b33a2a191d7ab..d156198d2e47d 100644 --- a/cmd/containerd-shim-runc-v2/manager/manager_linux.go +++ b/cmd/containerd-shim-runc-v2/manager/manager_linux.go @@ -263,26 +263,26 @@ func (manager) Start(ctx context.Context, opts *shim.BootstrapParams) (_ *shim.B go cmd.Wait() var runcOpts options.Options - if err := opts.FindExtension(&runcOpts); err != nil { + if found, err := opts.FindExtension(&runcOpts); err != nil { return nil, fmt.Errorf("failed to fetch runc options: %w", err) - } - - if shimCgroup := runcOpts.GetShimCgroup(); shimCgroup != "" { - if cgroups.Mode() == cgroups.Unified { - cg, err := cgroupsv2.Load(shimCgroup) - if err != nil { - return nil, fmt.Errorf("failed to load cgroup %s: %w", shimCgroup, err) - } - if err := cg.AddProc(uint64(cmd.Process.Pid)); err != nil { - return nil, fmt.Errorf("failed to join cgroup %s: %w", shimCgroup, err) - } - } else { - cg, err := cgroup1.Load(cgroup1.StaticPath(shimCgroup)) - if err != nil { - return nil, fmt.Errorf("failed to load cgroup %s: %w", shimCgroup, err) - } - if err := cg.AddProc(uint64(cmd.Process.Pid)); err != nil { - return nil, fmt.Errorf("failed to join cgroup %s: %w", shimCgroup, err) + } else if found { + if shimCgroup := runcOpts.GetShimCgroup(); shimCgroup != "" { + if cgroups.Mode() == cgroups.Unified { + cg, err := cgroupsv2.Load(shimCgroup) + if err != nil { + return nil, fmt.Errorf("failed to load cgroup %s: %w", shimCgroup, err) + } + if err := cg.AddProc(uint64(cmd.Process.Pid)); err != nil { + return nil, fmt.Errorf("failed to join cgroup %s: %w", shimCgroup, err) + } + } else { + cg, err := cgroup1.Load(cgroup1.StaticPath(shimCgroup)) + if err != nil { + return nil, fmt.Errorf("failed to load cgroup %s: %w", shimCgroup, err) + } + if err := cg.AddProc(uint64(cmd.Process.Pid)); err != nil { + return nil, fmt.Errorf("failed to join cgroup %s: %w", shimCgroup, err) + } } } } diff --git a/vendor/github.com/containerd/containerd/api/runtime/boot/v1/helpers.go b/vendor/github.com/containerd/containerd/api/runtime/boot/v1/helpers.go index 92d0d6246d52e..e8ce0350be159 100644 --- a/vendor/github.com/containerd/containerd/api/runtime/boot/v1/helpers.go +++ b/vendor/github.com/containerd/containerd/api/runtime/boot/v1/helpers.go @@ -44,18 +44,17 @@ func (p *BootstrapParams) AddExtension(msg proto.Message) error { } // FindExtension finds an extension matching the type of dst and unmarshals it. -// Returns true if found, false if not found. -func (p *BootstrapParams) FindExtension(dst proto.Message) error { +func (p *BootstrapParams) FindExtension(dst proto.Message) (bool, error) { name := dst.ProtoReflect().Descriptor().FullName() for _, ext := range p.Extensions { if ext.GetValue().MessageIs(dst) { if err := ext.GetValue().UnmarshalTo(dst); err != nil { - return fmt.Errorf("failed to unmarshal extension %q: %w", name, err) + return false, fmt.Errorf("failed to unmarshal extension %q: %w", name, err) } - return nil + return true, nil } } - return nil + return false, nil } From 2005e01f068b656b2b3aecc4ed7bd0bcf59b6fe1 Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Fri, 13 Mar 2026 11:18:01 -0700 Subject: [PATCH 16/28] Run tests from api Signed-off-by: Maksym Pavlenko --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 4d5e2f448f2cc..0e5054fed4e32 100644 --- a/Makefile +++ b/Makefile @@ -206,6 +206,7 @@ build: ## build the go packages test: ## run tests, except integration tests and tests that require root @echo "$(WHALE) $@" + @$(GOTEST) -C api ${TESTFLAGS} ${API_PACKAGES} @$(GOTEST) ${TESTFLAGS} ${PACKAGES} root-test: ## run tests, except integration tests From 281fb85a9c1bc9d2dd942f9ea375a33914cf9cc7 Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Fri, 13 Mar 2026 11:30:44 -0700 Subject: [PATCH 17/28] Fix Makefile Signed-off-by: Maksym Pavlenko --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0e5054fed4e32..72245493e17f2 100644 --- a/Makefile +++ b/Makefile @@ -206,7 +206,7 @@ build: ## build the go packages test: ## run tests, except integration tests and tests that require root @echo "$(WHALE) $@" - @$(GOTEST) -C api ${TESTFLAGS} ${API_PACKAGES} + @$(GO) -C api test ${TESTFLAGS} ${API_PACKAGES} @$(GOTEST) ${TESTFLAGS} ${PACKAGES} root-test: ## run tests, except integration tests From eea1fa6516e0d4e27b0227cb24de7902aa09f22c Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Wed, 18 Mar 2026 16:43:59 -0700 Subject: [PATCH 18/28] Do not fail when failed to parse log level Signed-off-by: Maksym Pavlenko --- cmd/containerd-shim-runc-v2/manager/manager_linux.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/cmd/containerd-shim-runc-v2/manager/manager_linux.go b/cmd/containerd-shim-runc-v2/manager/manager_linux.go index d156198d2e47d..0270b9499a34c 100644 --- a/cmd/containerd-shim-runc-v2/manager/manager_linux.go +++ b/cmd/containerd-shim-runc-v2/manager/manager_linux.go @@ -189,10 +189,7 @@ func (manager) Start(ctx context.Context, opts *shim.BootstrapParams) (_ *shim.B id := opts.GetInstanceID() - lvl, err := logrus.ParseLevel(opts.LogLevel) - if err != nil { - return nil, err - } + lvl, _ := logrus.ParseLevel(opts.LogLevel) debugLog := lvl == log.DebugLevel || lvl == log.TraceLevel cmd, err := newCommand(ctx, id, opts.GetContainerdGrpcAddress(), opts.GetContainerdTtrpcAddress(), debugLog) From 1852a4758ea70e12ada6bc98c45258a001c9f6bc Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Wed, 18 Mar 2026 16:47:21 -0700 Subject: [PATCH 19/28] Remove testify dependency from api Signed-off-by: Maksym Pavlenko --- api/go.mod | 3 -- api/go.sum | 5 --- api/runtime/boot/v1/helpers_test.go | 53 +++++++++++++++++++++-------- 3 files changed, 38 insertions(+), 23 deletions(-) diff --git a/api/go.mod b/api/go.mod index ea28cfa773e29..8f975f3e3c34d 100644 --- a/api/go.mod +++ b/api/go.mod @@ -6,7 +6,6 @@ require ( github.com/containerd/ttrpc v1.2.5 github.com/containerd/typeurl/v2 v2.1.1 github.com/opencontainers/image-spec v1.1.1 - github.com/stretchr/testify v1.8.2 google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 google.golang.org/grpc v1.79.3 google.golang.org/protobuf v1.36.10 @@ -14,10 +13,8 @@ require ( require ( github.com/containerd/log v0.1.0 // indirect - github.com/davecgh/go-spew v1.1.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect github.com/sirupsen/logrus v1.9.3 // indirect golang.org/x/net v0.48.0 // indirect golang.org/x/sys v0.39.0 // indirect diff --git a/api/go.sum b/api/go.sum index 003a6f31bb1a2..12cfc45caba1a 100644 --- a/api/go.sum +++ b/api/go.sum @@ -36,11 +36,7 @@ github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1 github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -99,7 +95,6 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE= google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/api/runtime/boot/v1/helpers_test.go b/api/runtime/boot/v1/helpers_test.go index 00bb0d9623dd4..432bf9f71e7eb 100644 --- a/api/runtime/boot/v1/helpers_test.go +++ b/api/runtime/boot/v1/helpers_test.go @@ -17,10 +17,9 @@ package bootstrap import ( + "strings" "testing" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" options "github.com/containerd/containerd/api/types/runc/options" "google.golang.org/protobuf/types/known/anypb" ) @@ -29,13 +28,21 @@ func TestExtensions(t *testing.T) { params := &BootstrapParams{} err := params.AddExtension(&options.Options{ShimCgroup: "test-cgroup"}) - require.NoError(t, err) + if err != nil { + t.Fatalf("AddExtension: %v", err) + } got := &options.Options{} found, err := params.FindExtension(got) - require.NoError(t, err) - assert.True(t, found) - assert.Equal(t, "test-cgroup", got.ShimCgroup) + if err != nil { + t.Fatalf("FindExtension: %v", err) + } + if !found { + t.Fatal("expected extension to be found") + } + if got.ShimCgroup != "test-cgroup" { + t.Fatalf("expected ShimCgroup %q, got %q", "test-cgroup", got.ShimCgroup) + } } func TestExtensionNotFound(t *testing.T) { @@ -43,8 +50,12 @@ func TestExtensionNotFound(t *testing.T) { got := &options.Options{} found, err := params.FindExtension(got) - require.NoError(t, err) - assert.False(t, found) + if err != nil { + t.Fatalf("FindExtension: %v", err) + } + if found { + t.Fatal("expected extension to not be found") + } } func TestAddExtensionWithAny(t *testing.T) { @@ -52,16 +63,28 @@ func TestAddExtensionWithAny(t *testing.T) { ext := &options.Options{ShimCgroup: "test-cgroup"} anyVal, err := anypb.New(ext) - require.NoError(t, err) + if err != nil { + t.Fatalf("anypb.New: %v", err) + } err = params.AddExtension(anyVal) - require.NoError(t, err) + if err != nil { + t.Fatalf("AddExtension: %v", err) + } got := &options.Options{} found, err := params.FindExtension(got) - require.NoError(t, err) - assert.True(t, found) - assert.Equal(t, "test-cgroup", got.ShimCgroup) - - assert.Contains(t, params.Extensions[0].Value.TypeUrl, "Options") + if err != nil { + t.Fatalf("FindExtension: %v", err) + } + if !found { + t.Fatal("expected extension to be found") + } + if got.ShimCgroup != "test-cgroup" { + t.Fatalf("expected ShimCgroup %q, got %q", "test-cgroup", got.ShimCgroup) + } + + if !strings.Contains(params.Extensions[0].Value.TypeUrl, "Options") { + t.Fatalf("expected TypeUrl to contain %q, got %q", "Options", params.Extensions[0].Value.TypeUrl) + } } From 3fbdb132bf4fb2f59995b9fc632c0ad507ff98f6 Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Wed, 18 Mar 2026 17:22:52 -0700 Subject: [PATCH 20/28] Fix module path Signed-off-by: Maksym Pavlenko --- api/next.txtpb | 2 +- .../{boot => bootstrap}/v1/bootstrap.pb.go | 185 +++++++++--------- .../{boot => bootstrap}/v1/bootstrap.proto | 0 api/runtime/{boot => bootstrap}/v1/doc.go | 0 api/runtime/{boot => bootstrap}/v1/helpers.go | 0 .../{boot => bootstrap}/v1/helpers_test.go | 0 pkg/shim/shim.go | 2 +- pkg/shim/util.go | 2 +- .../{boot => bootstrap}/v1/bootstrap.pb.go | 185 +++++++++--------- .../{boot => bootstrap}/v1/bootstrap.proto | 0 .../api/runtime/{boot => bootstrap}/v1/doc.go | 0 .../runtime/{boot => bootstrap}/v1/helpers.go | 0 vendor/modules.txt | 3 +- 13 files changed, 190 insertions(+), 189 deletions(-) rename api/runtime/{boot => bootstrap}/v1/bootstrap.pb.go (59%) rename api/runtime/{boot => bootstrap}/v1/bootstrap.proto (100%) rename api/runtime/{boot => bootstrap}/v1/doc.go (100%) rename api/runtime/{boot => bootstrap}/v1/helpers.go (100%) rename api/runtime/{boot => bootstrap}/v1/helpers_test.go (100%) rename vendor/github.com/containerd/containerd/api/runtime/{boot => bootstrap}/v1/bootstrap.pb.go (59%) rename vendor/github.com/containerd/containerd/api/runtime/{boot => bootstrap}/v1/bootstrap.proto (100%) rename vendor/github.com/containerd/containerd/api/runtime/{boot => bootstrap}/v1/doc.go (100%) rename vendor/github.com/containerd/containerd/api/runtime/{boot => bootstrap}/v1/helpers.go (100%) diff --git a/api/next.txtpb b/api/next.txtpb index c0b40e5953514..b9a193c318081 100644 --- a/api/next.txtpb +++ b/api/next.txtpb @@ -24927,7 +24927,7 @@ file: { } } file: { - name: "runtime/boot/v1/bootstrap.proto" + name: "runtime/bootstrap/v1/bootstrap.proto" package: "containerd.runtime.bootstrap.v1" dependency: "google/protobuf/any.proto" message_type: { diff --git a/api/runtime/boot/v1/bootstrap.pb.go b/api/runtime/bootstrap/v1/bootstrap.pb.go similarity index 59% rename from api/runtime/boot/v1/bootstrap.pb.go rename to api/runtime/bootstrap/v1/bootstrap.pb.go index 0bde5d32006c7..476f026ccdf11 100644 --- a/api/runtime/boot/v1/bootstrap.pb.go +++ b/api/runtime/bootstrap/v1/bootstrap.pb.go @@ -39,7 +39,7 @@ // versions: // protoc-gen-go v1.28.1 // protoc (unknown) -// source: runtime/boot/v1/bootstrap.proto +// source: runtime/bootstrap/v1/bootstrap.proto package bootstrap @@ -87,7 +87,7 @@ type BootstrapParams struct { func (x *BootstrapParams) Reset() { *x = BootstrapParams{} if protoimpl.UnsafeEnabled { - mi := &file_runtime_boot_v1_bootstrap_proto_msgTypes[0] + mi := &file_runtime_bootstrap_v1_bootstrap_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -100,7 +100,7 @@ func (x *BootstrapParams) String() string { func (*BootstrapParams) ProtoMessage() {} func (x *BootstrapParams) ProtoReflect() protoreflect.Message { - mi := &file_runtime_boot_v1_bootstrap_proto_msgTypes[0] + mi := &file_runtime_bootstrap_v1_bootstrap_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -113,7 +113,7 @@ func (x *BootstrapParams) ProtoReflect() protoreflect.Message { // Deprecated: Use BootstrapParams.ProtoReflect.Descriptor instead. func (*BootstrapParams) Descriptor() ([]byte, []int) { - return file_runtime_boot_v1_bootstrap_proto_rawDescGZIP(), []int{0} + return file_runtime_bootstrap_v1_bootstrap_proto_rawDescGZIP(), []int{0} } func (x *BootstrapParams) GetInstanceID() string { @@ -190,7 +190,7 @@ type Extension struct { func (x *Extension) Reset() { *x = Extension{} if protoimpl.UnsafeEnabled { - mi := &file_runtime_boot_v1_bootstrap_proto_msgTypes[1] + mi := &file_runtime_bootstrap_v1_bootstrap_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -203,7 +203,7 @@ func (x *Extension) String() string { func (*Extension) ProtoMessage() {} func (x *Extension) ProtoReflect() protoreflect.Message { - mi := &file_runtime_boot_v1_bootstrap_proto_msgTypes[1] + mi := &file_runtime_bootstrap_v1_bootstrap_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -216,7 +216,7 @@ func (x *Extension) ProtoReflect() protoreflect.Message { // Deprecated: Use Extension.ProtoReflect.Descriptor instead. func (*Extension) Descriptor() ([]byte, []int) { - return file_runtime_boot_v1_bootstrap_proto_rawDescGZIP(), []int{1} + return file_runtime_bootstrap_v1_bootstrap_proto_rawDescGZIP(), []int{1} } func (x *Extension) GetValue() *anypb.Any { @@ -249,7 +249,7 @@ type BootstrapResult struct { func (x *BootstrapResult) Reset() { *x = BootstrapResult{} if protoimpl.UnsafeEnabled { - mi := &file_runtime_boot_v1_bootstrap_proto_msgTypes[2] + mi := &file_runtime_bootstrap_v1_bootstrap_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -262,7 +262,7 @@ func (x *BootstrapResult) String() string { func (*BootstrapResult) ProtoMessage() {} func (x *BootstrapResult) ProtoReflect() protoreflect.Message { - mi := &file_runtime_boot_v1_bootstrap_proto_msgTypes[2] + mi := &file_runtime_bootstrap_v1_bootstrap_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -275,7 +275,7 @@ func (x *BootstrapResult) ProtoReflect() protoreflect.Message { // Deprecated: Use BootstrapResult.ProtoReflect.Descriptor instead. func (*BootstrapResult) Descriptor() ([]byte, []int) { - return file_runtime_boot_v1_bootstrap_proto_rawDescGZIP(), []int{2} + return file_runtime_bootstrap_v1_bootstrap_proto_rawDescGZIP(), []int{2} } func (x *BootstrapResult) GetVersion() int32 { @@ -313,89 +313,90 @@ func (x *BootstrapResult) GetMetadata() map[string]string { return nil } -var File_runtime_boot_v1_bootstrap_proto protoreflect.FileDescriptor - -var file_runtime_boot_v1_bootstrap_proto_rawDesc = []byte{ - 0x0a, 0x1f, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x2f, 0x76, - 0x31, 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x1f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, - 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, - 0x76, 0x31, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x87, 0x03, - 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, - 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, - 0x12, 0x1b, 0x0a, 0x09, 0x6c, 0x6f, 0x67, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x6f, 0x67, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x2d, 0x0a, - 0x12, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, 0x76, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x64, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x38, 0x0a, 0x18, - 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, 0x74, 0x74, 0x72, 0x70, 0x63, - 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x16, - 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x54, 0x74, 0x72, 0x70, 0x63, 0x41, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x36, 0x0a, 0x17, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, - 0x6e, 0x65, 0x72, 0x64, 0x5f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, - 0x65, 0x72, 0x64, 0x47, 0x72, 0x70, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2b, - 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, 0x62, 0x69, 0x6e, - 0x61, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x64, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x12, 0x4a, 0x0a, 0x0a, 0x65, - 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x2a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, +var File_runtime_bootstrap_v1_bootstrap_proto protoreflect.FileDescriptor + +var file_runtime_bootstrap_v1_bootstrap_proto_rawDesc = []byte{ + 0x0a, 0x24, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, + 0x72, 0x61, 0x70, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, + 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0x87, 0x03, 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, + 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x69, 0x6e, 0x73, + 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, + 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, + 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6c, 0x6f, 0x67, 0x5f, 0x6c, 0x65, 0x76, + 0x65, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x6f, 0x67, 0x4c, 0x65, 0x76, + 0x65, 0x6c, 0x12, 0x2d, 0x0a, 0x12, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, + 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x12, 0x38, 0x0a, 0x18, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, + 0x74, 0x74, 0x72, 0x70, 0x63, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x16, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x54, + 0x74, 0x72, 0x70, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x36, 0x0a, 0x17, 0x63, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x47, 0x72, 0x70, 0x63, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x64, 0x5f, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x79, + 0x12, 0x4a, 0x0a, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, + 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, + 0x52, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x37, 0x0a, 0x09, + 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x9e, 0x02, 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, + 0x72, 0x61, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1a, 0x0a, + 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x61, 0x70, + 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x0c, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x5a, 0x0a, + 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x3e, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, - 0x31, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x65, 0x78, 0x74, - 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x37, 0x0a, 0x09, 0x45, 0x78, 0x74, 0x65, 0x6e, - 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x22, 0x9e, 0x02, 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x52, 0x65, - 0x73, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x18, - 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, - 0x74, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x61, 0x70, 0x61, - 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x5a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3e, 0x2e, 0x63, 0x6f, 0x6e, - 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, - 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x6f, 0x6f, - 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x2e, 0x4d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, - 0x01, 0x42, 0x45, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, - 0x65, 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2f, 0x76, 0x31, 0x3b, 0x62, - 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x31, 0x2e, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, + 0x74, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, + 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x45, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, + 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, + 0x2f, 0x76, 0x31, 0x3b, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_runtime_boot_v1_bootstrap_proto_rawDescOnce sync.Once - file_runtime_boot_v1_bootstrap_proto_rawDescData = file_runtime_boot_v1_bootstrap_proto_rawDesc + file_runtime_bootstrap_v1_bootstrap_proto_rawDescOnce sync.Once + file_runtime_bootstrap_v1_bootstrap_proto_rawDescData = file_runtime_bootstrap_v1_bootstrap_proto_rawDesc ) -func file_runtime_boot_v1_bootstrap_proto_rawDescGZIP() []byte { - file_runtime_boot_v1_bootstrap_proto_rawDescOnce.Do(func() { - file_runtime_boot_v1_bootstrap_proto_rawDescData = protoimpl.X.CompressGZIP(file_runtime_boot_v1_bootstrap_proto_rawDescData) +func file_runtime_bootstrap_v1_bootstrap_proto_rawDescGZIP() []byte { + file_runtime_bootstrap_v1_bootstrap_proto_rawDescOnce.Do(func() { + file_runtime_bootstrap_v1_bootstrap_proto_rawDescData = protoimpl.X.CompressGZIP(file_runtime_bootstrap_v1_bootstrap_proto_rawDescData) }) - return file_runtime_boot_v1_bootstrap_proto_rawDescData + return file_runtime_bootstrap_v1_bootstrap_proto_rawDescData } -var file_runtime_boot_v1_bootstrap_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_runtime_boot_v1_bootstrap_proto_goTypes = []interface{}{ +var file_runtime_bootstrap_v1_bootstrap_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_runtime_bootstrap_v1_bootstrap_proto_goTypes = []interface{}{ (*BootstrapParams)(nil), // 0: containerd.runtime.bootstrap.v1.BootstrapParams (*Extension)(nil), // 1: containerd.runtime.bootstrap.v1.Extension (*BootstrapResult)(nil), // 2: containerd.runtime.bootstrap.v1.BootstrapResult nil, // 3: containerd.runtime.bootstrap.v1.BootstrapResult.MetadataEntry (*anypb.Any)(nil), // 4: google.protobuf.Any } -var file_runtime_boot_v1_bootstrap_proto_depIdxs = []int32{ +var file_runtime_bootstrap_v1_bootstrap_proto_depIdxs = []int32{ 1, // 0: containerd.runtime.bootstrap.v1.BootstrapParams.extensions:type_name -> containerd.runtime.bootstrap.v1.Extension 4, // 1: containerd.runtime.bootstrap.v1.Extension.value:type_name -> google.protobuf.Any 3, // 2: containerd.runtime.bootstrap.v1.BootstrapResult.metadata:type_name -> containerd.runtime.bootstrap.v1.BootstrapResult.MetadataEntry @@ -406,13 +407,13 @@ var file_runtime_boot_v1_bootstrap_proto_depIdxs = []int32{ 0, // [0:3] is the sub-list for field type_name } -func init() { file_runtime_boot_v1_bootstrap_proto_init() } -func file_runtime_boot_v1_bootstrap_proto_init() { - if File_runtime_boot_v1_bootstrap_proto != nil { +func init() { file_runtime_bootstrap_v1_bootstrap_proto_init() } +func file_runtime_bootstrap_v1_bootstrap_proto_init() { + if File_runtime_bootstrap_v1_bootstrap_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_runtime_boot_v1_bootstrap_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_runtime_bootstrap_v1_bootstrap_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BootstrapParams); i { case 0: return &v.state @@ -424,7 +425,7 @@ func file_runtime_boot_v1_bootstrap_proto_init() { return nil } } - file_runtime_boot_v1_bootstrap_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_runtime_bootstrap_v1_bootstrap_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Extension); i { case 0: return &v.state @@ -436,7 +437,7 @@ func file_runtime_boot_v1_bootstrap_proto_init() { return nil } } - file_runtime_boot_v1_bootstrap_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_runtime_bootstrap_v1_bootstrap_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BootstrapResult); i { case 0: return &v.state @@ -453,18 +454,18 @@ func file_runtime_boot_v1_bootstrap_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_runtime_boot_v1_bootstrap_proto_rawDesc, + RawDescriptor: file_runtime_bootstrap_v1_bootstrap_proto_rawDesc, NumEnums: 0, NumMessages: 4, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_runtime_boot_v1_bootstrap_proto_goTypes, - DependencyIndexes: file_runtime_boot_v1_bootstrap_proto_depIdxs, - MessageInfos: file_runtime_boot_v1_bootstrap_proto_msgTypes, + GoTypes: file_runtime_bootstrap_v1_bootstrap_proto_goTypes, + DependencyIndexes: file_runtime_bootstrap_v1_bootstrap_proto_depIdxs, + MessageInfos: file_runtime_bootstrap_v1_bootstrap_proto_msgTypes, }.Build() - File_runtime_boot_v1_bootstrap_proto = out.File - file_runtime_boot_v1_bootstrap_proto_rawDesc = nil - file_runtime_boot_v1_bootstrap_proto_goTypes = nil - file_runtime_boot_v1_bootstrap_proto_depIdxs = nil + File_runtime_bootstrap_v1_bootstrap_proto = out.File + file_runtime_bootstrap_v1_bootstrap_proto_rawDesc = nil + file_runtime_bootstrap_v1_bootstrap_proto_goTypes = nil + file_runtime_bootstrap_v1_bootstrap_proto_depIdxs = nil } diff --git a/api/runtime/boot/v1/bootstrap.proto b/api/runtime/bootstrap/v1/bootstrap.proto similarity index 100% rename from api/runtime/boot/v1/bootstrap.proto rename to api/runtime/bootstrap/v1/bootstrap.proto diff --git a/api/runtime/boot/v1/doc.go b/api/runtime/bootstrap/v1/doc.go similarity index 100% rename from api/runtime/boot/v1/doc.go rename to api/runtime/bootstrap/v1/doc.go diff --git a/api/runtime/boot/v1/helpers.go b/api/runtime/bootstrap/v1/helpers.go similarity index 100% rename from api/runtime/boot/v1/helpers.go rename to api/runtime/bootstrap/v1/helpers.go diff --git a/api/runtime/boot/v1/helpers_test.go b/api/runtime/bootstrap/v1/helpers_test.go similarity index 100% rename from api/runtime/boot/v1/helpers_test.go rename to api/runtime/bootstrap/v1/helpers_test.go diff --git a/pkg/shim/shim.go b/pkg/shim/shim.go index f8df287269705..d2775651ea8b7 100644 --- a/pkg/shim/shim.go +++ b/pkg/shim/shim.go @@ -30,7 +30,7 @@ import ( "runtime/debug" "time" - bootapi "github.com/containerd/containerd/api/runtime/boot/v1" + bootapi "github.com/containerd/containerd/api/runtime/bootstrap/v1" shimapi "github.com/containerd/containerd/api/runtime/task/v3" "github.com/containerd/containerd/api/types" diff --git a/pkg/shim/util.go b/pkg/shim/util.go index 6cf2f5b959f4b..4c95859f3b53a 100644 --- a/pkg/shim/util.go +++ b/pkg/shim/util.go @@ -33,7 +33,7 @@ import ( "github.com/containerd/ttrpc" "github.com/containerd/typeurl/v2" - bootapi "github.com/containerd/containerd/api/runtime/boot/v1" + bootapi "github.com/containerd/containerd/api/runtime/bootstrap/v1" "github.com/containerd/containerd/v2/pkg/atomicfile" "github.com/containerd/containerd/v2/pkg/namespaces" "github.com/containerd/containerd/v2/pkg/protobuf/proto" diff --git a/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.pb.go b/vendor/github.com/containerd/containerd/api/runtime/bootstrap/v1/bootstrap.pb.go similarity index 59% rename from vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.pb.go rename to vendor/github.com/containerd/containerd/api/runtime/bootstrap/v1/bootstrap.pb.go index 0bde5d32006c7..476f026ccdf11 100644 --- a/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.pb.go +++ b/vendor/github.com/containerd/containerd/api/runtime/bootstrap/v1/bootstrap.pb.go @@ -39,7 +39,7 @@ // versions: // protoc-gen-go v1.28.1 // protoc (unknown) -// source: runtime/boot/v1/bootstrap.proto +// source: runtime/bootstrap/v1/bootstrap.proto package bootstrap @@ -87,7 +87,7 @@ type BootstrapParams struct { func (x *BootstrapParams) Reset() { *x = BootstrapParams{} if protoimpl.UnsafeEnabled { - mi := &file_runtime_boot_v1_bootstrap_proto_msgTypes[0] + mi := &file_runtime_bootstrap_v1_bootstrap_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -100,7 +100,7 @@ func (x *BootstrapParams) String() string { func (*BootstrapParams) ProtoMessage() {} func (x *BootstrapParams) ProtoReflect() protoreflect.Message { - mi := &file_runtime_boot_v1_bootstrap_proto_msgTypes[0] + mi := &file_runtime_bootstrap_v1_bootstrap_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -113,7 +113,7 @@ func (x *BootstrapParams) ProtoReflect() protoreflect.Message { // Deprecated: Use BootstrapParams.ProtoReflect.Descriptor instead. func (*BootstrapParams) Descriptor() ([]byte, []int) { - return file_runtime_boot_v1_bootstrap_proto_rawDescGZIP(), []int{0} + return file_runtime_bootstrap_v1_bootstrap_proto_rawDescGZIP(), []int{0} } func (x *BootstrapParams) GetInstanceID() string { @@ -190,7 +190,7 @@ type Extension struct { func (x *Extension) Reset() { *x = Extension{} if protoimpl.UnsafeEnabled { - mi := &file_runtime_boot_v1_bootstrap_proto_msgTypes[1] + mi := &file_runtime_bootstrap_v1_bootstrap_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -203,7 +203,7 @@ func (x *Extension) String() string { func (*Extension) ProtoMessage() {} func (x *Extension) ProtoReflect() protoreflect.Message { - mi := &file_runtime_boot_v1_bootstrap_proto_msgTypes[1] + mi := &file_runtime_bootstrap_v1_bootstrap_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -216,7 +216,7 @@ func (x *Extension) ProtoReflect() protoreflect.Message { // Deprecated: Use Extension.ProtoReflect.Descriptor instead. func (*Extension) Descriptor() ([]byte, []int) { - return file_runtime_boot_v1_bootstrap_proto_rawDescGZIP(), []int{1} + return file_runtime_bootstrap_v1_bootstrap_proto_rawDescGZIP(), []int{1} } func (x *Extension) GetValue() *anypb.Any { @@ -249,7 +249,7 @@ type BootstrapResult struct { func (x *BootstrapResult) Reset() { *x = BootstrapResult{} if protoimpl.UnsafeEnabled { - mi := &file_runtime_boot_v1_bootstrap_proto_msgTypes[2] + mi := &file_runtime_bootstrap_v1_bootstrap_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -262,7 +262,7 @@ func (x *BootstrapResult) String() string { func (*BootstrapResult) ProtoMessage() {} func (x *BootstrapResult) ProtoReflect() protoreflect.Message { - mi := &file_runtime_boot_v1_bootstrap_proto_msgTypes[2] + mi := &file_runtime_bootstrap_v1_bootstrap_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -275,7 +275,7 @@ func (x *BootstrapResult) ProtoReflect() protoreflect.Message { // Deprecated: Use BootstrapResult.ProtoReflect.Descriptor instead. func (*BootstrapResult) Descriptor() ([]byte, []int) { - return file_runtime_boot_v1_bootstrap_proto_rawDescGZIP(), []int{2} + return file_runtime_bootstrap_v1_bootstrap_proto_rawDescGZIP(), []int{2} } func (x *BootstrapResult) GetVersion() int32 { @@ -313,89 +313,90 @@ func (x *BootstrapResult) GetMetadata() map[string]string { return nil } -var File_runtime_boot_v1_bootstrap_proto protoreflect.FileDescriptor - -var file_runtime_boot_v1_bootstrap_proto_rawDesc = []byte{ - 0x0a, 0x1f, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x2f, 0x76, - 0x31, 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x1f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, - 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, - 0x76, 0x31, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x87, 0x03, - 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, - 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, - 0x12, 0x1b, 0x0a, 0x09, 0x6c, 0x6f, 0x67, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x6f, 0x67, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x2d, 0x0a, - 0x12, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, 0x76, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x64, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x38, 0x0a, 0x18, - 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, 0x74, 0x74, 0x72, 0x70, 0x63, - 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x16, - 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x54, 0x74, 0x72, 0x70, 0x63, 0x41, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x36, 0x0a, 0x17, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, - 0x6e, 0x65, 0x72, 0x64, 0x5f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, - 0x65, 0x72, 0x64, 0x47, 0x72, 0x70, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2b, - 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, 0x62, 0x69, 0x6e, - 0x61, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x64, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x12, 0x4a, 0x0a, 0x0a, 0x65, - 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x2a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, +var File_runtime_bootstrap_v1_bootstrap_proto protoreflect.FileDescriptor + +var file_runtime_bootstrap_v1_bootstrap_proto_rawDesc = []byte{ + 0x0a, 0x24, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, + 0x72, 0x61, 0x70, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, + 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0x87, 0x03, 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, + 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x69, 0x6e, 0x73, + 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, + 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, + 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6c, 0x6f, 0x67, 0x5f, 0x6c, 0x65, 0x76, + 0x65, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x6f, 0x67, 0x4c, 0x65, 0x76, + 0x65, 0x6c, 0x12, 0x2d, 0x0a, 0x12, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, + 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x12, 0x38, 0x0a, 0x18, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, + 0x74, 0x74, 0x72, 0x70, 0x63, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x16, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x54, + 0x74, 0x72, 0x70, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x36, 0x0a, 0x17, 0x63, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x47, 0x72, 0x70, 0x63, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x64, 0x5f, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x79, + 0x12, 0x4a, 0x0a, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, + 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, + 0x52, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x37, 0x0a, 0x09, + 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x9e, 0x02, 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, + 0x72, 0x61, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1a, 0x0a, + 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x61, 0x70, + 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x0c, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x5a, 0x0a, + 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x3e, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, - 0x31, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x65, 0x78, 0x74, - 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x37, 0x0a, 0x09, 0x45, 0x78, 0x74, 0x65, 0x6e, - 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x22, 0x9e, 0x02, 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x52, 0x65, - 0x73, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x18, - 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, - 0x74, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x61, 0x70, 0x61, - 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x5a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3e, 0x2e, 0x63, 0x6f, 0x6e, - 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, - 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x6f, 0x6f, - 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x2e, 0x4d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, - 0x01, 0x42, 0x45, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, - 0x65, 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2f, 0x76, 0x31, 0x3b, 0x62, - 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x31, 0x2e, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, + 0x74, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, + 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x45, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, + 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, + 0x2f, 0x76, 0x31, 0x3b, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_runtime_boot_v1_bootstrap_proto_rawDescOnce sync.Once - file_runtime_boot_v1_bootstrap_proto_rawDescData = file_runtime_boot_v1_bootstrap_proto_rawDesc + file_runtime_bootstrap_v1_bootstrap_proto_rawDescOnce sync.Once + file_runtime_bootstrap_v1_bootstrap_proto_rawDescData = file_runtime_bootstrap_v1_bootstrap_proto_rawDesc ) -func file_runtime_boot_v1_bootstrap_proto_rawDescGZIP() []byte { - file_runtime_boot_v1_bootstrap_proto_rawDescOnce.Do(func() { - file_runtime_boot_v1_bootstrap_proto_rawDescData = protoimpl.X.CompressGZIP(file_runtime_boot_v1_bootstrap_proto_rawDescData) +func file_runtime_bootstrap_v1_bootstrap_proto_rawDescGZIP() []byte { + file_runtime_bootstrap_v1_bootstrap_proto_rawDescOnce.Do(func() { + file_runtime_bootstrap_v1_bootstrap_proto_rawDescData = protoimpl.X.CompressGZIP(file_runtime_bootstrap_v1_bootstrap_proto_rawDescData) }) - return file_runtime_boot_v1_bootstrap_proto_rawDescData + return file_runtime_bootstrap_v1_bootstrap_proto_rawDescData } -var file_runtime_boot_v1_bootstrap_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_runtime_boot_v1_bootstrap_proto_goTypes = []interface{}{ +var file_runtime_bootstrap_v1_bootstrap_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_runtime_bootstrap_v1_bootstrap_proto_goTypes = []interface{}{ (*BootstrapParams)(nil), // 0: containerd.runtime.bootstrap.v1.BootstrapParams (*Extension)(nil), // 1: containerd.runtime.bootstrap.v1.Extension (*BootstrapResult)(nil), // 2: containerd.runtime.bootstrap.v1.BootstrapResult nil, // 3: containerd.runtime.bootstrap.v1.BootstrapResult.MetadataEntry (*anypb.Any)(nil), // 4: google.protobuf.Any } -var file_runtime_boot_v1_bootstrap_proto_depIdxs = []int32{ +var file_runtime_bootstrap_v1_bootstrap_proto_depIdxs = []int32{ 1, // 0: containerd.runtime.bootstrap.v1.BootstrapParams.extensions:type_name -> containerd.runtime.bootstrap.v1.Extension 4, // 1: containerd.runtime.bootstrap.v1.Extension.value:type_name -> google.protobuf.Any 3, // 2: containerd.runtime.bootstrap.v1.BootstrapResult.metadata:type_name -> containerd.runtime.bootstrap.v1.BootstrapResult.MetadataEntry @@ -406,13 +407,13 @@ var file_runtime_boot_v1_bootstrap_proto_depIdxs = []int32{ 0, // [0:3] is the sub-list for field type_name } -func init() { file_runtime_boot_v1_bootstrap_proto_init() } -func file_runtime_boot_v1_bootstrap_proto_init() { - if File_runtime_boot_v1_bootstrap_proto != nil { +func init() { file_runtime_bootstrap_v1_bootstrap_proto_init() } +func file_runtime_bootstrap_v1_bootstrap_proto_init() { + if File_runtime_bootstrap_v1_bootstrap_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_runtime_boot_v1_bootstrap_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_runtime_bootstrap_v1_bootstrap_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BootstrapParams); i { case 0: return &v.state @@ -424,7 +425,7 @@ func file_runtime_boot_v1_bootstrap_proto_init() { return nil } } - file_runtime_boot_v1_bootstrap_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_runtime_bootstrap_v1_bootstrap_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Extension); i { case 0: return &v.state @@ -436,7 +437,7 @@ func file_runtime_boot_v1_bootstrap_proto_init() { return nil } } - file_runtime_boot_v1_bootstrap_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_runtime_bootstrap_v1_bootstrap_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BootstrapResult); i { case 0: return &v.state @@ -453,18 +454,18 @@ func file_runtime_boot_v1_bootstrap_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_runtime_boot_v1_bootstrap_proto_rawDesc, + RawDescriptor: file_runtime_bootstrap_v1_bootstrap_proto_rawDesc, NumEnums: 0, NumMessages: 4, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_runtime_boot_v1_bootstrap_proto_goTypes, - DependencyIndexes: file_runtime_boot_v1_bootstrap_proto_depIdxs, - MessageInfos: file_runtime_boot_v1_bootstrap_proto_msgTypes, + GoTypes: file_runtime_bootstrap_v1_bootstrap_proto_goTypes, + DependencyIndexes: file_runtime_bootstrap_v1_bootstrap_proto_depIdxs, + MessageInfos: file_runtime_bootstrap_v1_bootstrap_proto_msgTypes, }.Build() - File_runtime_boot_v1_bootstrap_proto = out.File - file_runtime_boot_v1_bootstrap_proto_rawDesc = nil - file_runtime_boot_v1_bootstrap_proto_goTypes = nil - file_runtime_boot_v1_bootstrap_proto_depIdxs = nil + File_runtime_bootstrap_v1_bootstrap_proto = out.File + file_runtime_bootstrap_v1_bootstrap_proto_rawDesc = nil + file_runtime_bootstrap_v1_bootstrap_proto_goTypes = nil + file_runtime_bootstrap_v1_bootstrap_proto_depIdxs = nil } diff --git a/vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.proto b/vendor/github.com/containerd/containerd/api/runtime/bootstrap/v1/bootstrap.proto similarity index 100% rename from vendor/github.com/containerd/containerd/api/runtime/boot/v1/bootstrap.proto rename to vendor/github.com/containerd/containerd/api/runtime/bootstrap/v1/bootstrap.proto diff --git a/vendor/github.com/containerd/containerd/api/runtime/boot/v1/doc.go b/vendor/github.com/containerd/containerd/api/runtime/bootstrap/v1/doc.go similarity index 100% rename from vendor/github.com/containerd/containerd/api/runtime/boot/v1/doc.go rename to vendor/github.com/containerd/containerd/api/runtime/bootstrap/v1/doc.go diff --git a/vendor/github.com/containerd/containerd/api/runtime/boot/v1/helpers.go b/vendor/github.com/containerd/containerd/api/runtime/bootstrap/v1/helpers.go similarity index 100% rename from vendor/github.com/containerd/containerd/api/runtime/boot/v1/helpers.go rename to vendor/github.com/containerd/containerd/api/runtime/bootstrap/v1/helpers.go diff --git a/vendor/modules.txt b/vendor/modules.txt index cd3efd36eb163..414c498791fa3 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -115,9 +115,8 @@ github.com/containerd/cgroups/v3/cgroup2/stats ## explicit; go 1.13 github.com/containerd/console # github.com/containerd/containerd/api v1.11.0-beta.0 => ./api -## explicit; go 1.24.0 github.com/containerd/containerd/api/events -github.com/containerd/containerd/api/runtime/boot/v1 +github.com/containerd/containerd/api/runtime/bootstrap/v1 github.com/containerd/containerd/api/runtime/sandbox/v1 github.com/containerd/containerd/api/runtime/task/v2 github.com/containerd/containerd/api/runtime/task/v3 From 243cab594ee6d5edab591a43e399786ff07faab8 Mon Sep 17 00:00:00 2001 From: Derek McGowan Date: Wed, 18 Mar 2026 23:32:33 -0700 Subject: [PATCH 21/28] Deprecate old pkg/shim interfaces Signed-off-by: Derek McGowan --- cmd/containerd-shim-runc-v2/main.go | 2 +- .../manager/manager_linux.go | 7 +- core/runtime/v2/example/cmd/main.go | 2 +- core/runtime/v2/example/example.go | 5 +- core/runtime/v2/shim.go | 11 +- core/runtime/v2/shim_manager.go | 9 +- core/runtime/v2/shim_test.go | 16 +-- .../containerd-shim-runc-fp-v1/main_linux.go | 2 +- pkg/shim/compat.go | 3 +- pkg/shim/deprecated.go | 113 ++++++++++++++++++ pkg/shim/shim.go | 25 ++-- 11 files changed, 156 insertions(+), 39 deletions(-) create mode 100644 pkg/shim/deprecated.go diff --git a/cmd/containerd-shim-runc-v2/main.go b/cmd/containerd-shim-runc-v2/main.go index d6f11990c211c..4cc0879ccb48f 100644 --- a/cmd/containerd-shim-runc-v2/main.go +++ b/cmd/containerd-shim-runc-v2/main.go @@ -27,5 +27,5 @@ import ( ) func main() { - shim.Run(context.Background(), manager.NewShimManager("io.containerd.runc.v2")) + shim.RunShim(context.Background(), manager.NewShimManager("io.containerd.runc.v2")) } diff --git a/cmd/containerd-shim-runc-v2/manager/manager_linux.go b/cmd/containerd-shim-runc-v2/manager/manager_linux.go index 0270b9499a34c..c95fd2c5fdf6e 100644 --- a/cmd/containerd-shim-runc-v2/manager/manager_linux.go +++ b/cmd/containerd-shim-runc-v2/manager/manager_linux.go @@ -34,6 +34,7 @@ import ( "github.com/containerd/cgroups/v3" "github.com/containerd/cgroups/v3/cgroup1" cgroupsv2 "github.com/containerd/cgroups/v3/cgroup2" + bootapi "github.com/containerd/containerd/api/runtime/bootstrap/v1" "github.com/containerd/containerd/api/types" "github.com/containerd/containerd/api/types/runc/options" "github.com/containerd/containerd/v2/cmd/containerd-shim-runc-v2/process" @@ -54,7 +55,7 @@ import ( // NewShimManager returns an implementation of the shim manager // using runc -func NewShimManager(name string) shim.Manager { +func NewShimManager(name string) shim.Shim { return &manager{ name: name, } @@ -182,8 +183,8 @@ func newShimSocket(ctx context.Context, path, id string, debug bool) (*shimSocke return s, nil } -func (manager) Start(ctx context.Context, opts *shim.BootstrapParams) (_ *shim.BootstrapResult, retErr error) { - var params shim.BootstrapResult +func (manager) Start(ctx context.Context, opts *bootapi.BootstrapParams) (_ *bootapi.BootstrapResult, retErr error) { + var params bootapi.BootstrapResult params.Version = 3 params.Protocol = "ttrpc" diff --git a/core/runtime/v2/example/cmd/main.go b/core/runtime/v2/example/cmd/main.go index 2e99793c84ab6..9e36126f49695 100644 --- a/core/runtime/v2/example/cmd/main.go +++ b/core/runtime/v2/example/cmd/main.go @@ -25,5 +25,5 @@ import ( func main() { // init and execute the shim - shim.Run(context.Background(), example.NewManager("io.containerd.example.v1")) + shim.RunShim(context.Background(), example.NewManager("io.containerd.example.v1")) } diff --git a/core/runtime/v2/example/example.go b/core/runtime/v2/example/example.go index 2745852ed657b..5c428376d94b6 100644 --- a/core/runtime/v2/example/example.go +++ b/core/runtime/v2/example/example.go @@ -21,6 +21,7 @@ import ( "io" "os" + bootapi "github.com/containerd/containerd/api/runtime/bootstrap/v1" taskAPI "github.com/containerd/containerd/api/runtime/task/v2" apitypes "github.com/containerd/containerd/api/types" ptypes "github.com/containerd/containerd/v2/pkg/protobuf/types" @@ -55,7 +56,7 @@ func init() { }) } -func NewManager(name string) shim.Manager { +func NewManager(name string) shim.Shim { return manager{name: name} } @@ -67,7 +68,7 @@ func (m manager) Name() string { return m.name } -func (m manager) Start(ctx context.Context, opts *shim.BootstrapParams) (*shim.BootstrapResult, error) { +func (m manager) Start(ctx context.Context, opts *bootapi.BootstrapParams) (*bootapi.BootstrapResult, error) { return nil, errdefs.ErrNotImplemented } diff --git a/core/runtime/v2/shim.go b/core/runtime/v2/shim.go index f80177ebd47cf..92dff55bd1df6 100644 --- a/core/runtime/v2/shim.go +++ b/core/runtime/v2/shim.go @@ -35,6 +35,7 @@ import ( crmetadata "github.com/checkpoint-restore/checkpointctl/lib" eventstypes "github.com/containerd/containerd/api/events" + bootapi "github.com/containerd/containerd/api/runtime/bootstrap/v1" task "github.com/containerd/containerd/api/runtime/task/v3" "github.com/containerd/containerd/api/types" "github.com/containerd/errdefs" @@ -219,8 +220,8 @@ type clientVersionDowngrader interface { Downgrade() error } -func parseStartResponse(response []byte) (*client.BootstrapResult, error) { - var params client.BootstrapResult +func parseStartResponse(response []byte) (*bootapi.BootstrapResult, error) { + var params bootapi.BootstrapResult if err := json.Unmarshal(response, ¶ms); err != nil || params.Version < 2 { // Use TTRPC for legacy shims @@ -237,7 +238,7 @@ func parseStartResponse(response []byte) (*client.BootstrapResult, error) { } // writeBootstrapParams writes shim's bootstrap configuration (e.g. how to connect, version, etc). -func writeBootstrapParams(path string, params *client.BootstrapResult) error { +func writeBootstrapParams(path string, params *bootapi.BootstrapResult) error { path, err := filepath.Abs(path) if err != nil { return err @@ -262,7 +263,7 @@ func writeBootstrapParams(path string, params *client.BootstrapResult) error { return f.Close() } -func readBootstrapParams(path string) (*client.BootstrapResult, error) { +func readBootstrapParams(path string) (*bootapi.BootstrapResult, error) { path, err := filepath.Abs(path) if err != nil { return nil, err @@ -278,7 +279,7 @@ func readBootstrapParams(path string) (*client.BootstrapResult, error) { // makeConnection creates a new TTRPC or GRPC connection object from address. // address can be either a socket path for TTRPC or JSON serialized BootstrapParams. -func makeConnection(ctx context.Context, id string, params *client.BootstrapResult, onClose func()) (_ io.Closer, retErr error) { +func makeConnection(ctx context.Context, id string, params *bootapi.BootstrapResult, onClose func()) (_ io.Closer, retErr error) { log.G(ctx).WithFields(log.Fields{ "address": params.Address, "protocol": params.Protocol, diff --git a/core/runtime/v2/shim_manager.go b/core/runtime/v2/shim_manager.go index 4aae8bce9f6c4..b74b9ed755e6a 100644 --- a/core/runtime/v2/shim_manager.go +++ b/core/runtime/v2/shim_manager.go @@ -33,6 +33,7 @@ import ( "github.com/containerd/plugin/registry" "github.com/containerd/typeurl/v2" + bootapi "github.com/containerd/containerd/api/runtime/bootstrap/v1" "github.com/containerd/containerd/v2/core/containers" "github.com/containerd/containerd/v2/core/events/exchange" "github.com/containerd/containerd/v2/core/metadata" @@ -169,7 +170,7 @@ func (m *ShimManager) ID() string { func (m *ShimManager) Start(ctx context.Context, id string, bundle *Bundle, opts runtime.CreateOpts) (_ ShimInstance, retErr error) { shouldInvokeShimBinary := false - var params = &shimbinary.BootstrapResult{} + var params = &bootapi.BootstrapResult{} if opts.SandboxID != "" { _, sbErr := m.sandboxStore.Get(ctx, opts.SandboxID) if sbErr != nil { @@ -193,7 +194,7 @@ func (m *ShimManager) Start(ctx context.Context, id string, bundle *Bundle, opts return nil, fmt.Errorf("the scheme of sandbox address should be in " + " the form of +, i.e. ttrpc+unix or grpc+vsock") } - params = &shimbinary.BootstrapResult{ + params = &bootapi.BootstrapResult{ Version: int32(opts.Version), Protocol: protocol, Address: address, @@ -310,7 +311,7 @@ func (m *ShimManager) startShim(ctx context.Context, bundle *Bundle, id string, // restoreBootstrapParams reads bootstrap.json to restore shim configuration. // If its an old shim, this will perform migration - read address file and write default bootstrap // configuration (version = 2, protocol = ttrpc, and address). -func restoreBootstrapParams(bundlePath string) (*shimbinary.BootstrapResult, error) { +func restoreBootstrapParams(bundlePath string) (*bootapi.BootstrapResult, error) { filePath := filepath.Join(bundlePath, "bootstrap.json") // Read bootstrap.json if exists @@ -327,7 +328,7 @@ func restoreBootstrapParams(bundlePath string) (*shimbinary.BootstrapResult, err return nil, fmt.Errorf("unable to migrate shim: failed to get socket address for bundle %s: %w", bundlePath, err) } - params := shimbinary.BootstrapResult{ + params := bootapi.BootstrapResult{ Version: 2, Address: address, Protocol: "ttrpc", diff --git a/core/runtime/v2/shim_test.go b/core/runtime/v2/shim_test.go index 063fb318a3d50..82f383109f57c 100644 --- a/core/runtime/v2/shim_test.go +++ b/core/runtime/v2/shim_test.go @@ -22,7 +22,7 @@ import ( "path/filepath" "testing" - client "github.com/containerd/containerd/v2/pkg/shim" + bootapi "github.com/containerd/containerd/api/runtime/bootstrap/v1" "github.com/containerd/errdefs" "github.com/stretchr/testify/require" ) @@ -31,13 +31,13 @@ func TestParseStartResponse(t *testing.T) { for _, tc := range []struct { Name string Response string - Expected client.BootstrapResult + Expected bootapi.BootstrapResult Err error }{ { Name: "v2 shim", Response: "/somedirectory/somesocket", - Expected: client.BootstrapResult{ + Expected: bootapi.BootstrapResult{ Version: 2, Address: "/somedirectory/somesocket", Protocol: "ttrpc", @@ -46,7 +46,7 @@ func TestParseStartResponse(t *testing.T) { { Name: "v2 shim using grpc", Response: `{"version":2,"address":"/somedirectory/somesocket","protocol":"grpc"}`, - Expected: client.BootstrapResult{ + Expected: bootapi.BootstrapResult{ Version: 2, Address: "/somedirectory/somesocket", Protocol: "grpc", @@ -55,7 +55,7 @@ func TestParseStartResponse(t *testing.T) { { Name: "v2 shim using ttrpc", Response: `{"version":2,"address":"/somedirectory/somesocket","protocol":"ttrpc"}`, - Expected: client.BootstrapResult{ + Expected: bootapi.BootstrapResult{ Version: 2, Address: "/somedirectory/somesocket", Protocol: "ttrpc", @@ -64,7 +64,7 @@ func TestParseStartResponse(t *testing.T) { { Name: "invalid shim v2 response", Response: `{"address":"/somedirectory/somesocket","protocol":"ttrpc"}`, - Expected: client.BootstrapResult{ + Expected: bootapi.BootstrapResult{ Version: 2, Address: `{"address":"/somedirectory/somesocket","protocol":"ttrpc"}`, Protocol: "ttrpc", @@ -73,7 +73,7 @@ func TestParseStartResponse(t *testing.T) { { Name: "later unsupported shim", Response: `{"Version": 4,"Address":"/somedirectory/somesocket","Protocol":"ttrpc"}`, - Expected: client.BootstrapResult{}, + Expected: bootapi.BootstrapResult{}, Err: errdefs.ErrNotImplemented, }, } { @@ -109,7 +109,7 @@ func TestRestoreBootstrapParams(t *testing.T) { restored, err := restoreBootstrapParams(bundlePath) require.NoError(t, err) - expected := &client.BootstrapResult{ + expected := &bootapi.BootstrapResult{ Version: 2, Address: "unix://123", Protocol: "ttrpc", diff --git a/integration/failpoint/cmd/containerd-shim-runc-fp-v1/main_linux.go b/integration/failpoint/cmd/containerd-shim-runc-fp-v1/main_linux.go index da5f4e756291b..a0940ff87e498 100644 --- a/integration/failpoint/cmd/containerd-shim-runc-fp-v1/main_linux.go +++ b/integration/failpoint/cmd/containerd-shim-runc-fp-v1/main_linux.go @@ -24,5 +24,5 @@ import ( ) func main() { - shim.Run(context.Background(), manager.NewShimManager("io.containerd.runc-fp.v1")) + shim.RunShim(context.Background(), manager.NewShimManager("io.containerd.runc-fp.v1")) } diff --git a/pkg/shim/compat.go b/pkg/shim/compat.go index fa57c4839f2cb..3617d00b0267a 100644 --- a/pkg/shim/compat.go +++ b/pkg/shim/compat.go @@ -26,11 +26,12 @@ import ( "fmt" "os" + bootapi "github.com/containerd/containerd/api/runtime/bootstrap/v1" "github.com/containerd/containerd/api/types/runc/options" "github.com/containerd/log" ) -func readBootstrapParamsFromDeprecatedFields(input []byte, params *BootstrapParams) error { +func readBootstrapParamsFromDeprecatedFields(input []byte, params *bootapi.BootstrapParams) error { params.InstanceID = id params.Namespace = namespaceFlag params.ContainerdTtrpcAddress = os.Getenv(ttrpcAddressEnv) diff --git a/pkg/shim/deprecated.go b/pkg/shim/deprecated.go new file mode 100644 index 0000000000000..0596d2e04350b --- /dev/null +++ b/pkg/shim/deprecated.go @@ -0,0 +1,113 @@ +/* + 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 shim + +import ( + "context" + "fmt" + "io" + "os" + + bootapi "github.com/containerd/containerd/api/runtime/bootstrap/v1" + "github.com/containerd/containerd/api/types" + "github.com/containerd/log" +) + +// StartOpts describes shim start configuration received from containerd. +// +// Deprecated: Use [bootapi.BootstrapParams] instead. +type StartOpts struct { + Address string + TTRPCAddress string + Debug bool +} + +// BootstrapParams is a JSON payload returned in stdout from shim.Start call. +// +// Deprecated: Use [bootapi.BootstrapResult] instead. +type BootstrapParams struct { + // Version is the version of shim parameters (expected 2 for shim v2) + Version int `json:"version"` + // Address is a address containerd should use to connect to shim. + Address string `json:"address"` + // Protocol is either TTRPC or GRPC. + Protocol string `json:"protocol"` +} + +// Manager is the interface which manages the shim process. +// +// Deprecated: Use [Shim] instead. +type Manager interface { + Name() string + Start(ctx context.Context, id string, opts StartOpts) (BootstrapParams, error) + Stop(ctx context.Context, id string) (StopStatus, error) + Info(ctx context.Context, optionsR io.Reader) (*types.RuntimeInfo, error) +} + +// managerShim wraps a deprecated Manager to implement the Shim interface. +type managerShim struct { + manager Manager +} + +func (m *managerShim) Name() string { + return m.manager.Name() +} + +func (m *managerShim) Start(ctx context.Context, params *bootapi.BootstrapParams) (*bootapi.BootstrapResult, error) { + opts := StartOpts{ + Address: params.ContainerdGrpcAddress, + TTRPCAddress: params.ContainerdTtrpcAddress, + Debug: params.LogLevel == "debug" || params.LogLevel == "trace", + } + + bp, err := m.manager.Start(ctx, params.InstanceID, opts) + if err != nil { + return nil, err + } + + return &bootapi.BootstrapResult{ + Version: int32(bp.Version), + Address: bp.Address, + Protocol: bp.Protocol, + }, nil +} + +func (m *managerShim) Stop(ctx context.Context, id string) (StopStatus, error) { + return m.manager.Stop(ctx, id) +} + +func (m *managerShim) Info(ctx context.Context, optionsR io.Reader) (*types.RuntimeInfo, error) { + return m.manager.Info(ctx, optionsR) +} + +// Run initializes and runs a shim server. +// +// Deprecated: Use [RunShim] instead. +func Run(ctx context.Context, manager Manager, opts ...BinaryOpts) { + var config Config + for _, o := range opts { + o(&config) + } + + shim := &managerShim{manager: manager} + ctx = log.WithLogger(ctx, log.G(ctx).WithField("runtime", shim.Name())) + + if err := run(ctx, shim, config); err != nil { + fmt.Fprintf(os.Stderr, "%s: %s", shim.Name(), err) + os.Exit(1) + } +} diff --git a/pkg/shim/shim.go b/pkg/shim/shim.go index d2775651ea8b7..642e47fe6175f 100644 --- a/pkg/shim/shim.go +++ b/pkg/shim/shim.go @@ -53,19 +53,17 @@ type Publisher interface { io.Closer } -type BootstrapParams = bootapi.BootstrapParams -type BootstrapResult = bootapi.BootstrapResult - type StopStatus struct { Pid int ExitStatus int ExitedAt time.Time } -// Manager is the interface which manages the shim process -type Manager interface { +// Shim is the interface which manages the shim process lifecycle using the +// new bootstrap protocol. +type Shim interface { Name() string - Start(ctx context.Context, params *BootstrapParams) (*BootstrapResult, error) + Start(ctx context.Context, params *bootapi.BootstrapParams) (*bootapi.BootstrapResult, error) Stop(ctx context.Context, id string) (StopStatus, error) Info(ctx context.Context, optionsR io.Reader) (*types.RuntimeInfo, error) } @@ -179,22 +177,23 @@ func setLogger(ctx context.Context, id string) (context.Context, error) { return log.WithLogger(ctx, l), nil } -// Run initializes and runs a shim server. -func Run(ctx context.Context, manager Manager, opts ...BinaryOpts) { +// RunShim initializes and runs a shim server using the new bootstrap protocol. +func RunShim(ctx context.Context, shim Shim, opts ...BinaryOpts) { var config Config for _, o := range opts { o(&config) } - ctx = log.WithLogger(ctx, log.G(ctx).WithField("runtime", manager.Name())) + ctx = log.WithLogger(ctx, log.G(ctx).WithField("runtime", shim.Name())) - if err := run(ctx, manager, config); err != nil { - fmt.Fprintf(os.Stderr, "%s: %s", manager.Name(), err) + if err := run(ctx, shim, config); err != nil { + fmt.Fprintf(os.Stderr, "%s: %s", shim.Name(), err) os.Exit(1) } } -func runInfo(ctx context.Context, manager Manager) error { + +func runInfo(ctx context.Context, manager Shim) error { info, err := manager.Info(ctx, os.Stdin) if err != nil { return err @@ -207,7 +206,7 @@ func runInfo(ctx context.Context, manager Manager) error { return err } -func run(ctx context.Context, manager Manager, config Config) error { +func run(ctx context.Context, manager Shim, config Config) error { parseFlags() if versionFlag { fmt.Printf("%s:\n", filepath.Base(os.Args[0])) From 73edc804513e5c5711efe38f0e96e7c43909f94c Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Thu, 19 Mar 2026 08:58:27 -0700 Subject: [PATCH 22/28] Format code after cherry pick Signed-off-by: Maksym Pavlenko --- integration/client/client.go | 2 +- pkg/shim/shim.go | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/integration/client/client.go b/integration/client/client.go index d0829116d2e18..225de49311732 100644 --- a/integration/client/client.go +++ b/integration/client/client.go @@ -46,7 +46,7 @@ func init() { func testContext(t testing.TB) (context.Context, context.CancelFunc) { // This needs work to convert from context.Background() to t.Context(). - ctx, cancel := context.WithCancel(context.Background()) //nolint:all + ctx, cancel := context.WithCancel(context.Background()) //nolint:all ctx = namespaces.WithNamespace(ctx, testNamespace) if t != nil { ctx = logtest.WithT(ctx, t) diff --git a/pkg/shim/shim.go b/pkg/shim/shim.go index 642e47fe6175f..add38df00333e 100644 --- a/pkg/shim/shim.go +++ b/pkg/shim/shim.go @@ -192,7 +192,6 @@ func RunShim(ctx context.Context, shim Shim, opts ...BinaryOpts) { } } - func runInfo(ctx context.Context, manager Shim) error { info, err := manager.Info(ctx, os.Stdin) if err != nil { From 9dc864fd0feefd907aba16ba98cf453dd16df694 Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Thu, 19 Mar 2026 09:52:33 -0700 Subject: [PATCH 23/28] Switch to proto instead of json Signed-off-by: Maksym Pavlenko --- api/runtime/bootstrap/v1/bootstrap.proto | 5 ---- core/runtime/v2/shim.go | 32 +++++++++++++++++------- pkg/shim/shim.go | 7 +++--- pkg/shim/util.go | 3 +-- 4 files changed, 27 insertions(+), 20 deletions(-) diff --git a/api/runtime/bootstrap/v1/bootstrap.proto b/api/runtime/bootstrap/v1/bootstrap.proto index 1cb27129f16cc..c90aecc761dbb 100644 --- a/api/runtime/bootstrap/v1/bootstrap.proto +++ b/api/runtime/bootstrap/v1/bootstrap.proto @@ -26,11 +26,6 @@ // 3. shim initializes and writes BootstrapResult as JSON to stdout // 4. containerd connects to the address provided in BootstrapResult // -// Note: JSON serialization is used to keep shim binaries small since the -// encoding/json package is already part of the Go runtime. The proto -// definition serves as the schema for detecting breaking changes and -// maintaining forward/backward compatibility. -// // This design enables: // - Forward/backward compatibility via version field // - Typed extensibility via google.protobuf.Any and Extension diff --git a/core/runtime/v2/shim.go b/core/runtime/v2/shim.go index 92dff55bd1df6..7832444af785e 100644 --- a/core/runtime/v2/shim.go +++ b/core/runtime/v2/shim.go @@ -53,6 +53,7 @@ import ( "github.com/containerd/containerd/v2/pkg/dialer" "github.com/containerd/containerd/v2/pkg/identifiers" "github.com/containerd/containerd/v2/pkg/protobuf" + "github.com/containerd/containerd/v2/pkg/protobuf/proto" ptypes "github.com/containerd/containerd/v2/pkg/protobuf/types" client "github.com/containerd/containerd/v2/pkg/shim" "github.com/containerd/containerd/v2/pkg/timeout" @@ -221,20 +222,33 @@ type clientVersionDowngrader interface { } func parseStartResponse(response []byte) (*bootapi.BootstrapResult, error) { - var params bootapi.BootstrapResult + var result bootapi.BootstrapResult + + if json.Valid(response) { + var params client.BootstrapParams + if err := json.Unmarshal(response, ¶ms); err != nil || params.Version < 2 { + // Use TTRPC for legacy shims + params.Address = string(response) + params.Protocol = "ttrpc" + params.Version = 2 + } + + if params.Version > CurrentShimVersion { + return nil, fmt.Errorf("unsupported shim version (%d): %w", params.Version, errdefs.ErrNotImplemented) + } - if err := json.Unmarshal(response, ¶ms); err != nil || params.Version < 2 { - // Use TTRPC for legacy shims - params.Address = string(response) - params.Protocol = "ttrpc" - params.Version = 2 + return &bootapi.BootstrapResult{ + Version: int32(params.Version), + Address: params.Address, + Protocol: params.Protocol, + }, nil } - if params.Version > CurrentShimVersion { - return nil, fmt.Errorf("unsupported shim version (%d): %w", params.Version, errdefs.ErrNotImplemented) + if err := proto.Unmarshal(response, &result); err != nil { + return nil, fmt.Errorf("unable to read shim bootstrap response: %w", err) } - return ¶ms, nil + return &result, nil } // writeBootstrapParams writes shim's bootstrap configuration (e.g. how to connect, version, etc). diff --git a/pkg/shim/shim.go b/pkg/shim/shim.go index add38df00333e..3b45e80600152 100644 --- a/pkg/shim/shim.go +++ b/pkg/shim/shim.go @@ -18,7 +18,6 @@ package shim import ( "context" - "encoding/json" "errors" "flag" "fmt" @@ -280,7 +279,7 @@ func run(ctx context.Context, manager Shim, config Config) error { } var params bootapi.BootstrapParams - if err := json.Unmarshal(input, ¶ms); err != nil { + if err := proto.Unmarshal(input, ¶ms); err != nil { // TODO: Return error once the new API is stable if err := readBootstrapParamsFromDeprecatedFields(input, ¶ms); err != nil { return err @@ -292,9 +291,9 @@ func run(ctx context.Context, manager Shim, config Config) error { return err } - data, err := json.Marshal(result) + data, err := proto.Marshal(result) if err != nil { - return fmt.Errorf("failed to marshal bootstrap params to json: %w", err) + return fmt.Errorf("failed to marshal bootstrap params: %w", err) } if _, err := os.Stdout.Write(data); err != nil { diff --git a/pkg/shim/util.go b/pkg/shim/util.go index 4c95859f3b53a..c51166d9e188f 100644 --- a/pkg/shim/util.go +++ b/pkg/shim/util.go @@ -19,7 +19,6 @@ package shim import ( "bytes" "context" - "encoding/json" "errors" "fmt" "io" @@ -141,7 +140,7 @@ func Command(ctx context.Context, config *CommandConfig) (*exec.Cmd, error) { } } - data, err := json.Marshal(¶ms) + data, err := proto.Marshal(¶ms) if err != nil { return nil, fmt.Errorf("unable to marshal bootstrap params: %w", err) } From 9bf65dcf0275341a75b9e56454e5ebe599bcc90f Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Thu, 19 Mar 2026 10:05:21 -0700 Subject: [PATCH 24/28] Use enums instead of strings for capabilities and log level Signed-off-by: Maksym Pavlenko --- api/next.txtpb | 490 ++++++++++++++---- api/runtime/bootstrap/v1/bootstrap.pb.go | 274 +++++++--- api/runtime/bootstrap/v1/bootstrap.proto | 27 +- api/runtime/bootstrap/v1/helpers.go | 21 + .../manager/manager_linux.go | 4 +- pkg/shim/compat.go | 3 +- pkg/shim/deprecated.go | 2 +- pkg/shim/util.go | 2 +- .../api/runtime/bootstrap/v1/bootstrap.pb.go | 274 +++++++--- .../api/runtime/bootstrap/v1/bootstrap.proto | 32 +- .../api/runtime/bootstrap/v1/helpers.go | 21 + 11 files changed, 892 insertions(+), 258 deletions(-) diff --git a/api/next.txtpb b/api/next.txtpb index b9a193c318081..13943112709a8 100644 --- a/api/next.txtpb +++ b/api/next.txtpb @@ -24950,7 +24950,8 @@ file: { name: "log_level" number: 3 label: LABEL_OPTIONAL - type: TYPE_STRING + type: TYPE_ENUM + type_name: ".containerd.runtime.bootstrap.v1.LogLevel" json_name: "logLevel" } field: { @@ -25028,7 +25029,8 @@ file: { name: "capabilities" number: 4 label: LABEL_REPEATED - type: TYPE_STRING + type: TYPE_ENUM + type_name: ".containerd.runtime.bootstrap.v1.Capability" json_name: "capabilities" } field: { @@ -25060,56 +25062,94 @@ file: { } } } + enum_type: { + name: "LogLevel" + value: { + name: "LOG_LEVEL_UNSPECIFIED" + number: 0 + } + value: { + name: "LOG_LEVEL_TRACE" + number: 1 + } + value: { + name: "LOG_LEVEL_DEBUG" + number: 2 + } + value: { + name: "LOG_LEVEL_INFO" + number: 3 + } + value: { + name: "LOG_LEVEL_WARN" + number: 4 + } + value: { + name: "LOG_LEVEL_ERROR" + number: 5 + } + value: { + name: "LOG_LEVEL_FATAL" + number: 6 + } + } + enum_type: { + name: "Capability" + value: { + name: "CAPABILITY_UNSPECIFIED" + number: 0 + } + } options: { go_package: "github.com/containerd/containerd/api/runtime/bootstrap/v1;bootstrap" } source_code_info: { location: { - span: 38 + span: 33 span: 0 - span: 104 + span: 118 span: 1 } location: { path: 12 - span: 38 + span: 33 span: 0 span: 18 leading_detached_comments: "\nCopyright The containerd Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n" - leading_detached_comments: " Bootstrap Protocol\n\n This protocol defines the interface between containerd and shims at startup.\n It replaces the previous scattered configuration mechanisms (CLI args, env vars,\n stdin JSON, spec.json annotations) with a single, versioned, extensible protocol.\n\n Flow:\n 1. containerd spawns the shim process\n 2. containerd writes BootstrapParams as JSON to shim's stdin\n 3. shim initializes and writes BootstrapResult as JSON to stdout\n 4. containerd connects to the address provided in BootstrapResult\n\n Note: JSON serialization is used to keep shim binaries small since the\n encoding/json package is already part of the Go runtime. The proto\n definition serves as the schema for detecting breaking changes and\n maintaining forward/backward compatibility.\n\n This design enables:\n - Forward/backward compatibility via version field\n - Typed extensibility via google.protobuf.Any and Extension\n - Clear capability negotiation between containerd and shims\n" + leading_detached_comments: " Bootstrap Protocol\n\n This protocol defines the interface between containerd and shims at startup.\n It replaces the previous scattered configuration mechanisms (CLI args, env vars,\n stdin JSON, spec.json annotations) with a single, versioned, extensible protocol.\n\n Flow:\n 1. containerd spawns the shim process\n 2. containerd writes BootstrapParams as JSON to shim's stdin\n 3. shim initializes and writes BootstrapResult as JSON to stdout\n 4. containerd connects to the address provided in BootstrapResult\n\n This design enables:\n - Forward/backward compatibility via version field\n - Typed extensibility via google.protobuf.Any and Extension\n - Clear capability negotiation between containerd and shims\n" } location: { path: 2 - span: 40 + span: 35 span: 0 span: 40 } location: { path: 3 path: 0 - span: 42 + span: 37 span: 0 span: 35 } location: { path: 8 - span: 44 + span: 39 span: 0 span: 90 } location: { path: 8 path: 11 - span: 44 + span: 39 span: 0 span: 90 } location: { path: 4 path: 0 - span: 47 + span: 42 span: 0 - span: 73 + span: 68 span: 1 leading_comments: " BootstrapParams contains all configuration passed from containerd to shim at startup.\n" } @@ -25117,7 +25157,7 @@ file: { path: 4 path: 0 path: 1 - span: 47 + span: 42 span: 8 span: 23 } @@ -25126,7 +25166,7 @@ file: { path: 0 path: 2 path: 0 - span: 49 + span: 44 span: 2 span: 25 leading_comments: " Container/sandbox ID\n" @@ -25137,7 +25177,7 @@ file: { path: 2 path: 0 path: 5 - span: 49 + span: 44 span: 2 span: 8 } @@ -25147,7 +25187,7 @@ file: { path: 2 path: 0 path: 1 - span: 49 + span: 44 span: 9 span: 20 } @@ -25157,7 +25197,7 @@ file: { path: 2 path: 0 path: 3 - span: 49 + span: 44 span: 23 span: 24 } @@ -25166,7 +25206,7 @@ file: { path: 0 path: 2 path: 1 - span: 52 + span: 47 span: 2 span: 23 leading_comments: " Namespace for the container\n" @@ -25177,7 +25217,7 @@ file: { path: 2 path: 1 path: 5 - span: 52 + span: 47 span: 2 span: 8 } @@ -25187,7 +25227,7 @@ file: { path: 2 path: 1 path: 1 - span: 52 + span: 47 span: 9 span: 18 } @@ -25197,7 +25237,7 @@ file: { path: 2 path: 1 path: 3 - span: 52 + span: 47 span: 21 span: 22 } @@ -25206,9 +25246,9 @@ file: { path: 0 path: 2 path: 2 - span: 55 + span: 50 span: 2 - span: 23 + span: 25 leading_comments: " Requested shim log level.\n" } location: { @@ -25216,10 +25256,10 @@ file: { path: 0 path: 2 path: 2 - path: 5 - span: 55 + path: 6 + span: 50 span: 2 - span: 8 + span: 10 } location: { path: 4 @@ -25227,9 +25267,9 @@ file: { path: 2 path: 2 path: 1 - span: 55 - span: 9 - span: 18 + span: 50 + span: 11 + span: 20 } location: { path: 4 @@ -25237,16 +25277,16 @@ file: { path: 2 path: 2 path: 3 - span: 55 - span: 21 - span: 22 + span: 50 + span: 23 + span: 24 } location: { path: 4 path: 0 path: 2 path: 3 - span: 58 + span: 53 span: 2 span: 32 leading_comments: " containerd daemon version that is launching this shim.\n" @@ -25257,7 +25297,7 @@ file: { path: 2 path: 3 path: 5 - span: 58 + span: 53 span: 2 span: 8 } @@ -25267,7 +25307,7 @@ file: { path: 2 path: 3 path: 1 - span: 58 + span: 53 span: 9 span: 27 } @@ -25277,7 +25317,7 @@ file: { path: 2 path: 3 path: 3 - span: 58 + span: 53 span: 30 span: 31 } @@ -25286,7 +25326,7 @@ file: { path: 0 path: 2 path: 4 - span: 61 + span: 56 span: 2 span: 38 leading_comments: " Containerd's TTRPC API address (e.g., \"unix:///run/containerd/containerd.sock.ttrpc\")\n" @@ -25297,7 +25337,7 @@ file: { path: 2 path: 4 path: 5 - span: 61 + span: 56 span: 2 span: 8 } @@ -25307,7 +25347,7 @@ file: { path: 2 path: 4 path: 1 - span: 61 + span: 56 span: 9 span: 33 } @@ -25317,7 +25357,7 @@ file: { path: 2 path: 4 path: 3 - span: 61 + span: 56 span: 36 span: 37 } @@ -25326,7 +25366,7 @@ file: { path: 0 path: 2 path: 5 - span: 64 + span: 59 span: 2 span: 37 leading_comments: " Containerd's gRPC API address (e.g., \"unix:///run/containerd/containerd.sock\")\n" @@ -25337,7 +25377,7 @@ file: { path: 2 path: 5 path: 5 - span: 64 + span: 59 span: 2 span: 8 } @@ -25347,7 +25387,7 @@ file: { path: 2 path: 5 path: 1 - span: 64 + span: 59 span: 9 span: 32 } @@ -25357,7 +25397,7 @@ file: { path: 2 path: 5 path: 3 - span: 64 + span: 59 span: 35 span: 36 } @@ -25366,7 +25406,7 @@ file: { path: 0 path: 2 path: 6 - span: 67 + span: 62 span: 2 span: 31 leading_comments: " Path to containerd binary for event publishing\n" @@ -25377,7 +25417,7 @@ file: { path: 2 path: 6 path: 5 - span: 67 + span: 62 span: 2 span: 8 } @@ -25387,7 +25427,7 @@ file: { path: 2 path: 6 path: 1 - span: 67 + span: 62 span: 9 span: 26 } @@ -25397,7 +25437,7 @@ file: { path: 2 path: 6 path: 3 - span: 67 + span: 62 span: 29 span: 30 } @@ -25406,7 +25446,7 @@ file: { path: 0 path: 2 path: 7 - span: 72 + span: 67 span: 2 span: 36 leading_comments: " Extensible configuration sections for new features\n Each section can contain arbitrary structured data identified by type URL\n Examples: CRI config, NRI config, sandbox config, etc.\n" @@ -25417,7 +25457,7 @@ file: { path: 2 path: 7 path: 4 - span: 72 + span: 67 span: 2 span: 10 } @@ -25427,7 +25467,7 @@ file: { path: 2 path: 7 path: 6 - span: 72 + span: 67 span: 11 span: 20 } @@ -25437,7 +25477,7 @@ file: { path: 2 path: 7 path: 1 - span: 72 + span: 67 span: 21 span: 31 } @@ -25447,16 +25487,16 @@ file: { path: 2 path: 7 path: 3 - span: 72 + span: 67 span: 34 span: 35 } location: { path: 4 path: 1 - span: 77 + span: 72 span: 0 - span: 84 + span: 79 span: 1 leading_comments: " Extension provides extensibility for new configuration types\n without changing the core BootstrapParams protocol\n" } @@ -25464,7 +25504,7 @@ file: { path: 4 path: 1 path: 1 - span: 77 + span: 72 span: 8 span: 17 } @@ -25473,7 +25513,7 @@ file: { path: 1 path: 2 path: 0 - span: 83 + span: 78 span: 2 span: 32 leading_comments: " Configuration data with embedded type URL\n Examples of type URLs:\n - \"containerd.io/cri.v1.PodSandboxConfig\"\n - \"containerd.io/nri.v1.PluginConfig\"\n - \"containerd.io/sandbox.v1.SandboxConfig\"\n" @@ -25484,7 +25524,7 @@ file: { path: 2 path: 0 path: 6 - span: 83 + span: 78 span: 2 span: 21 } @@ -25494,7 +25534,7 @@ file: { path: 2 path: 0 path: 1 - span: 83 + span: 78 span: 22 span: 27 } @@ -25504,16 +25544,16 @@ file: { path: 2 path: 0 path: 3 - span: 83 + span: 78 span: 30 span: 31 } location: { path: 4 path: 2 - span: 87 + span: 82 span: 0 - span: 104 + span: 100 span: 1 leading_comments: " BootstrapResult is returned by shim via stdout after successful startup\n" } @@ -25521,7 +25561,7 @@ file: { path: 4 path: 2 path: 1 - span: 87 + span: 82 span: 8 span: 23 } @@ -25530,7 +25570,7 @@ file: { path: 2 path: 2 path: 0 - span: 89 + span: 84 span: 2 span: 20 leading_comments: " Version of shim parameters (expected 2 for shim v2)\n" @@ -25541,7 +25581,7 @@ file: { path: 2 path: 0 path: 5 - span: 89 + span: 84 span: 2 span: 7 } @@ -25551,7 +25591,7 @@ file: { path: 2 path: 0 path: 1 - span: 89 + span: 84 span: 8 span: 15 } @@ -25561,7 +25601,7 @@ file: { path: 2 path: 0 path: 3 - span: 89 + span: 84 span: 18 span: 19 } @@ -25570,7 +25610,7 @@ file: { path: 2 path: 2 path: 1 - span: 93 + span: 88 span: 2 span: 21 leading_comments: " Address where shim is listening (e.g., \"unix:///run/containerd/shim.sock\")\n Containerd will connect to this address for task operations\n" @@ -25581,7 +25621,7 @@ file: { path: 2 path: 1 path: 5 - span: 93 + span: 88 span: 2 span: 8 } @@ -25591,7 +25631,7 @@ file: { path: 2 path: 1 path: 1 - span: 93 + span: 88 span: 9 span: 16 } @@ -25601,7 +25641,7 @@ file: { path: 2 path: 1 path: 3 - span: 93 + span: 88 span: 19 span: 20 } @@ -25610,7 +25650,7 @@ file: { path: 2 path: 2 path: 2 - span: 96 + span: 91 span: 2 span: 22 leading_comments: " Protocol used by shim: \"ttrpc\" or \"grpc\"\n" @@ -25621,7 +25661,7 @@ file: { path: 2 path: 2 path: 5 - span: 96 + span: 91 span: 2 span: 8 } @@ -25631,7 +25671,7 @@ file: { path: 2 path: 2 path: 1 - span: 96 + span: 91 span: 9 span: 17 } @@ -25641,7 +25681,7 @@ file: { path: 2 path: 2 path: 3 - span: 96 + span: 91 span: 20 span: 21 } @@ -25650,10 +25690,10 @@ file: { path: 2 path: 2 path: 3 - span: 100 + span: 96 span: 2 - span: 35 - leading_comments: " Optional: Capabilities supported by this shim instance\n Allows shim to advertise what features it supports\n" + span: 39 + leading_comments: " Optional: Capabilities supported by this shim instance.\n Reserved for future use to allow optional capability negotiation\n between the daemon and shim.\n" } location: { path: 4 @@ -25661,7 +25701,7 @@ file: { path: 2 path: 3 path: 4 - span: 100 + span: 96 span: 2 span: 10 } @@ -25670,10 +25710,10 @@ file: { path: 2 path: 2 path: 3 - path: 5 - span: 100 + path: 6 + span: 96 span: 11 - span: 17 + span: 21 } location: { path: 4 @@ -25681,9 +25721,9 @@ file: { path: 2 path: 3 path: 1 - span: 100 - span: 18 - span: 30 + span: 96 + span: 22 + span: 34 } location: { path: 4 @@ -25691,16 +25731,16 @@ file: { path: 2 path: 3 path: 3 - span: 100 - span: 33 - span: 34 + span: 96 + span: 37 + span: 38 } location: { path: 4 path: 2 path: 2 path: 4 - span: 103 + span: 99 span: 2 span: 35 leading_comments: " Optional: Additional metadata from shim\n" @@ -25711,7 +25751,7 @@ file: { path: 2 path: 4 path: 6 - span: 103 + span: 99 span: 2 span: 21 } @@ -25721,7 +25761,7 @@ file: { path: 2 path: 4 path: 1 - span: 103 + span: 99 span: 22 span: 30 } @@ -25731,10 +25771,276 @@ file: { path: 2 path: 4 path: 3 - span: 103 + span: 99 span: 33 span: 34 } + location: { + path: 5 + path: 0 + span: 104 + span: 0 + span: 112 + span: 1 + leading_comments: " LogLevel defines log verbosity levels independent of any specific\n logging library.\n" + } + location: { + path: 5 + path: 0 + path: 1 + span: 104 + span: 5 + span: 13 + } + location: { + path: 5 + path: 0 + path: 2 + path: 0 + span: 105 + span: 2 + span: 28 + } + location: { + path: 5 + path: 0 + path: 2 + path: 0 + path: 1 + span: 105 + span: 2 + span: 23 + } + location: { + path: 5 + path: 0 + path: 2 + path: 0 + path: 2 + span: 105 + span: 26 + span: 27 + } + location: { + path: 5 + path: 0 + path: 2 + path: 1 + span: 106 + span: 2 + span: 22 + } + location: { + path: 5 + path: 0 + path: 2 + path: 1 + path: 1 + span: 106 + span: 2 + span: 17 + } + location: { + path: 5 + path: 0 + path: 2 + path: 1 + path: 2 + span: 106 + span: 20 + span: 21 + } + location: { + path: 5 + path: 0 + path: 2 + path: 2 + span: 107 + span: 2 + span: 22 + } + location: { + path: 5 + path: 0 + path: 2 + path: 2 + path: 1 + span: 107 + span: 2 + span: 17 + } + location: { + path: 5 + path: 0 + path: 2 + path: 2 + path: 2 + span: 107 + span: 20 + span: 21 + } + location: { + path: 5 + path: 0 + path: 2 + path: 3 + span: 108 + span: 2 + span: 21 + } + location: { + path: 5 + path: 0 + path: 2 + path: 3 + path: 1 + span: 108 + span: 2 + span: 16 + } + location: { + path: 5 + path: 0 + path: 2 + path: 3 + path: 2 + span: 108 + span: 19 + span: 20 + } + location: { + path: 5 + path: 0 + path: 2 + path: 4 + span: 109 + span: 2 + span: 21 + } + location: { + path: 5 + path: 0 + path: 2 + path: 4 + path: 1 + span: 109 + span: 2 + span: 16 + } + location: { + path: 5 + path: 0 + path: 2 + path: 4 + path: 2 + span: 109 + span: 19 + span: 20 + } + location: { + path: 5 + path: 0 + path: 2 + path: 5 + span: 110 + span: 2 + span: 22 + } + location: { + path: 5 + path: 0 + path: 2 + path: 5 + path: 1 + span: 110 + span: 2 + span: 17 + } + location: { + path: 5 + path: 0 + path: 2 + path: 5 + path: 2 + span: 110 + span: 20 + span: 21 + } + location: { + path: 5 + path: 0 + path: 2 + path: 6 + span: 111 + span: 2 + span: 22 + } + location: { + path: 5 + path: 0 + path: 2 + path: 6 + path: 1 + span: 111 + span: 2 + span: 17 + } + location: { + path: 5 + path: 0 + path: 2 + path: 6 + path: 2 + span: 111 + span: 20 + span: 21 + } + location: { + path: 5 + path: 1 + span: 116 + span: 0 + span: 118 + span: 1 + leading_comments: " Capability defines optional features that can be negotiated between\n containerd and shims.\n" + } + location: { + path: 5 + path: 1 + path: 1 + span: 116 + span: 5 + span: 15 + } + location: { + path: 5 + path: 1 + path: 2 + path: 0 + span: 117 + span: 2 + span: 29 + } + location: { + path: 5 + path: 1 + path: 2 + path: 0 + path: 1 + span: 117 + span: 2 + span: 24 + } + location: { + path: 5 + path: 1 + path: 2 + path: 0 + path: 2 + span: 117 + span: 27 + span: 28 + } } syntax: "proto3" buf_extension: { diff --git a/api/runtime/bootstrap/v1/bootstrap.pb.go b/api/runtime/bootstrap/v1/bootstrap.pb.go index 476f026ccdf11..87d51cc7c2675 100644 --- a/api/runtime/bootstrap/v1/bootstrap.pb.go +++ b/api/runtime/bootstrap/v1/bootstrap.pb.go @@ -25,11 +25,6 @@ // 3. shim initializes and writes BootstrapResult as JSON to stdout // 4. containerd connects to the address provided in BootstrapResult // -// Note: JSON serialization is used to keep shim binaries small since the -// encoding/json package is already part of the Go runtime. The proto -// definition serves as the schema for detecting breaking changes and -// maintaining forward/backward compatibility. -// // This design enables: // - Forward/backward compatibility via version field // - Typed extensibility via google.protobuf.Any and Extension @@ -58,6 +53,114 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +// LogLevel defines log verbosity levels independent of any specific +// logging library. +type LogLevel int32 + +const ( + LogLevel_LOG_LEVEL_UNSPECIFIED LogLevel = 0 + LogLevel_LOG_LEVEL_TRACE LogLevel = 1 + LogLevel_LOG_LEVEL_DEBUG LogLevel = 2 + LogLevel_LOG_LEVEL_INFO LogLevel = 3 + LogLevel_LOG_LEVEL_WARN LogLevel = 4 + LogLevel_LOG_LEVEL_ERROR LogLevel = 5 + LogLevel_LOG_LEVEL_FATAL LogLevel = 6 +) + +// Enum value maps for LogLevel. +var ( + LogLevel_name = map[int32]string{ + 0: "LOG_LEVEL_UNSPECIFIED", + 1: "LOG_LEVEL_TRACE", + 2: "LOG_LEVEL_DEBUG", + 3: "LOG_LEVEL_INFO", + 4: "LOG_LEVEL_WARN", + 5: "LOG_LEVEL_ERROR", + 6: "LOG_LEVEL_FATAL", + } + LogLevel_value = map[string]int32{ + "LOG_LEVEL_UNSPECIFIED": 0, + "LOG_LEVEL_TRACE": 1, + "LOG_LEVEL_DEBUG": 2, + "LOG_LEVEL_INFO": 3, + "LOG_LEVEL_WARN": 4, + "LOG_LEVEL_ERROR": 5, + "LOG_LEVEL_FATAL": 6, + } +) + +func (x LogLevel) Enum() *LogLevel { + p := new(LogLevel) + *p = x + return p +} + +func (x LogLevel) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (LogLevel) Descriptor() protoreflect.EnumDescriptor { + return file_runtime_bootstrap_v1_bootstrap_proto_enumTypes[0].Descriptor() +} + +func (LogLevel) Type() protoreflect.EnumType { + return &file_runtime_bootstrap_v1_bootstrap_proto_enumTypes[0] +} + +func (x LogLevel) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use LogLevel.Descriptor instead. +func (LogLevel) EnumDescriptor() ([]byte, []int) { + return file_runtime_bootstrap_v1_bootstrap_proto_rawDescGZIP(), []int{0} +} + +// Capability defines optional features that can be negotiated between +// containerd and shims. +type Capability int32 + +const ( + Capability_CAPABILITY_UNSPECIFIED Capability = 0 +) + +// Enum value maps for Capability. +var ( + Capability_name = map[int32]string{ + 0: "CAPABILITY_UNSPECIFIED", + } + Capability_value = map[string]int32{ + "CAPABILITY_UNSPECIFIED": 0, + } +) + +func (x Capability) Enum() *Capability { + p := new(Capability) + *p = x + return p +} + +func (x Capability) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Capability) Descriptor() protoreflect.EnumDescriptor { + return file_runtime_bootstrap_v1_bootstrap_proto_enumTypes[1].Descriptor() +} + +func (Capability) Type() protoreflect.EnumType { + return &file_runtime_bootstrap_v1_bootstrap_proto_enumTypes[1] +} + +func (x Capability) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Capability.Descriptor instead. +func (Capability) EnumDescriptor() ([]byte, []int) { + return file_runtime_bootstrap_v1_bootstrap_proto_rawDescGZIP(), []int{1} +} + // BootstrapParams contains all configuration passed from containerd to shim at startup. type BootstrapParams struct { state protoimpl.MessageState @@ -69,7 +172,7 @@ type BootstrapParams struct { // Namespace for the container Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"` // Requested shim log level. - LogLevel string `protobuf:"bytes,3,opt,name=log_level,json=logLevel,proto3" json:"log_level,omitempty"` + LogLevel LogLevel `protobuf:"varint,3,opt,name=log_level,json=logLevel,proto3,enum=containerd.runtime.bootstrap.v1.LogLevel" json:"log_level,omitempty"` // containerd daemon version that is launching this shim. ContainerdVersion string `protobuf:"bytes,4,opt,name=containerd_version,json=containerdVersion,proto3" json:"containerd_version,omitempty"` // Containerd's TTRPC API address (e.g., "unix:///run/containerd/containerd.sock.ttrpc") @@ -130,11 +233,11 @@ func (x *BootstrapParams) GetNamespace() string { return "" } -func (x *BootstrapParams) GetLogLevel() string { +func (x *BootstrapParams) GetLogLevel() LogLevel { if x != nil { return x.LogLevel } - return "" + return LogLevel_LOG_LEVEL_UNSPECIFIED } func (x *BootstrapParams) GetContainerdVersion() string { @@ -239,9 +342,10 @@ type BootstrapResult struct { Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` // Protocol used by shim: "ttrpc" or "grpc" Protocol string `protobuf:"bytes,3,opt,name=protocol,proto3" json:"protocol,omitempty"` - // Optional: Capabilities supported by this shim instance - // Allows shim to advertise what features it supports - Capabilities []string `protobuf:"bytes,4,rep,name=capabilities,proto3" json:"capabilities,omitempty"` + // Optional: Capabilities supported by this shim instance. + // Reserved for future use to allow optional capability negotiation + // between the daemon and shim. + Capabilities []Capability `protobuf:"varint,4,rep,packed,name=capabilities,proto3,enum=containerd.runtime.bootstrap.v1.Capability" json:"capabilities,omitempty"` // Optional: Additional metadata from shim Metadata map[string]string `protobuf:"bytes,5,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } @@ -299,7 +403,7 @@ func (x *BootstrapResult) GetProtocol() string { return "" } -func (x *BootstrapResult) GetCapabilities() []string { +func (x *BootstrapResult) GetCapabilities() []Capability { if x != nil { return x.Capabilities } @@ -322,58 +426,76 @@ var file_runtime_bootstrap_v1_bootstrap_proto_rawDesc = []byte{ 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0x87, 0x03, 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, + 0x74, 0x6f, 0x22, 0xb2, 0x03, 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, - 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6c, 0x6f, 0x67, 0x5f, 0x6c, 0x65, 0x76, - 0x65, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x6f, 0x67, 0x4c, 0x65, 0x76, - 0x65, 0x6c, 0x12, 0x2d, 0x0a, 0x12, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, - 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, - 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x12, 0x38, 0x0a, 0x18, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, - 0x74, 0x74, 0x72, 0x70, 0x63, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x16, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x54, - 0x74, 0x72, 0x70, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x36, 0x0a, 0x17, 0x63, - 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x61, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x47, 0x72, 0x70, 0x63, 0x41, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, - 0x64, 0x5f, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, - 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x79, - 0x12, 0x4a, 0x0a, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, - 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, - 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x52, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x37, 0x0a, 0x09, - 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x9e, 0x02, 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, - 0x72, 0x61, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1a, 0x0a, - 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x61, 0x70, - 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, - 0x0c, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x5a, 0x0a, - 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x3e, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, + 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x46, 0x0a, 0x09, 0x6c, 0x6f, 0x67, 0x5f, 0x6c, 0x65, 0x76, + 0x65, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x29, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, + 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x67, 0x4c, 0x65, + 0x76, 0x65, 0x6c, 0x52, 0x08, 0x6c, 0x6f, 0x67, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x2d, 0x0a, + 0x12, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x64, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x38, 0x0a, 0x18, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, 0x74, 0x74, 0x72, 0x70, 0x63, + 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x16, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x54, 0x74, 0x72, 0x70, 0x63, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x36, 0x0a, 0x17, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, + 0x6e, 0x65, 0x72, 0x64, 0x5f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, + 0x65, 0x72, 0x64, 0x47, 0x72, 0x70, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2b, + 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, 0x62, 0x69, 0x6e, + 0x61, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x64, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x12, 0x4a, 0x0a, 0x0a, 0x65, + 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x2a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, - 0x31, 0x2e, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, - 0x74, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, - 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x45, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, - 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, - 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, - 0x2f, 0x76, 0x31, 0x3b, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x31, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x65, 0x78, 0x74, + 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x37, 0x0a, 0x09, 0x45, 0x78, 0x74, 0x65, 0x6e, + 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x22, 0xcb, 0x02, 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x52, 0x65, + 0x73, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x18, + 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x4f, 0x0a, 0x0c, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, + 0x74, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x63, 0x6f, 0x6e, + 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, + 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x61, 0x70, + 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x0c, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, + 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x5a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3e, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, + 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, + 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, + 0x72, 0x61, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x2a, 0xa1, + 0x01, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x19, 0x0a, 0x15, 0x4c, + 0x4f, 0x47, 0x5f, 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, + 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x4c, 0x4f, 0x47, 0x5f, 0x4c, 0x45, + 0x56, 0x45, 0x4c, 0x5f, 0x54, 0x52, 0x41, 0x43, 0x45, 0x10, 0x01, 0x12, 0x13, 0x0a, 0x0f, 0x4c, + 0x4f, 0x47, 0x5f, 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x44, 0x45, 0x42, 0x55, 0x47, 0x10, 0x02, + 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x4f, 0x47, 0x5f, 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x49, 0x4e, + 0x46, 0x4f, 0x10, 0x03, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x4f, 0x47, 0x5f, 0x4c, 0x45, 0x56, 0x45, + 0x4c, 0x5f, 0x57, 0x41, 0x52, 0x4e, 0x10, 0x04, 0x12, 0x13, 0x0a, 0x0f, 0x4c, 0x4f, 0x47, 0x5f, + 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x05, 0x12, 0x13, 0x0a, + 0x0f, 0x4c, 0x4f, 0x47, 0x5f, 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x46, 0x41, 0x54, 0x41, 0x4c, + 0x10, 0x06, 0x2a, 0x28, 0x0a, 0x0a, 0x43, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, + 0x12, 0x1a, 0x0a, 0x16, 0x43, 0x41, 0x50, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x55, + 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x42, 0x45, 0x5a, 0x43, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x62, 0x6f, 0x6f, + 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2f, 0x76, 0x31, 0x3b, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, + 0x72, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -388,23 +510,28 @@ func file_runtime_bootstrap_v1_bootstrap_proto_rawDescGZIP() []byte { return file_runtime_bootstrap_v1_bootstrap_proto_rawDescData } +var file_runtime_bootstrap_v1_bootstrap_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_runtime_bootstrap_v1_bootstrap_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_runtime_bootstrap_v1_bootstrap_proto_goTypes = []interface{}{ - (*BootstrapParams)(nil), // 0: containerd.runtime.bootstrap.v1.BootstrapParams - (*Extension)(nil), // 1: containerd.runtime.bootstrap.v1.Extension - (*BootstrapResult)(nil), // 2: containerd.runtime.bootstrap.v1.BootstrapResult - nil, // 3: containerd.runtime.bootstrap.v1.BootstrapResult.MetadataEntry - (*anypb.Any)(nil), // 4: google.protobuf.Any + (LogLevel)(0), // 0: containerd.runtime.bootstrap.v1.LogLevel + (Capability)(0), // 1: containerd.runtime.bootstrap.v1.Capability + (*BootstrapParams)(nil), // 2: containerd.runtime.bootstrap.v1.BootstrapParams + (*Extension)(nil), // 3: containerd.runtime.bootstrap.v1.Extension + (*BootstrapResult)(nil), // 4: containerd.runtime.bootstrap.v1.BootstrapResult + nil, // 5: containerd.runtime.bootstrap.v1.BootstrapResult.MetadataEntry + (*anypb.Any)(nil), // 6: google.protobuf.Any } var file_runtime_bootstrap_v1_bootstrap_proto_depIdxs = []int32{ - 1, // 0: containerd.runtime.bootstrap.v1.BootstrapParams.extensions:type_name -> containerd.runtime.bootstrap.v1.Extension - 4, // 1: containerd.runtime.bootstrap.v1.Extension.value:type_name -> google.protobuf.Any - 3, // 2: containerd.runtime.bootstrap.v1.BootstrapResult.metadata:type_name -> containerd.runtime.bootstrap.v1.BootstrapResult.MetadataEntry - 3, // [3:3] is the sub-list for method output_type - 3, // [3:3] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name + 0, // 0: containerd.runtime.bootstrap.v1.BootstrapParams.log_level:type_name -> containerd.runtime.bootstrap.v1.LogLevel + 3, // 1: containerd.runtime.bootstrap.v1.BootstrapParams.extensions:type_name -> containerd.runtime.bootstrap.v1.Extension + 6, // 2: containerd.runtime.bootstrap.v1.Extension.value:type_name -> google.protobuf.Any + 1, // 3: containerd.runtime.bootstrap.v1.BootstrapResult.capabilities:type_name -> containerd.runtime.bootstrap.v1.Capability + 5, // 4: containerd.runtime.bootstrap.v1.BootstrapResult.metadata:type_name -> containerd.runtime.bootstrap.v1.BootstrapResult.MetadataEntry + 5, // [5:5] is the sub-list for method output_type + 5, // [5:5] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name } func init() { file_runtime_bootstrap_v1_bootstrap_proto_init() } @@ -455,13 +582,14 @@ func file_runtime_bootstrap_v1_bootstrap_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_runtime_bootstrap_v1_bootstrap_proto_rawDesc, - NumEnums: 0, + NumEnums: 2, NumMessages: 4, NumExtensions: 0, NumServices: 0, }, GoTypes: file_runtime_bootstrap_v1_bootstrap_proto_goTypes, DependencyIndexes: file_runtime_bootstrap_v1_bootstrap_proto_depIdxs, + EnumInfos: file_runtime_bootstrap_v1_bootstrap_proto_enumTypes, MessageInfos: file_runtime_bootstrap_v1_bootstrap_proto_msgTypes, }.Build() File_runtime_bootstrap_v1_bootstrap_proto = out.File diff --git a/api/runtime/bootstrap/v1/bootstrap.proto b/api/runtime/bootstrap/v1/bootstrap.proto index c90aecc761dbb..1c46345192134 100644 --- a/api/runtime/bootstrap/v1/bootstrap.proto +++ b/api/runtime/bootstrap/v1/bootstrap.proto @@ -48,7 +48,7 @@ message BootstrapParams { string namespace = 2; // Requested shim log level. - string log_level = 3; + LogLevel log_level = 3; // containerd daemon version that is launching this shim. string containerd_version = 4; @@ -91,10 +91,29 @@ message BootstrapResult { // Protocol used by shim: "ttrpc" or "grpc" string protocol = 3; - // Optional: Capabilities supported by this shim instance - // Allows shim to advertise what features it supports - repeated string capabilities = 4; + // Optional: Capabilities supported by this shim instance. + // Reserved for future use to allow optional capability negotiation + // between the daemon and shim. + repeated Capability capabilities = 4; // Optional: Additional metadata from shim map metadata = 5; } + +// LogLevel defines log verbosity levels independent of any specific +// logging library. +enum LogLevel { + LOG_LEVEL_UNSPECIFIED = 0; + LOG_LEVEL_TRACE = 1; + LOG_LEVEL_DEBUG = 2; + LOG_LEVEL_INFO = 3; + LOG_LEVEL_WARN = 4; + LOG_LEVEL_ERROR = 5; + LOG_LEVEL_FATAL = 6; +} + +// Capability defines optional features that can be negotiated between +// containerd and shims. +enum Capability { + CAPABILITY_UNSPECIFIED = 0; +} diff --git a/api/runtime/bootstrap/v1/helpers.go b/api/runtime/bootstrap/v1/helpers.go index e8ce0350be159..f7dad0cdda555 100644 --- a/api/runtime/bootstrap/v1/helpers.go +++ b/api/runtime/bootstrap/v1/helpers.go @@ -23,6 +23,27 @@ import ( "google.golang.org/protobuf/types/known/anypb" ) +// LogLevelFromLogrus converts a logrus log level string (e.g. "debug", "info") +// to a LogLevel enum value. Returns LOG_LEVEL_UNSPECIFIED for unrecognized strings. +func LogLevelFromLogrus(s string) LogLevel { + switch s { + case "trace": + return LogLevel_LOG_LEVEL_TRACE + case "debug": + return LogLevel_LOG_LEVEL_DEBUG + case "info": + return LogLevel_LOG_LEVEL_INFO + case "warn", "warning": + return LogLevel_LOG_LEVEL_WARN + case "error": + return LogLevel_LOG_LEVEL_ERROR + case "fatal": + return LogLevel_LOG_LEVEL_FATAL + default: + return LogLevel_LOG_LEVEL_UNSPECIFIED + } +} + // AddExtension adds a new extension to the BootstrapParams. // The message is wrapped in a google.protobuf.Any with its type URL automatically set. // If the message is already an *anypb.Any, it is used directly without double-wrapping. diff --git a/cmd/containerd-shim-runc-v2/manager/manager_linux.go b/cmd/containerd-shim-runc-v2/manager/manager_linux.go index c95fd2c5fdf6e..34c580f5d0cc6 100644 --- a/cmd/containerd-shim-runc-v2/manager/manager_linux.go +++ b/cmd/containerd-shim-runc-v2/manager/manager_linux.go @@ -49,7 +49,6 @@ import ( "github.com/containerd/log" "github.com/containerd/typeurl/v2" "github.com/opencontainers/runtime-spec/specs-go/features" - "github.com/sirupsen/logrus" "golang.org/x/sys/unix" ) @@ -190,8 +189,7 @@ func (manager) Start(ctx context.Context, opts *bootapi.BootstrapParams) (_ *boo id := opts.GetInstanceID() - lvl, _ := logrus.ParseLevel(opts.LogLevel) - debugLog := lvl == log.DebugLevel || lvl == log.TraceLevel + debugLog := opts.LogLevel == bootapi.LogLevel_LOG_LEVEL_DEBUG || opts.LogLevel == bootapi.LogLevel_LOG_LEVEL_TRACE cmd, err := newCommand(ctx, id, opts.GetContainerdGrpcAddress(), opts.GetContainerdTtrpcAddress(), debugLog) if err != nil { diff --git a/pkg/shim/compat.go b/pkg/shim/compat.go index 3617d00b0267a..86dcae8f81492 100644 --- a/pkg/shim/compat.go +++ b/pkg/shim/compat.go @@ -28,7 +28,6 @@ import ( bootapi "github.com/containerd/containerd/api/runtime/bootstrap/v1" "github.com/containerd/containerd/api/types/runc/options" - "github.com/containerd/log" ) func readBootstrapParamsFromDeprecatedFields(input []byte, params *bootapi.BootstrapParams) error { @@ -39,7 +38,7 @@ func readBootstrapParamsFromDeprecatedFields(input []byte, params *bootapi.Boots params.ContainerdBinary = containerdBinaryFlag if debugFlag { - params.LogLevel = log.DebugLevel.String() + params.LogLevel = bootapi.LogLevel_LOG_LEVEL_DEBUG } // Task options diff --git a/pkg/shim/deprecated.go b/pkg/shim/deprecated.go index 0596d2e04350b..3192c61b1d88d 100644 --- a/pkg/shim/deprecated.go +++ b/pkg/shim/deprecated.go @@ -71,7 +71,7 @@ func (m *managerShim) Start(ctx context.Context, params *bootapi.BootstrapParams opts := StartOpts{ Address: params.ContainerdGrpcAddress, TTRPCAddress: params.ContainerdTtrpcAddress, - Debug: params.LogLevel == "debug" || params.LogLevel == "trace", + Debug: params.LogLevel == bootapi.LogLevel_LOG_LEVEL_DEBUG || params.LogLevel == bootapi.LogLevel_LOG_LEVEL_TRACE, } bp, err := m.manager.Start(ctx, params.InstanceID, opts) diff --git a/pkg/shim/util.go b/pkg/shim/util.go index c51166d9e188f..6d139004bdb8d 100644 --- a/pkg/shim/util.go +++ b/pkg/shim/util.go @@ -127,7 +127,7 @@ func Command(ctx context.Context, config *CommandConfig) (*exec.Cmd, error) { params := bootapi.BootstrapParams{ InstanceID: config.ID, Namespace: ns, - LogLevel: config.LogLevel.String(), + LogLevel: bootapi.LogLevelFromLogrus(config.LogLevel.String()), ContainerdVersion: version.Version, ContainerdGrpcAddress: config.GRPCAddress, ContainerdTtrpcAddress: config.TTRPCAddress, diff --git a/vendor/github.com/containerd/containerd/api/runtime/bootstrap/v1/bootstrap.pb.go b/vendor/github.com/containerd/containerd/api/runtime/bootstrap/v1/bootstrap.pb.go index 476f026ccdf11..87d51cc7c2675 100644 --- a/vendor/github.com/containerd/containerd/api/runtime/bootstrap/v1/bootstrap.pb.go +++ b/vendor/github.com/containerd/containerd/api/runtime/bootstrap/v1/bootstrap.pb.go @@ -25,11 +25,6 @@ // 3. shim initializes and writes BootstrapResult as JSON to stdout // 4. containerd connects to the address provided in BootstrapResult // -// Note: JSON serialization is used to keep shim binaries small since the -// encoding/json package is already part of the Go runtime. The proto -// definition serves as the schema for detecting breaking changes and -// maintaining forward/backward compatibility. -// // This design enables: // - Forward/backward compatibility via version field // - Typed extensibility via google.protobuf.Any and Extension @@ -58,6 +53,114 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +// LogLevel defines log verbosity levels independent of any specific +// logging library. +type LogLevel int32 + +const ( + LogLevel_LOG_LEVEL_UNSPECIFIED LogLevel = 0 + LogLevel_LOG_LEVEL_TRACE LogLevel = 1 + LogLevel_LOG_LEVEL_DEBUG LogLevel = 2 + LogLevel_LOG_LEVEL_INFO LogLevel = 3 + LogLevel_LOG_LEVEL_WARN LogLevel = 4 + LogLevel_LOG_LEVEL_ERROR LogLevel = 5 + LogLevel_LOG_LEVEL_FATAL LogLevel = 6 +) + +// Enum value maps for LogLevel. +var ( + LogLevel_name = map[int32]string{ + 0: "LOG_LEVEL_UNSPECIFIED", + 1: "LOG_LEVEL_TRACE", + 2: "LOG_LEVEL_DEBUG", + 3: "LOG_LEVEL_INFO", + 4: "LOG_LEVEL_WARN", + 5: "LOG_LEVEL_ERROR", + 6: "LOG_LEVEL_FATAL", + } + LogLevel_value = map[string]int32{ + "LOG_LEVEL_UNSPECIFIED": 0, + "LOG_LEVEL_TRACE": 1, + "LOG_LEVEL_DEBUG": 2, + "LOG_LEVEL_INFO": 3, + "LOG_LEVEL_WARN": 4, + "LOG_LEVEL_ERROR": 5, + "LOG_LEVEL_FATAL": 6, + } +) + +func (x LogLevel) Enum() *LogLevel { + p := new(LogLevel) + *p = x + return p +} + +func (x LogLevel) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (LogLevel) Descriptor() protoreflect.EnumDescriptor { + return file_runtime_bootstrap_v1_bootstrap_proto_enumTypes[0].Descriptor() +} + +func (LogLevel) Type() protoreflect.EnumType { + return &file_runtime_bootstrap_v1_bootstrap_proto_enumTypes[0] +} + +func (x LogLevel) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use LogLevel.Descriptor instead. +func (LogLevel) EnumDescriptor() ([]byte, []int) { + return file_runtime_bootstrap_v1_bootstrap_proto_rawDescGZIP(), []int{0} +} + +// Capability defines optional features that can be negotiated between +// containerd and shims. +type Capability int32 + +const ( + Capability_CAPABILITY_UNSPECIFIED Capability = 0 +) + +// Enum value maps for Capability. +var ( + Capability_name = map[int32]string{ + 0: "CAPABILITY_UNSPECIFIED", + } + Capability_value = map[string]int32{ + "CAPABILITY_UNSPECIFIED": 0, + } +) + +func (x Capability) Enum() *Capability { + p := new(Capability) + *p = x + return p +} + +func (x Capability) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Capability) Descriptor() protoreflect.EnumDescriptor { + return file_runtime_bootstrap_v1_bootstrap_proto_enumTypes[1].Descriptor() +} + +func (Capability) Type() protoreflect.EnumType { + return &file_runtime_bootstrap_v1_bootstrap_proto_enumTypes[1] +} + +func (x Capability) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Capability.Descriptor instead. +func (Capability) EnumDescriptor() ([]byte, []int) { + return file_runtime_bootstrap_v1_bootstrap_proto_rawDescGZIP(), []int{1} +} + // BootstrapParams contains all configuration passed from containerd to shim at startup. type BootstrapParams struct { state protoimpl.MessageState @@ -69,7 +172,7 @@ type BootstrapParams struct { // Namespace for the container Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"` // Requested shim log level. - LogLevel string `protobuf:"bytes,3,opt,name=log_level,json=logLevel,proto3" json:"log_level,omitempty"` + LogLevel LogLevel `protobuf:"varint,3,opt,name=log_level,json=logLevel,proto3,enum=containerd.runtime.bootstrap.v1.LogLevel" json:"log_level,omitempty"` // containerd daemon version that is launching this shim. ContainerdVersion string `protobuf:"bytes,4,opt,name=containerd_version,json=containerdVersion,proto3" json:"containerd_version,omitempty"` // Containerd's TTRPC API address (e.g., "unix:///run/containerd/containerd.sock.ttrpc") @@ -130,11 +233,11 @@ func (x *BootstrapParams) GetNamespace() string { return "" } -func (x *BootstrapParams) GetLogLevel() string { +func (x *BootstrapParams) GetLogLevel() LogLevel { if x != nil { return x.LogLevel } - return "" + return LogLevel_LOG_LEVEL_UNSPECIFIED } func (x *BootstrapParams) GetContainerdVersion() string { @@ -239,9 +342,10 @@ type BootstrapResult struct { Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` // Protocol used by shim: "ttrpc" or "grpc" Protocol string `protobuf:"bytes,3,opt,name=protocol,proto3" json:"protocol,omitempty"` - // Optional: Capabilities supported by this shim instance - // Allows shim to advertise what features it supports - Capabilities []string `protobuf:"bytes,4,rep,name=capabilities,proto3" json:"capabilities,omitempty"` + // Optional: Capabilities supported by this shim instance. + // Reserved for future use to allow optional capability negotiation + // between the daemon and shim. + Capabilities []Capability `protobuf:"varint,4,rep,packed,name=capabilities,proto3,enum=containerd.runtime.bootstrap.v1.Capability" json:"capabilities,omitempty"` // Optional: Additional metadata from shim Metadata map[string]string `protobuf:"bytes,5,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } @@ -299,7 +403,7 @@ func (x *BootstrapResult) GetProtocol() string { return "" } -func (x *BootstrapResult) GetCapabilities() []string { +func (x *BootstrapResult) GetCapabilities() []Capability { if x != nil { return x.Capabilities } @@ -322,58 +426,76 @@ var file_runtime_bootstrap_v1_bootstrap_proto_rawDesc = []byte{ 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0x87, 0x03, 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, + 0x74, 0x6f, 0x22, 0xb2, 0x03, 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, - 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6c, 0x6f, 0x67, 0x5f, 0x6c, 0x65, 0x76, - 0x65, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x6f, 0x67, 0x4c, 0x65, 0x76, - 0x65, 0x6c, 0x12, 0x2d, 0x0a, 0x12, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, - 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, - 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x12, 0x38, 0x0a, 0x18, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, - 0x74, 0x74, 0x72, 0x70, 0x63, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x16, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x54, - 0x74, 0x72, 0x70, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x36, 0x0a, 0x17, 0x63, - 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x61, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x47, 0x72, 0x70, 0x63, 0x41, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, - 0x64, 0x5f, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, - 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x79, - 0x12, 0x4a, 0x0a, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, - 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, - 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x52, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x37, 0x0a, 0x09, - 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x9e, 0x02, 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, - 0x72, 0x61, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1a, 0x0a, - 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x61, 0x70, - 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, - 0x0c, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x5a, 0x0a, - 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x3e, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, + 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x46, 0x0a, 0x09, 0x6c, 0x6f, 0x67, 0x5f, 0x6c, 0x65, 0x76, + 0x65, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x29, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, + 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x67, 0x4c, 0x65, + 0x76, 0x65, 0x6c, 0x52, 0x08, 0x6c, 0x6f, 0x67, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x2d, 0x0a, + 0x12, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x64, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x38, 0x0a, 0x18, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, 0x74, 0x74, 0x72, 0x70, 0x63, + 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x16, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x54, 0x74, 0x72, 0x70, 0x63, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x36, 0x0a, 0x17, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, + 0x6e, 0x65, 0x72, 0x64, 0x5f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, + 0x65, 0x72, 0x64, 0x47, 0x72, 0x70, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2b, + 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x5f, 0x62, 0x69, 0x6e, + 0x61, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x64, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x12, 0x4a, 0x0a, 0x0a, 0x65, + 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x2a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, - 0x31, 0x2e, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, - 0x74, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, - 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x45, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, - 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, - 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, - 0x2f, 0x76, 0x31, 0x3b, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x31, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x65, 0x78, 0x74, + 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x37, 0x0a, 0x09, 0x45, 0x78, 0x74, 0x65, 0x6e, + 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x22, 0xcb, 0x02, 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x52, 0x65, + 0x73, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x18, + 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x4f, 0x0a, 0x0c, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, + 0x74, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x63, 0x6f, 0x6e, + 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, + 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x61, 0x70, + 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x0c, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, + 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x5a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3e, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, + 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x62, 0x6f, 0x6f, + 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, + 0x72, 0x61, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x2a, 0xa1, + 0x01, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x19, 0x0a, 0x15, 0x4c, + 0x4f, 0x47, 0x5f, 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, + 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x4c, 0x4f, 0x47, 0x5f, 0x4c, 0x45, + 0x56, 0x45, 0x4c, 0x5f, 0x54, 0x52, 0x41, 0x43, 0x45, 0x10, 0x01, 0x12, 0x13, 0x0a, 0x0f, 0x4c, + 0x4f, 0x47, 0x5f, 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x44, 0x45, 0x42, 0x55, 0x47, 0x10, 0x02, + 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x4f, 0x47, 0x5f, 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x49, 0x4e, + 0x46, 0x4f, 0x10, 0x03, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x4f, 0x47, 0x5f, 0x4c, 0x45, 0x56, 0x45, + 0x4c, 0x5f, 0x57, 0x41, 0x52, 0x4e, 0x10, 0x04, 0x12, 0x13, 0x0a, 0x0f, 0x4c, 0x4f, 0x47, 0x5f, + 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x05, 0x12, 0x13, 0x0a, + 0x0f, 0x4c, 0x4f, 0x47, 0x5f, 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x46, 0x41, 0x54, 0x41, 0x4c, + 0x10, 0x06, 0x2a, 0x28, 0x0a, 0x0a, 0x43, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, + 0x12, 0x1a, 0x0a, 0x16, 0x43, 0x41, 0x50, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x55, + 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x42, 0x45, 0x5a, 0x43, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x62, 0x6f, 0x6f, + 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2f, 0x76, 0x31, 0x3b, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, + 0x72, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -388,23 +510,28 @@ func file_runtime_bootstrap_v1_bootstrap_proto_rawDescGZIP() []byte { return file_runtime_bootstrap_v1_bootstrap_proto_rawDescData } +var file_runtime_bootstrap_v1_bootstrap_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_runtime_bootstrap_v1_bootstrap_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_runtime_bootstrap_v1_bootstrap_proto_goTypes = []interface{}{ - (*BootstrapParams)(nil), // 0: containerd.runtime.bootstrap.v1.BootstrapParams - (*Extension)(nil), // 1: containerd.runtime.bootstrap.v1.Extension - (*BootstrapResult)(nil), // 2: containerd.runtime.bootstrap.v1.BootstrapResult - nil, // 3: containerd.runtime.bootstrap.v1.BootstrapResult.MetadataEntry - (*anypb.Any)(nil), // 4: google.protobuf.Any + (LogLevel)(0), // 0: containerd.runtime.bootstrap.v1.LogLevel + (Capability)(0), // 1: containerd.runtime.bootstrap.v1.Capability + (*BootstrapParams)(nil), // 2: containerd.runtime.bootstrap.v1.BootstrapParams + (*Extension)(nil), // 3: containerd.runtime.bootstrap.v1.Extension + (*BootstrapResult)(nil), // 4: containerd.runtime.bootstrap.v1.BootstrapResult + nil, // 5: containerd.runtime.bootstrap.v1.BootstrapResult.MetadataEntry + (*anypb.Any)(nil), // 6: google.protobuf.Any } var file_runtime_bootstrap_v1_bootstrap_proto_depIdxs = []int32{ - 1, // 0: containerd.runtime.bootstrap.v1.BootstrapParams.extensions:type_name -> containerd.runtime.bootstrap.v1.Extension - 4, // 1: containerd.runtime.bootstrap.v1.Extension.value:type_name -> google.protobuf.Any - 3, // 2: containerd.runtime.bootstrap.v1.BootstrapResult.metadata:type_name -> containerd.runtime.bootstrap.v1.BootstrapResult.MetadataEntry - 3, // [3:3] is the sub-list for method output_type - 3, // [3:3] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name + 0, // 0: containerd.runtime.bootstrap.v1.BootstrapParams.log_level:type_name -> containerd.runtime.bootstrap.v1.LogLevel + 3, // 1: containerd.runtime.bootstrap.v1.BootstrapParams.extensions:type_name -> containerd.runtime.bootstrap.v1.Extension + 6, // 2: containerd.runtime.bootstrap.v1.Extension.value:type_name -> google.protobuf.Any + 1, // 3: containerd.runtime.bootstrap.v1.BootstrapResult.capabilities:type_name -> containerd.runtime.bootstrap.v1.Capability + 5, // 4: containerd.runtime.bootstrap.v1.BootstrapResult.metadata:type_name -> containerd.runtime.bootstrap.v1.BootstrapResult.MetadataEntry + 5, // [5:5] is the sub-list for method output_type + 5, // [5:5] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name } func init() { file_runtime_bootstrap_v1_bootstrap_proto_init() } @@ -455,13 +582,14 @@ func file_runtime_bootstrap_v1_bootstrap_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_runtime_bootstrap_v1_bootstrap_proto_rawDesc, - NumEnums: 0, + NumEnums: 2, NumMessages: 4, NumExtensions: 0, NumServices: 0, }, GoTypes: file_runtime_bootstrap_v1_bootstrap_proto_goTypes, DependencyIndexes: file_runtime_bootstrap_v1_bootstrap_proto_depIdxs, + EnumInfos: file_runtime_bootstrap_v1_bootstrap_proto_enumTypes, MessageInfos: file_runtime_bootstrap_v1_bootstrap_proto_msgTypes, }.Build() File_runtime_bootstrap_v1_bootstrap_proto = out.File diff --git a/vendor/github.com/containerd/containerd/api/runtime/bootstrap/v1/bootstrap.proto b/vendor/github.com/containerd/containerd/api/runtime/bootstrap/v1/bootstrap.proto index 1cb27129f16cc..1c46345192134 100644 --- a/vendor/github.com/containerd/containerd/api/runtime/bootstrap/v1/bootstrap.proto +++ b/vendor/github.com/containerd/containerd/api/runtime/bootstrap/v1/bootstrap.proto @@ -26,11 +26,6 @@ // 3. shim initializes and writes BootstrapResult as JSON to stdout // 4. containerd connects to the address provided in BootstrapResult // -// Note: JSON serialization is used to keep shim binaries small since the -// encoding/json package is already part of the Go runtime. The proto -// definition serves as the schema for detecting breaking changes and -// maintaining forward/backward compatibility. -// // This design enables: // - Forward/backward compatibility via version field // - Typed extensibility via google.protobuf.Any and Extension @@ -53,7 +48,7 @@ message BootstrapParams { string namespace = 2; // Requested shim log level. - string log_level = 3; + LogLevel log_level = 3; // containerd daemon version that is launching this shim. string containerd_version = 4; @@ -96,10 +91,29 @@ message BootstrapResult { // Protocol used by shim: "ttrpc" or "grpc" string protocol = 3; - // Optional: Capabilities supported by this shim instance - // Allows shim to advertise what features it supports - repeated string capabilities = 4; + // Optional: Capabilities supported by this shim instance. + // Reserved for future use to allow optional capability negotiation + // between the daemon and shim. + repeated Capability capabilities = 4; // Optional: Additional metadata from shim map metadata = 5; } + +// LogLevel defines log verbosity levels independent of any specific +// logging library. +enum LogLevel { + LOG_LEVEL_UNSPECIFIED = 0; + LOG_LEVEL_TRACE = 1; + LOG_LEVEL_DEBUG = 2; + LOG_LEVEL_INFO = 3; + LOG_LEVEL_WARN = 4; + LOG_LEVEL_ERROR = 5; + LOG_LEVEL_FATAL = 6; +} + +// Capability defines optional features that can be negotiated between +// containerd and shims. +enum Capability { + CAPABILITY_UNSPECIFIED = 0; +} diff --git a/vendor/github.com/containerd/containerd/api/runtime/bootstrap/v1/helpers.go b/vendor/github.com/containerd/containerd/api/runtime/bootstrap/v1/helpers.go index e8ce0350be159..f7dad0cdda555 100644 --- a/vendor/github.com/containerd/containerd/api/runtime/bootstrap/v1/helpers.go +++ b/vendor/github.com/containerd/containerd/api/runtime/bootstrap/v1/helpers.go @@ -23,6 +23,27 @@ import ( "google.golang.org/protobuf/types/known/anypb" ) +// LogLevelFromLogrus converts a logrus log level string (e.g. "debug", "info") +// to a LogLevel enum value. Returns LOG_LEVEL_UNSPECIFIED for unrecognized strings. +func LogLevelFromLogrus(s string) LogLevel { + switch s { + case "trace": + return LogLevel_LOG_LEVEL_TRACE + case "debug": + return LogLevel_LOG_LEVEL_DEBUG + case "info": + return LogLevel_LOG_LEVEL_INFO + case "warn", "warning": + return LogLevel_LOG_LEVEL_WARN + case "error": + return LogLevel_LOG_LEVEL_ERROR + case "fatal": + return LogLevel_LOG_LEVEL_FATAL + default: + return LogLevel_LOG_LEVEL_UNSPECIFIED + } +} + // AddExtension adds a new extension to the BootstrapParams. // The message is wrapped in a google.protobuf.Any with its type URL automatically set. // If the message is already an *anypb.Any, it is used directly without double-wrapping. From 3c0e8a55b6e240045b0c80b46b93cf472e5aa738 Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Thu, 19 Mar 2026 10:09:18 -0700 Subject: [PATCH 25/28] Update comments wording about when to deprecate and remove the old path Signed-off-by: Maksym Pavlenko --- core/runtime/v2/shim.go | 36 +++++++++++++++++------------------- pkg/shim/util.go | 8 ++++---- vendor/modules.txt | 1 + 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/core/runtime/v2/shim.go b/core/runtime/v2/shim.go index 7832444af785e..9fc84be0c607d 100644 --- a/core/runtime/v2/shim.go +++ b/core/runtime/v2/shim.go @@ -224,31 +224,29 @@ type clientVersionDowngrader interface { func parseStartResponse(response []byte) (*bootapi.BootstrapResult, error) { var result bootapi.BootstrapResult - if json.Valid(response) { - var params client.BootstrapParams - if err := json.Unmarshal(response, ¶ms); err != nil || params.Version < 2 { - // Use TTRPC for legacy shims - params.Address = string(response) - params.Protocol = "ttrpc" - params.Version = 2 - } + if err := proto.Unmarshal(response, &result); err == nil { + return &result, nil + } - if params.Version > CurrentShimVersion { - return nil, fmt.Errorf("unsupported shim version (%d): %w", params.Version, errdefs.ErrNotImplemented) - } + // Fallback to legacy parsing for backward compatibility with legacy shims that return the address as a plain string or JSON. - return &bootapi.BootstrapResult{ - Version: int32(params.Version), - Address: params.Address, - Protocol: params.Protocol, - }, nil + var params client.BootstrapParams //nolint:staticcheck // Used for backward compatibility with legacy shims + if err := json.Unmarshal(response, ¶ms); err != nil || params.Version < 2 { + // Use TTRPC for legacy shims + params.Address = string(response) + params.Protocol = "ttrpc" + params.Version = 2 } - if err := proto.Unmarshal(response, &result); err != nil { - return nil, fmt.Errorf("unable to read shim bootstrap response: %w", err) + if params.Version > CurrentShimVersion { + return nil, fmt.Errorf("unsupported shim version (%d): %w", params.Version, errdefs.ErrNotImplemented) } - return &result, nil + return &bootapi.BootstrapResult{ + Version: int32(params.Version), + Address: params.Address, + Protocol: params.Protocol, + }, nil } // writeBootstrapParams writes shim's bootstrap configuration (e.g. how to connect, version, etc). diff --git a/pkg/shim/util.go b/pkg/shim/util.go index 6d139004bdb8d..c8a8e6c217dd7 100644 --- a/pkg/shim/util.go +++ b/pkg/shim/util.go @@ -71,7 +71,7 @@ func Command(ctx context.Context, config *CommandConfig) (*exec.Cmd, error) { return nil, err } - // TODO: Deprecate this in 2.3 and remove in the next LTS in favor of Bootstrap protocol. + // TODO: Remove in a future release in favor of Bootstrap protocol. args := []string{ "-namespace", ns, "-address", config.GRPCAddress, @@ -101,7 +101,7 @@ func Command(ctx context.Context, config *CommandConfig) (*exec.Cmd, error) { os.Environ(), "GOMAXPROCS=2", fmt.Sprintf("%s=2", maxVersionEnv), - // TODO: Deprecate this in 2.3 and remove in the next LTS in favor of Bootstrap protocol. + // TODO: Remove in a future release in favor of Bootstrap protocol. fmt.Sprintf("%s=%s", ttrpcAddressEnv, config.TTRPCAddress), fmt.Sprintf("%s=%s", grpcAddressEnv, config.GRPCAddress), fmt.Sprintf("%s=%s", namespaceEnv, ns), @@ -111,9 +111,9 @@ func Command(ctx context.Context, config *CommandConfig) (*exec.Cmd, error) { } cmd.SysProcAttr = getSysProcAttr() - // Special path when upgrading from 1.7 runc v1 shims to 2.x containerd. + // Special path when upgrading from 1.7 shims to 2.x containerd. // v1 shims would fail if passed wrong stdin data. - // TODO: Deprecate and remove in the next LTS + // TODO: Remove in a future release in favor of Bootstrap protocol. if strings.Contains(config.RuntimePath, "shim-runc-v1") || strings.Contains(config.RuntimePath, "shim-runhcs-v1") { if config.Opts != nil { d, err := proto.Marshal(config.Opts) diff --git a/vendor/modules.txt b/vendor/modules.txt index 414c498791fa3..bfae9160bbb72 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -115,6 +115,7 @@ github.com/containerd/cgroups/v3/cgroup2/stats ## explicit; go 1.13 github.com/containerd/console # github.com/containerd/containerd/api v1.11.0-beta.0 => ./api +## explicit; go 1.24.0 github.com/containerd/containerd/api/events github.com/containerd/containerd/api/runtime/bootstrap/v1 github.com/containerd/containerd/api/runtime/sandbox/v1 From 45b7de2837b7c76ac6ce97efbf46c7753c5f2c9f Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Thu, 2 Apr 2026 11:42:57 -0700 Subject: [PATCH 26/28] Limit amount of bytes read from stdin Co-authored-by: Samuel Karp Signed-off-by: Maksym Pavlenko --- pkg/shim/shim.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/shim/shim.go b/pkg/shim/shim.go index 3b45e80600152..49152d44e5af5 100644 --- a/pkg/shim/shim.go +++ b/pkg/shim/shim.go @@ -273,7 +273,8 @@ func run(ctx context.Context, manager Shim, config Config) error { case "start": // We try reading stdin twice: first for the new boot API, then runc Options. // The stdin pipe is not seekable, so this should be read into memory first. - input, err := io.ReadAll(os.Stdin) + // Protect against unbounded memory consumption with a limit (e.g., 10MB). + input, err := io.ReadAll(io.LimitReader(os.Stdin, 10<<20)) if err != nil { return fmt.Errorf("failed to read stdin: %w", err) } From 16b7ce254959e62927896aecc033e86b0a10dc31 Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Thu, 2 Apr 2026 12:12:09 -0700 Subject: [PATCH 27/28] Address code review suggestions Signed-off-by: Maksym Pavlenko --- api/runtime/bootstrap/v1/helpers.go | 4 ++++ cmd/containerd-shim-runc-v2/manager/manager_linux.go | 3 ++- pkg/shim/compat.go | 10 +++++----- pkg/shim/shim.go | 4 ++-- pkg/shim/util.go | 3 ++- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/api/runtime/bootstrap/v1/helpers.go b/api/runtime/bootstrap/v1/helpers.go index f7dad0cdda555..ff95efd3cdff7 100644 --- a/api/runtime/bootstrap/v1/helpers.go +++ b/api/runtime/bootstrap/v1/helpers.go @@ -66,6 +66,10 @@ func (p *BootstrapParams) AddExtension(msg proto.Message) error { // FindExtension finds an extension matching the type of dst and unmarshals it. func (p *BootstrapParams) FindExtension(dst proto.Message) (bool, error) { + if p == nil { + return false, nil + } + name := dst.ProtoReflect().Descriptor().FullName() for _, ext := range p.Extensions { diff --git a/cmd/containerd-shim-runc-v2/manager/manager_linux.go b/cmd/containerd-shim-runc-v2/manager/manager_linux.go index 34c580f5d0cc6..40491dc1da1db 100644 --- a/cmd/containerd-shim-runc-v2/manager/manager_linux.go +++ b/cmd/containerd-shim-runc-v2/manager/manager_linux.go @@ -189,7 +189,8 @@ func (manager) Start(ctx context.Context, opts *bootapi.BootstrapParams) (_ *boo id := opts.GetInstanceID() - debugLog := opts.LogLevel == bootapi.LogLevel_LOG_LEVEL_DEBUG || opts.LogLevel == bootapi.LogLevel_LOG_LEVEL_TRACE + logLevel := opts.GetLogLevel() + debugLog := logLevel == bootapi.LogLevel_LOG_LEVEL_DEBUG || logLevel == bootapi.LogLevel_LOG_LEVEL_TRACE cmd, err := newCommand(ctx, id, opts.GetContainerdGrpcAddress(), opts.GetContainerdTtrpcAddress(), debugLog) if err != nil { diff --git a/pkg/shim/compat.go b/pkg/shim/compat.go index 86dcae8f81492..c41b2edebd10b 100644 --- a/pkg/shim/compat.go +++ b/pkg/shim/compat.go @@ -30,14 +30,14 @@ import ( "github.com/containerd/containerd/api/types/runc/options" ) -func readBootstrapParamsFromDeprecatedFields(input []byte, params *bootapi.BootstrapParams) error { - params.InstanceID = id - params.Namespace = namespaceFlag +func readBootstrapParamsFromDeprecatedFields(input []byte, params *bootapi.BootstrapParams, parsedID string, parsedNamespace string, parsedBinary string, parsedDebug bool) error { + params.InstanceID = parsedID + params.Namespace = parsedNamespace params.ContainerdTtrpcAddress = os.Getenv(ttrpcAddressEnv) params.ContainerdGrpcAddress = os.Getenv(grpcAddressEnv) - params.ContainerdBinary = containerdBinaryFlag + params.ContainerdBinary = parsedBinary - if debugFlag { + if parsedDebug { params.LogLevel = bootapi.LogLevel_LOG_LEVEL_DEBUG } diff --git a/pkg/shim/shim.go b/pkg/shim/shim.go index 49152d44e5af5..3dddd412b0fc9 100644 --- a/pkg/shim/shim.go +++ b/pkg/shim/shim.go @@ -280,9 +280,9 @@ func run(ctx context.Context, manager Shim, config Config) error { } var params bootapi.BootstrapParams - if err := proto.Unmarshal(input, ¶ms); err != nil { + if len(input) == 0 || proto.Unmarshal(input, ¶ms) != nil { // TODO: Return error once the new API is stable - if err := readBootstrapParamsFromDeprecatedFields(input, ¶ms); err != nil { + if err := readBootstrapParamsFromDeprecatedFields(input, ¶ms, id, namespaceFlag, containerdBinaryFlag, debugFlag); err != nil { return err } } diff --git a/pkg/shim/util.go b/pkg/shim/util.go index c8a8e6c217dd7..d92926db7a706 100644 --- a/pkg/shim/util.go +++ b/pkg/shim/util.go @@ -114,7 +114,8 @@ func Command(ctx context.Context, config *CommandConfig) (*exec.Cmd, error) { // Special path when upgrading from 1.7 shims to 2.x containerd. // v1 shims would fail if passed wrong stdin data. // TODO: Remove in a future release in favor of Bootstrap protocol. - if strings.Contains(config.RuntimePath, "shim-runc-v1") || strings.Contains(config.RuntimePath, "shim-runhcs-v1") { + execName := filepath.Base(config.RuntimePath) + if strings.Contains(execName, "shim-runc-v1") || strings.Contains(execName, "shim-runhcs-v1") { if config.Opts != nil { d, err := proto.Marshal(config.Opts) if err != nil { From 75afbe155a819c8e8786c2b961b4b87293dea66b Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Thu, 2 Apr 2026 12:20:46 -0700 Subject: [PATCH 28/28] Update vendor Signed-off-by: Maksym Pavlenko --- .../containerd/containerd/api/runtime/bootstrap/v1/helpers.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vendor/github.com/containerd/containerd/api/runtime/bootstrap/v1/helpers.go b/vendor/github.com/containerd/containerd/api/runtime/bootstrap/v1/helpers.go index f7dad0cdda555..ff95efd3cdff7 100644 --- a/vendor/github.com/containerd/containerd/api/runtime/bootstrap/v1/helpers.go +++ b/vendor/github.com/containerd/containerd/api/runtime/bootstrap/v1/helpers.go @@ -66,6 +66,10 @@ func (p *BootstrapParams) AddExtension(msg proto.Message) error { // FindExtension finds an extension matching the type of dst and unmarshals it. func (p *BootstrapParams) FindExtension(dst proto.Message) (bool, error) { + if p == nil { + return false, nil + } + name := dst.ProtoReflect().Descriptor().FullName() for _, ext := range p.Extensions {