From 69f3860f49987d0316b1839137ea983e5574cf22 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Apr 2026 23:24:29 +0000 Subject: [PATCH 01/29] build(deps): bump the otel group with 6 updates Bumps the otel group with 6 updates: | Package | From | To | | --- | --- | --- | | [go.opentelemetry.io/otel](https://github.com/open-telemetry/opentelemetry-go) | `1.42.0` | `1.43.0` | | [go.opentelemetry.io/otel/exporters/otlp/otlptrace](https://github.com/open-telemetry/opentelemetry-go) | `1.42.0` | `1.43.0` | | [go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc](https://github.com/open-telemetry/opentelemetry-go) | `1.42.0` | `1.43.0` | | [go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp](https://github.com/open-telemetry/opentelemetry-go) | `1.42.0` | `1.43.0` | | [go.opentelemetry.io/otel/sdk](https://github.com/open-telemetry/opentelemetry-go) | `1.42.0` | `1.43.0` | | [go.opentelemetry.io/otel/trace](https://github.com/open-telemetry/opentelemetry-go) | `1.42.0` | `1.43.0` | Updates `go.opentelemetry.io/otel` from 1.42.0 to 1.43.0 - [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.42.0...v1.43.0) Updates `go.opentelemetry.io/otel/exporters/otlp/otlptrace` from 1.42.0 to 1.43.0 - [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.42.0...v1.43.0) Updates `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc` from 1.42.0 to 1.43.0 - [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.42.0...v1.43.0) Updates `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp` from 1.42.0 to 1.43.0 - [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.42.0...v1.43.0) Updates `go.opentelemetry.io/otel/sdk` from 1.42.0 to 1.43.0 - [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.42.0...v1.43.0) Updates `go.opentelemetry.io/otel/trace` from 1.42.0 to 1.43.0 - [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.42.0...v1.43.0) --- updated-dependencies: - dependency-name: go.opentelemetry.io/otel dependency-version: 1.43.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: otel - dependency-name: go.opentelemetry.io/otel/exporters/otlp/otlptrace dependency-version: 1.43.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: otel - dependency-name: go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc dependency-version: 1.43.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: otel - dependency-name: go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp dependency-version: 1.43.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: otel - dependency-name: go.opentelemetry.io/otel/sdk dependency-version: 1.43.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: otel - dependency-name: go.opentelemetry.io/otel/trace dependency-version: 1.43.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: otel ... Signed-off-by: dependabot[bot] --- go.mod | 30 +- go.sum | 68 ++-- vendor/go.opentelemetry.io/otel/.golangci.yml | 11 + vendor/go.opentelemetry.io/otel/CHANGELOG.md | 46 ++- vendor/go.opentelemetry.io/otel/Makefile | 4 + vendor/go.opentelemetry.io/otel/RELEASING.md | 41 ++- .../otel/attribute/encoder.go | 4 +- .../otel/attribute/hash.go | 4 +- .../otel/attribute/internal/attribute.go | 103 +++--- .../go.opentelemetry.io/otel/attribute/kv.go | 2 +- .../otel/attribute/type_string.go | 6 +- .../otel/attribute/value.go | 61 +++- .../otel/dependencies.Dockerfile | 2 +- .../internal/tracetransform/attribute.go | 1 + .../otlptracegrpc/internal/version.go | 2 +- .../otlp/otlptrace/otlptracehttp/client.go | 21 +- .../otlp/otlptrace/otlptracehttp/doc.go | 5 + .../otlptracehttp/internal/version.go | 2 +- .../otel/exporters/otlp/otlptrace/version.go | 2 +- .../otel/sdk/internal/x/features.go | 15 + .../otel/sdk/resource/config.go | 8 + .../otel/sdk/resource/host_id.go | 10 +- .../otel/sdk/resource/resource.go | 19 +- .../otel/sdk/trace/batch_span_processor.go | 6 +- .../otel/sdk/trace/internal/observ/tracer.go | 8 + .../otel/sdk/trace/provider.go | 9 +- .../otel/sdk/trace/sampling.go | 36 +- .../go.opentelemetry.io/otel/sdk/version.go | 2 +- .../go.opentelemetry.io/otel/trace/trace.go | 19 + vendor/go.opentelemetry.io/otel/version.go | 2 +- vendor/go.opentelemetry.io/otel/versions.yaml | 9 +- .../proto/otlp/common/v1/common.pb.go | 145 +++++--- vendor/golang.org/x/net/http2/http2.go | 16 +- vendor/golang.org/x/net/http2/server.go | 2 + vendor/golang.org/x/net/http2/transport.go | 8 - vendor/golang.org/x/net/http2/writesched.go | 6 + .../net/http2/writesched_priority_rfc7540.go | 5 + .../x/net/http2/writesched_random.go | 2 + .../googleapis/api/httpbody/httpbody.pb.go | 2 +- .../genproto/googleapis/rpc/code/code.pb.go | 2 +- .../rpc/errdetails/error_details.pb.go | 10 +- .../googleapis/rpc/status/status.pb.go | 7 +- .../grpc/attributes/attributes.go | 77 ++-- .../grpc/balancer/balancer.go | 32 +- .../grpc/balancer/base/balancer.go | 6 +- .../endpointsharding/endpointsharding.go | 11 +- .../grpc/balancer/pickfirst/pickfirst.go | 12 +- .../grpc_binarylog_v1/binarylog.pb.go | 2 +- .../google.golang.org/grpc/credentials/tls.go | 18 +- vendor/google.golang.org/grpc/dialoptions.go | 9 +- .../grpc/health/grpc_health_v1/health.pb.go | 2 +- .../health/grpc_health_v1/health_grpc.pb.go | 2 +- .../grpc/internal/envconfig/envconfig.go | 38 +- .../grpc/internal/mem/buffer_pool.go | 338 ++++++++++++++++++ .../grpc/internal/transport/defaults.go | 1 + .../grpc/internal/transport/http2_client.go | 6 +- .../grpc/internal/transport/http2_server.go | 6 +- .../google.golang.org/grpc/mem/buffer_pool.go | 167 ++------- .../google.golang.org/grpc/picker_wrapper.go | 4 +- .../grpc_reflection_v1/reflection.pb.go | 2 +- .../grpc_reflection_v1/reflection_grpc.pb.go | 2 +- .../grpc_reflection_v1alpha/reflection.pb.go | 2 +- .../reflection_grpc.pb.go | 2 +- vendor/google.golang.org/grpc/resolver/map.go | 34 ++ vendor/google.golang.org/grpc/rpc_util.go | 22 +- vendor/google.golang.org/grpc/server.go | 1 + vendor/google.golang.org/grpc/version.go | 2 +- vendor/modules.txt | 41 +-- 68 files changed, 1108 insertions(+), 494 deletions(-) create mode 100644 vendor/google.golang.org/grpc/internal/mem/buffer_pool.go diff --git a/go.mod b/go.mod index d3cccdd70fab4..c0a2db7f95fb8 100644 --- a/go.mod +++ b/go.mod @@ -68,18 +68,18 @@ require ( go.etcd.io/bbolt v1.4.3 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.67.0 go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.67.0 - go.opentelemetry.io/otel v1.42.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.42.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.42.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.42.0 - go.opentelemetry.io/otel/sdk v1.42.0 - go.opentelemetry.io/otel/trace v1.42.0 + go.opentelemetry.io/otel v1.43.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.43.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.43.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.43.0 + go.opentelemetry.io/otel/sdk v1.43.0 + go.opentelemetry.io/otel/trace v1.43.0 golang.org/x/mod v0.34.0 golang.org/x/sync v0.20.0 golang.org/x/sys v0.42.0 golang.org/x/time v0.15.0 - google.golang.org/genproto/googleapis/rpc v0.0.0-20260226221140-a57be14db171 - google.golang.org/grpc v1.79.3 + google.golang.org/genproto/googleapis/rpc v0.0.0-20260401024825-9d38bb4040a9 + google.golang.org/grpc v1.80.0 google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af gopkg.in/inf.v0 v0.9.1 k8s.io/apimachinery v0.36.0-beta.0 @@ -142,16 +142,16 @@ require ( github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/auto/sdk v1.2.1 // indirect - go.opentelemetry.io/otel/metric v1.42.0 // indirect - go.opentelemetry.io/proto/otlp v1.9.0 // indirect + go.opentelemetry.io/otel/metric v1.43.0 // indirect + go.opentelemetry.io/proto/otlp v1.10.0 // indirect go.yaml.in/yaml/v2 v2.4.3 // indirect - golang.org/x/crypto v0.48.0 // indirect + golang.org/x/crypto v0.49.0 // indirect golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f // indirect - golang.org/x/net v0.51.0 // indirect + golang.org/x/net v0.52.0 // indirect golang.org/x/oauth2 v0.35.0 // indirect - golang.org/x/term v0.40.0 // indirect - golang.org/x/text v0.34.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20260209200024-4cfbd4190f57 // indirect + golang.org/x/term v0.41.0 // indirect + golang.org/x/text v0.35.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20260401024825-9d38bb4040a9 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/api v0.36.0-beta.0 // indirect k8s.io/kube-openapi v0.0.0-20260319004828-5883c5ee87b9 // indirect diff --git a/go.sum b/go.sum index b73a0b7eec2d4..1358c4c12c6b5 100644 --- a/go.sum +++ b/go.sum @@ -363,24 +363,24 @@ go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.6 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.67.0/go.mod h1:NoUCKYWK+3ecatC4HjkRktREheMeEtrXoQxrqYFeHSc= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.67.0 h1:OyrsyzuttWTSur2qN/Lm0m2a8yqyIjUVBZcxFPuXq2o= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.67.0/go.mod h1:C2NGBr+kAB4bk3xtMXfZ94gqFDtg/GkI7e9zqGh5Beg= -go.opentelemetry.io/otel v1.42.0 h1:lSQGzTgVR3+sgJDAU/7/ZMjN9Z+vUip7leaqBKy4sho= -go.opentelemetry.io/otel v1.42.0/go.mod h1:lJNsdRMxCUIWuMlVJWzecSMuNjE7dOYyWlqOXWkdqCc= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.42.0 h1:THuZiwpQZuHPul65w4WcwEnkX2QIuMT+UFoOrygtoJw= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.42.0/go.mod h1:J2pvYM5NGHofZ2/Ru6zw/TNWnEQp5crgyDeSrYpXkAw= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.42.0 h1:zWWrB1U6nqhS/k6zYB74CjRpuiitRtLLi68VcgmOEto= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.42.0/go.mod h1:2qXPNBX1OVRC0IwOnfo1ljoid+RD0QK3443EaqVlsOU= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.42.0 h1:uLXP+3mghfMf7XmV4PkGfFhFKuNWoCvvx5wP/wOXo0o= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.42.0/go.mod h1:v0Tj04armyT59mnURNUJf7RCKcKzq+lgJs6QSjHjaTc= -go.opentelemetry.io/otel/metric v1.42.0 h1:2jXG+3oZLNXEPfNmnpxKDeZsFI5o4J+nz6xUlaFdF/4= -go.opentelemetry.io/otel/metric v1.42.0/go.mod h1:RlUN/7vTU7Ao/diDkEpQpnz3/92J9ko05BIwxYa2SSI= -go.opentelemetry.io/otel/sdk v1.42.0 h1:LyC8+jqk6UJwdrI/8VydAq/hvkFKNHZVIWuslJXYsDo= -go.opentelemetry.io/otel/sdk v1.42.0/go.mod h1:rGHCAxd9DAph0joO4W6OPwxjNTYWghRWmkHuGbayMts= -go.opentelemetry.io/otel/sdk/metric v1.42.0 h1:D/1QR46Clz6ajyZ3G8SgNlTJKBdGp84q9RKCAZ3YGuA= -go.opentelemetry.io/otel/sdk/metric v1.42.0/go.mod h1:Ua6AAlDKdZ7tdvaQKfSmnFTdHx37+J4ba8MwVCYM5hc= -go.opentelemetry.io/otel/trace v1.42.0 h1:OUCgIPt+mzOnaUTpOQcBiM/PLQ/Op7oq6g4LenLmOYY= -go.opentelemetry.io/otel/trace v1.42.0/go.mod h1:f3K9S+IFqnumBkKhRJMeaZeNk9epyhnCmQh/EysQCdc= -go.opentelemetry.io/proto/otlp v1.9.0 h1:l706jCMITVouPOqEnii2fIAuO3IVGBRPV5ICjceRb/A= -go.opentelemetry.io/proto/otlp v1.9.0/go.mod h1:xE+Cx5E/eEHw+ISFkwPLwCZefwVjY+pqKg1qcK03+/4= +go.opentelemetry.io/otel v1.43.0 h1:mYIM03dnh5zfN7HautFE4ieIig9amkNANT+xcVxAj9I= +go.opentelemetry.io/otel v1.43.0/go.mod h1:JuG+u74mvjvcm8vj8pI5XiHy1zDeoCS2LB1spIq7Ay0= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.43.0 h1:88Y4s2C8oTui1LGM6bTWkw0ICGcOLCAI5l6zsD1j20k= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.43.0/go.mod h1:Vl1/iaggsuRlrHf/hfPJPvVag77kKyvrLeD10kpMl+A= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.43.0 h1:RAE+JPfvEmvy+0LzyUA25/SGawPwIUbZ6u0Wug54sLc= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.43.0/go.mod h1:AGmbycVGEsRx9mXMZ75CsOyhSP6MFIcj/6dnG+vhVjk= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.43.0 h1:3iZJKlCZufyRzPzlQhUIWVmfltrXuGyfjREgGP3UUjc= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.43.0/go.mod h1:/G+nUPfhq2e+qiXMGxMwumDrP5jtzU+mWN7/sjT2rak= +go.opentelemetry.io/otel/metric v1.43.0 h1:d7638QeInOnuwOONPp4JAOGfbCEpYb+K6DVWvdxGzgM= +go.opentelemetry.io/otel/metric v1.43.0/go.mod h1:RDnPtIxvqlgO8GRW18W6Z/4P462ldprJtfxHxyKd2PY= +go.opentelemetry.io/otel/sdk v1.43.0 h1:pi5mE86i5rTeLXqoF/hhiBtUNcrAGHLKQdhg4h4V9Dg= +go.opentelemetry.io/otel/sdk v1.43.0/go.mod h1:P+IkVU3iWukmiit/Yf9AWvpyRDlUeBaRg6Y+C58QHzg= +go.opentelemetry.io/otel/sdk/metric v1.43.0 h1:S88dyqXjJkuBNLeMcVPRFXpRw2fuwdvfCGLEo89fDkw= +go.opentelemetry.io/otel/sdk/metric v1.43.0/go.mod h1:C/RJtwSEJ5hzTiUz5pXF1kILHStzb9zFlIEe85bhj6A= +go.opentelemetry.io/otel/trace v1.43.0 h1:BkNrHpup+4k4w+ZZ86CZoHHEkohws8AY+WTX09nk+3A= +go.opentelemetry.io/otel/trace v1.43.0/go.mod h1:/QJhyVBUUswCphDVxq+8mld+AvhXZLhe+8WVFxiFff0= +go.opentelemetry.io/proto/otlp v1.10.0 h1:IQRWgT5srOCYfiWnpqUYz9CVmbO8bFmKcwYxpuCSL2g= +go.opentelemetry.io/proto/otlp v1.10.0/go.mod h1:/CV4QoCR/S9yaPj8utp3lvQPoqMtxXdzn7ozvvozVqk= go.uber.org/automaxprocs v1.6.0 h1:O3y2/QNTOdbF+e/dpXNNW7Rx2hZ4sTIPyybbxyNqTUs= go.uber.org/automaxprocs v1.6.0/go.mod h1:ifeIMSnPZuznNm6jmdzmU3/bfk01Fe2fotchwEFJ8r8= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= @@ -398,8 +398,8 @@ golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliY golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= golang.org/x/crypto v0.30.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= -golang.org/x/crypto v0.48.0 h1:/VRzVqiRSggnhY7gNRxPauEQ5Drw9haKdM0jqfcCFts= -golang.org/x/crypto v0.48.0/go.mod h1:r0kV5h3qnFPlQnBSrULhlsRfryS2pmewsg+XfMgkVos= +golang.org/x/crypto v0.49.0 h1:+Ng2ULVvLHnJ/ZFEq4KdcDd/cfjrrjjNSXNzxg0Y4U4= +golang.org/x/crypto v0.49.0/go.mod h1:ErX4dUh2UM+CFYiXZRTcMpEcN8b/1gxEuv3nODoYtCA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f h1:XdNn9LlyWAhLVp6P/i8QYBW+hlyhrhei9uErw2B5GJo= golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f/go.mod h1:D5SMRVC3C2/4+F/DB1wZsLRnSNimn2Sp/NPsCrsv8ak= @@ -433,8 +433,8 @@ golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= -golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo= -golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y= +golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0= +golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.35.0 h1:Mv2mzuHuZuY2+bkyWXIHMfhNdJAdwW3FuWeCPYN5GVQ= golang.org/x/oauth2 v0.35.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= @@ -484,8 +484,8 @@ golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= -golang.org/x/term v0.40.0 h1:36e4zGLqU4yhjlmxEaagx2KuYbJq3EwY8K943ZsHcvg= -golang.org/x/term v0.40.0/go.mod h1:w2P8uVp06p2iyKKuvXIm7N/y0UCRt3UfJTfZ7oOpglM= +golang.org/x/term v0.41.0 h1:QCgPso/Q3RTJx2Th4bDLqML4W6iJiaXFq2/ftQF13YU= +golang.org/x/term v0.41.0/go.mod h1:3pfBgksrReYfZ5lvYM0kSO0LIkAl4Yl2bXOkKP7Ec2A= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= @@ -495,8 +495,8 @@ golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= -golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk= -golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA= +golang.org/x/text v0.35.0 h1:JOVx6vVDFokkpaq1AEptVzLTpDe9KGpj5tR4/X+ybL8= +golang.org/x/text v0.35.0/go.mod h1:khi/HExzZJ2pGnjenulevKNX1W67CUy0AsXcNubPGCA= golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -517,24 +517,24 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= -gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= +gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4= +gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto/googleapis/api v0.0.0-20260209200024-4cfbd4190f57 h1:JLQynH/LBHfCTSbDWl+py8C+Rg/k1OVH3xfcaiANuF0= -google.golang.org/genproto/googleapis/api v0.0.0-20260209200024-4cfbd4190f57/go.mod h1:kSJwQxqmFXeo79zOmbrALdflXQeAYcUbgS7PbpMknCY= -google.golang.org/genproto/googleapis/rpc v0.0.0-20260226221140-a57be14db171 h1:ggcbiqK8WWh6l1dnltU4BgWGIGo+EVYxCaAPih/zQXQ= -google.golang.org/genproto/googleapis/rpc v0.0.0-20260226221140-a57be14db171/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8= +google.golang.org/genproto/googleapis/api v0.0.0-20260401024825-9d38bb4040a9 h1:VPWxll4HlMw1Vs/qXtN7BvhZqsS9cdAittCNvVENElA= +google.golang.org/genproto/googleapis/api v0.0.0-20260401024825-9d38bb4040a9/go.mod h1:7QBABkRtR8z+TEnmXTqIqwJLlzrZKVfAUm7tY3yGv0M= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260401024825-9d38bb4040a9 h1:m8qni9SQFH0tJc1X0vmnpw/0t+AImlSvp30sEupozUg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260401024825-9d38bb4040a9/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.79.3 h1:sybAEdRIEtvcD68Gx7dmnwjZKlyfuc61Dyo9pGXXkKE= -google.golang.org/grpc v1.79.3/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ= +google.golang.org/grpc v1.80.0 h1:Xr6m2WmWZLETvUNvIUmeD5OAagMw3FiKmMlTdViWsHM= +google.golang.org/grpc v1.80.0/go.mod h1:ho/dLnxwi3EDJA4Zghp7k2Ec1+c2jqup0bFkw07bwF4= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/vendor/go.opentelemetry.io/otel/.golangci.yml b/vendor/go.opentelemetry.io/otel/.golangci.yml index d12c8920af1a9..db1f55101cee9 100644 --- a/vendor/go.opentelemetry.io/otel/.golangci.yml +++ b/vendor/go.opentelemetry.io/otel/.golangci.yml @@ -17,6 +17,7 @@ linters: - ineffassign - misspell - modernize + - noctx - perfsprint - revive - staticcheck @@ -88,6 +89,16 @@ linters: deny: - pkg: go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal desc: Do not use cross-module internal packages. + semconv: + list-mode: lax + files: + - "!**/semconv/**" + - "!**/exporters/zipkin/**" + deny: + - pkg: go.opentelemetry.io/otel/semconv + desc: "Use go.opentelemetry.io/otel/semconv/v1.40.0 instead. If a newer semconv version has been released, update the depguard rule." + allow: + - go.opentelemetry.io/otel/semconv/v1.40.0 gocritic: disabled-checks: - appendAssign diff --git a/vendor/go.opentelemetry.io/otel/CHANGELOG.md b/vendor/go.opentelemetry.io/otel/CHANGELOG.md index ab7263014feb7..20edda4418c02 100644 --- a/vendor/go.opentelemetry.io/otel/CHANGELOG.md +++ b/vendor/go.opentelemetry.io/otel/CHANGELOG.md @@ -11,6 +11,49 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm +## [1.43.0/0.65.0/0.19.0] 2026-04-02 + +### Added + +- Add `IsRandom` and `WithRandom` on `TraceFlags`, and `IsRandom` on `SpanContext` in `go.opentelemetry.io/otel/trace` for [W3C Trace Context Level 2 Random Trace ID Flag](https://www.w3.org/TR/trace-context-2/#random-trace-id-flag) support. (#8012) +- Add service detection with `WithService` in `go.opentelemetry.io/otel/sdk/resource`. (#7642) +- Add `DefaultWithContext` and `EnvironmentWithContext` in `go.opentelemetry.io/otel/sdk/resource` to support plumbing `context.Context` through default and environment detectors. (#8051) +- Support attributes with empty value (`attribute.EMPTY`) in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`. (#8038) +- Support attributes with empty value (`attribute.EMPTY`) in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#8038) +- Support attributes with empty value (`attribute.EMPTY`) in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc`. (#8038) +- Support attributes with empty value (`attribute.EMPTY`) in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#8038) +- Support attributes with empty value (`attribute.EMPTY`) in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#8038) +- Support attributes with empty value (`attribute.EMPTY`) in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#8038) +- Support attributes with empty value (`attribute.EMPTY`) in `go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest`. (#8038) +- Add support for per-series start time tracking for cumulative metrics in `go.opentelemetry.io/otel/sdk/metric`. + Set `OTEL_GO_X_PER_SERIES_START_TIMESTAMPS=true` to enable. (#8060) +- Add `WithCardinalityLimitSelector` for metric reader for configuring cardinality limits specific to the instrument kind. (#7855) + +### Changed + +- Introduce the `EMPTY` Type in `go.opentelemetry.io/otel/attribute` to reflect that an empty value is now a valid value, with `INVALID` remaining as a deprecated alias of `EMPTY`. (#8038) +- Improve slice handling in `go.opentelemetry.io/otel/attribute` to optimize short slice values with fixed-size fast paths. (#8039) +- Improve performance of span metric recording in `go.opentelemetry.io/otel/sdk/trace` by returning early if self-observability is not enabled. (#8067) +- Improve formatting of metric data diffs in `go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest`. (#8073) + +### Deprecated + +- Deprecate `INVALID` in `go.opentelemetry.io/otel/attribute`. Use `EMPTY` instead. (#8038) + +### Fixed + +- Return spec-compliant `TraceIdRatioBased` description. This is a breaking behavioral change, but it is necessary to + make the implementation [spec-compliant](https://opentelemetry.io/docs/specs/otel/trace/sdk/#traceidratiobased). (#8027) +- Fix a race condition in `go.opentelemetry.io/otel/sdk/metric` where the lastvalue aggregation could collect the value 0 even when no zero-value measurements were recorded. (#8056) +- Limit HTTP response body to 4 MiB in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp` to mitigate excessive memory usage caused by a misconfigured or malicious server. + Responses exceeding the limit are treated as non-retryable errors. (#8108) +- Limit HTTP response body to 4 MiB in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` to mitigate excessive memory usage caused by a misconfigured or malicious server. + Responses exceeding the limit are treated as non-retryable errors. (#8108) +- Limit HTTP response body to 4 MiB in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp` to mitigate excessive memory usage caused by a misconfigured or malicious server. + Responses exceeding the limit are treated as non-retryable errors. (#8108) +- `WithHostID` detector in `go.opentelemetry.io/otel/sdk/resource` to use full path for `kenv` command on BSD. (#8113) +- Fix missing `request.GetBody` in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp` to correctly handle HTTP2 GOAWAY frame. (#8096) + ## [1.42.0/0.64.0/0.18.0/0.0.16] 2026-03-06 ### Added @@ -3576,7 +3619,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.42.0...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.43.0...HEAD +[1.43.0/0.65.0/0.19.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.43.0 [1.42.0/0.64.0/0.18.0/0.0.16]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.42.0 [1.41.0/0.63.0/0.17.0/0.0.15]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.41.0 [1.40.0/0.62.0/0.16.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.40.0 diff --git a/vendor/go.opentelemetry.io/otel/Makefile b/vendor/go.opentelemetry.io/otel/Makefile index 9f6e6b5117e9a..42466f2d6a1e4 100644 --- a/vendor/go.opentelemetry.io/otel/Makefile +++ b/vendor/go.opentelemetry.io/otel/Makefile @@ -38,10 +38,14 @@ CROSSLINK = $(TOOLS)/crosslink $(TOOLS)/crosslink: PACKAGE=go.opentelemetry.io/build-tools/crosslink SEMCONVKIT = $(TOOLS)/semconvkit +SEMCONVKIT_FILES := $(sort $(shell find $(TOOLS_MOD_DIR)/semconvkit -type f)) $(TOOLS)/semconvkit: PACKAGE=go.opentelemetry.io/otel/$(TOOLS_MOD_DIR)/semconvkit +$(TOOLS)/semconvkit: $(SEMCONVKIT_FILES) VERIFYREADMES = $(TOOLS)/verifyreadmes +VERIFYREADMES_FILES := $(sort $(shell find $(TOOLS_MOD_DIR)/verifyreadmes -type f)) $(TOOLS)/verifyreadmes: PACKAGE=go.opentelemetry.io/otel/$(TOOLS_MOD_DIR)/verifyreadmes +$(TOOLS)/verifyreadmes: $(VERIFYREADMES_FILES) GOLANGCI_LINT = $(TOOLS)/golangci-lint $(TOOLS)/golangci-lint: PACKAGE=github.com/golangci/golangci-lint/v2/cmd/golangci-lint diff --git a/vendor/go.opentelemetry.io/otel/RELEASING.md b/vendor/go.opentelemetry.io/otel/RELEASING.md index 861756fd74539..6aff7548c9ff3 100644 --- a/vendor/go.opentelemetry.io/otel/RELEASING.md +++ b/vendor/go.opentelemetry.io/otel/RELEASING.md @@ -4,7 +4,9 @@ Create a `Version Release` issue to track the release process. -## Semantic Convention Generation +## Semantic Convention Upgrade + +### Semantic Convention Generation New versions of the [OpenTelemetry Semantic Conventions] mean new versions of the `semconv` package need to be generated. The `semconv-generate` make target is used for this. @@ -22,6 +24,43 @@ make semconv-generate # Uses the exported TAG. This should create a new sub-package of [`semconv`](./semconv). Ensure things look correct before submitting a pull request to include the addition. +The `CHANGELOG.md` should also be updated to reflect the new changes: + +```md +- The `go.opentelemetry.io/otel/semconv/` package. The package contains semantic conventions from the `` version of the OpenTelemetry Semantic Conventions. See the [migration documentation](./semconv//MIGRATION.md) for information on how to upgrade from `go.opentelemetry.io/otel/semconv/`. (#PR_NUMBER) +``` + +> **Tip:** Change to the release and prior version to match the changes + +### Update semconv imports + +Once the new semconv module has been generated, update all semconv imports throughout the codebase to reference the new version: + +```go +// Before +semconv "go.opentelemetry.io/otel/semconv/v1.37.0" +"go.opentelemetry.io/otel/semconv/v1.37.0/otelconv" + + +// After +semconv "go.opentelemetry.io/otel/semconv/v1.39.0" +"go.opentelemetry.io/otel/semconv/v1.39.0/otelconv" +``` + +Once complete, run `make` to check for any compilation or test failures. + +#### Handling attribute changes + +Some semconv releases might add new attributes or impact attributes that are currently being used. Changes could stem from a simple renaming, to more complex changes like merging attributes and property values being changed. + +One should update the code to the new attributes that supersede the impacted ones, hence sticking to the semantic conventions. However, legacy attributes might still be emitted in accordance to the `OTEL_SEMCONV_STABILITY_OPT_IN` environment variable. + +For an example on how such migration might have to be tracked and performed, see issue [#7806](https://github.com/open-telemetry/opentelemetry-go/issues/7806). + +### Go contrib linter update + +Update [.golangci.yml](https://github.com/open-telemetry/opentelemetry-go-contrib/blob/main/.golangci.yml) in [opentelemetry-go-contrib](https://github.com/open-telemetry/opentelemetry-go-contrib/) to mandate the new semconv version. + ## Breaking changes validation You can run `make gorelease` which runs [gorelease](https://pkg.go.dev/golang.org/x/exp/cmd/gorelease) to ensure that there are no unwanted changes made in the public API. diff --git a/vendor/go.opentelemetry.io/otel/attribute/encoder.go b/vendor/go.opentelemetry.io/otel/attribute/encoder.go index 6cc1a1655cf2d..771dd69c55e04 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/encoder.go +++ b/vendor/go.opentelemetry.io/otel/attribute/encoder.go @@ -53,7 +53,7 @@ var ( _ Encoder = &defaultAttrEncoder{} // encoderIDCounter is for generating IDs for other attribute encoders. - encoderIDCounter uint64 + encoderIDCounter atomic.Uint64 defaultEncoderOnce sync.Once defaultEncoderID = NewEncoderID() @@ -64,7 +64,7 @@ var ( // once per each type of attribute encoder. Preferably in init() or in var // definition. func NewEncoderID() EncoderID { - return EncoderID{value: atomic.AddUint64(&encoderIDCounter, 1)} + return EncoderID{value: encoderIDCounter.Add(1)} } // DefaultEncoder returns an attribute encoder that encodes attributes in such diff --git a/vendor/go.opentelemetry.io/otel/attribute/hash.go b/vendor/go.opentelemetry.io/otel/attribute/hash.go index 6aa69aeaecfac..b09caaa6d7ce2 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/hash.go +++ b/vendor/go.opentelemetry.io/otel/attribute/hash.go @@ -27,6 +27,7 @@ const ( int64SliceID uint64 = 3762322556277578591 // "_[]int64" (little endian) float64SliceID uint64 = 7308324551835016539 // "[]double" (little endian) stringSliceID uint64 = 7453010373645655387 // "[]string" (little endian) + emptyID uint64 = 7305809155345288421 // "__empty_" (little endian) ) // hashKVs returns a new xxHash64 hash of kvs. @@ -80,7 +81,8 @@ func hashKV(h xxhash.Hash, kv KeyValue) xxhash.Hash { for i := 0; i < rv.Len(); i++ { h = h.String(rv.Index(i).String()) } - case INVALID: + case EMPTY: + h = h.Uint64(emptyID) default: // Logging is an alternative, but using the internal logger here // causes an import cycle so it is not done. diff --git a/vendor/go.opentelemetry.io/otel/attribute/internal/attribute.go b/vendor/go.opentelemetry.io/otel/attribute/internal/attribute.go index 7f5eae877da88..d9f51fa2d7f9d 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/internal/attribute.go +++ b/vendor/go.opentelemetry.io/otel/attribute/internal/attribute.go @@ -11,80 +11,63 @@ import ( "reflect" ) -// BoolSliceValue converts a bool slice into an array with same elements as slice. -func BoolSliceValue(v []bool) any { - cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeFor[bool]())).Elem() - reflect.Copy(cp, reflect.ValueOf(v)) - return cp.Interface() +// sliceElem is the exact set of element types stored in attribute slice values. +// Using a closed set prevents accidental instantiations for unsupported types. +type sliceElem interface { + bool | int64 | float64 | string } -// Int64SliceValue converts an int64 slice into an array with same elements as slice. -func Int64SliceValue(v []int64) any { - cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeFor[int64]())).Elem() - reflect.Copy(cp, reflect.ValueOf(v)) - return cp.Interface() -} - -// Float64SliceValue converts a float64 slice into an array with same elements as slice. -func Float64SliceValue(v []float64) any { - cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeFor[float64]())).Elem() - reflect.Copy(cp, reflect.ValueOf(v)) - return cp.Interface() -} +// SliceValue converts a slice into an array with the same elements. +func SliceValue[T sliceElem](v []T) any { + // Keep only the common tiny-slice cases out of reflection. Extending this + // much further increases code size for diminishing benefit while larger + // slices still need the generic reflective path to preserve comparability. + // This matches the short lengths that show up most often in local + // benchmarks and semantic convention examples while leaving larger, less + // predictable slices on the generic reflective path. + switch len(v) { + case 0: + return [0]T{} + case 1: + return [1]T{v[0]} + case 2: + return [2]T{v[0], v[1]} + case 3: + return [3]T{v[0], v[1], v[2]} + } -// StringSliceValue converts a string slice into an array with same elements as slice. -func StringSliceValue(v []string) any { - cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeFor[string]())).Elem() - reflect.Copy(cp, reflect.ValueOf(v)) - return cp.Interface() + return sliceValueReflect(v) } -// AsBoolSlice converts a bool array into a slice into with same elements as array. -func AsBoolSlice(v any) []bool { - rv := reflect.ValueOf(v) - if rv.Type().Kind() != reflect.Array { - return nil +// AsSlice converts an array into a slice with the same elements. +func AsSlice[T sliceElem](v any) []T { + // Mirror the small fixed-array fast path used by SliceValue. + switch a := v.(type) { + case [0]T: + return []T{} + case [1]T: + return []T{a[0]} + case [2]T: + return []T{a[0], a[1]} + case [3]T: + return []T{a[0], a[1], a[2]} } - cpy := make([]bool, rv.Len()) - if len(cpy) > 0 { - _ = reflect.Copy(reflect.ValueOf(cpy), rv) - } - return cpy -} -// AsInt64Slice converts an int64 array into a slice into with same elements as array. -func AsInt64Slice(v any) []int64 { - rv := reflect.ValueOf(v) - if rv.Type().Kind() != reflect.Array { - return nil - } - cpy := make([]int64, rv.Len()) - if len(cpy) > 0 { - _ = reflect.Copy(reflect.ValueOf(cpy), rv) - } - return cpy + return asSliceReflect[T](v) } -// AsFloat64Slice converts a float64 array into a slice into with same elements as array. -func AsFloat64Slice(v any) []float64 { - rv := reflect.ValueOf(v) - if rv.Type().Kind() != reflect.Array { - return nil - } - cpy := make([]float64, rv.Len()) - if len(cpy) > 0 { - _ = reflect.Copy(reflect.ValueOf(cpy), rv) - } - return cpy +func sliceValueReflect[T sliceElem](v []T) any { + cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeFor[T]())).Elem() + reflect.Copy(cp, reflect.ValueOf(v)) + return cp.Interface() } -// AsStringSlice converts a string array into a slice into with same elements as array. -func AsStringSlice(v any) []string { +func asSliceReflect[T sliceElem](v any) []T { rv := reflect.ValueOf(v) - if rv.Type().Kind() != reflect.Array { + if !rv.IsValid() || rv.Kind() != reflect.Array || rv.Type().Elem() != reflect.TypeFor[T]() { return nil } - cpy := make([]string, rv.Len()) + cpy := make([]T, rv.Len()) if len(cpy) > 0 { _ = reflect.Copy(reflect.ValueOf(cpy), rv) } diff --git a/vendor/go.opentelemetry.io/otel/attribute/kv.go b/vendor/go.opentelemetry.io/otel/attribute/kv.go index 8c6928ca79b60..0cc368018be13 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/kv.go +++ b/vendor/go.opentelemetry.io/otel/attribute/kv.go @@ -15,7 +15,7 @@ type KeyValue struct { // Valid reports whether kv is a valid OpenTelemetry attribute. func (kv KeyValue) Valid() bool { - return kv.Key.Defined() && kv.Value.Type() != INVALID + return kv.Key.Defined() } // Bool creates a KeyValue with a BOOL Value type. diff --git a/vendor/go.opentelemetry.io/otel/attribute/type_string.go b/vendor/go.opentelemetry.io/otel/attribute/type_string.go index 24f1fa37dbe29..6c04448d6f0d0 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/type_string.go +++ b/vendor/go.opentelemetry.io/otel/attribute/type_string.go @@ -8,7 +8,7 @@ func _() { // An "invalid array index" compiler error signifies that the constant values have changed. // Re-run the stringer command to generate them again. var x [1]struct{} - _ = x[INVALID-0] + _ = x[EMPTY-0] _ = x[BOOL-1] _ = x[INT64-2] _ = x[FLOAT64-3] @@ -19,9 +19,9 @@ func _() { _ = x[STRINGSLICE-8] } -const _Type_name = "INVALIDBOOLINT64FLOAT64STRINGBOOLSLICEINT64SLICEFLOAT64SLICESTRINGSLICE" +const _Type_name = "EMPTYBOOLINT64FLOAT64STRINGBOOLSLICEINT64SLICEFLOAT64SLICESTRINGSLICE" -var _Type_index = [...]uint8{0, 7, 11, 16, 23, 29, 38, 48, 60, 71} +var _Type_index = [...]uint8{0, 5, 9, 14, 21, 27, 36, 46, 58, 69} func (i Type) String() string { idx := int(i) - 0 diff --git a/vendor/go.opentelemetry.io/otel/attribute/value.go b/vendor/go.opentelemetry.io/otel/attribute/value.go index 5931e71291a72..db04b1326c3e5 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/value.go +++ b/vendor/go.opentelemetry.io/otel/attribute/value.go @@ -6,7 +6,6 @@ package attribute // import "go.opentelemetry.io/otel/attribute" import ( "encoding/json" "fmt" - "reflect" "strconv" attribute "go.opentelemetry.io/otel/attribute/internal" @@ -18,6 +17,8 @@ import ( type Type int // nolint: revive // redefines builtin Type. // Value represents the value part in key-value pairs. +// +// Note that the zero value is a valid empty value. type Value struct { vtype Type numeric uint64 @@ -26,8 +27,8 @@ type Value struct { } const ( - // INVALID is used for a Value with no value set. - INVALID Type = iota + // EMPTY is used for a Value with no value set. + EMPTY Type = iota // BOOL is a boolean Type Value. BOOL // INT64 is a 64-bit signed integral Type Value. @@ -44,6 +45,10 @@ const ( FLOAT64SLICE // STRINGSLICE is a slice of strings Type Value. STRINGSLICE + // INVALID is used for a Value with no value set. + // + // Deprecated: Use EMPTY instead as an empty value is a valid value. + INVALID = EMPTY ) // BoolValue creates a BOOL Value. @@ -56,7 +61,7 @@ func BoolValue(v bool) Value { // BoolSliceValue creates a BOOLSLICE Value. func BoolSliceValue(v []bool) Value { - return Value{vtype: BOOLSLICE, slice: attribute.BoolSliceValue(v)} + return Value{vtype: BOOLSLICE, slice: attribute.SliceValue(v)} } // IntValue creates an INT64 Value. @@ -64,16 +69,30 @@ func IntValue(v int) Value { return Int64Value(int64(v)) } -// IntSliceValue creates an INTSLICE Value. +// IntSliceValue creates an INT64SLICE Value. func IntSliceValue(v []int) Value { - cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeFor[int64]())) - for i, val := range v { - cp.Elem().Index(i).SetInt(int64(val)) - } - return Value{ - vtype: INT64SLICE, - slice: cp.Elem().Interface(), + val := Value{vtype: INT64SLICE} + + // Avoid the common tiny-slice cases from allocating a new slice. + switch len(v) { + case 0: + val.slice = [0]int64{} + case 1: + val.slice = [1]int64{int64(v[0])} + case 2: + val.slice = [2]int64{int64(v[0]), int64(v[1])} + case 3: + val.slice = [3]int64{int64(v[0]), int64(v[1]), int64(v[2])} + default: + // Fallback to a new slice for larger slices. + cp := make([]int64, len(v)) + for i, val := range v { + cp[i] = int64(val) + } + val.slice = attribute.SliceValue(cp) } + + return val } // Int64Value creates an INT64 Value. @@ -86,7 +105,7 @@ func Int64Value(v int64) Value { // Int64SliceValue creates an INT64SLICE Value. func Int64SliceValue(v []int64) Value { - return Value{vtype: INT64SLICE, slice: attribute.Int64SliceValue(v)} + return Value{vtype: INT64SLICE, slice: attribute.SliceValue(v)} } // Float64Value creates a FLOAT64 Value. @@ -99,7 +118,7 @@ func Float64Value(v float64) Value { // Float64SliceValue creates a FLOAT64SLICE Value. func Float64SliceValue(v []float64) Value { - return Value{vtype: FLOAT64SLICE, slice: attribute.Float64SliceValue(v)} + return Value{vtype: FLOAT64SLICE, slice: attribute.SliceValue(v)} } // StringValue creates a STRING Value. @@ -112,7 +131,7 @@ func StringValue(v string) Value { // StringSliceValue creates a STRINGSLICE Value. func StringSliceValue(v []string) Value { - return Value{vtype: STRINGSLICE, slice: attribute.StringSliceValue(v)} + return Value{vtype: STRINGSLICE, slice: attribute.SliceValue(v)} } // Type returns a type of the Value. @@ -136,7 +155,7 @@ func (v Value) AsBoolSlice() []bool { } func (v Value) asBoolSlice() []bool { - return attribute.AsBoolSlice(v.slice) + return attribute.AsSlice[bool](v.slice) } // AsInt64 returns the int64 value. Make sure that the Value's type is @@ -155,7 +174,7 @@ func (v Value) AsInt64Slice() []int64 { } func (v Value) asInt64Slice() []int64 { - return attribute.AsInt64Slice(v.slice) + return attribute.AsSlice[int64](v.slice) } // AsFloat64 returns the float64 value. Make sure that the Value's @@ -174,7 +193,7 @@ func (v Value) AsFloat64Slice() []float64 { } func (v Value) asFloat64Slice() []float64 { - return attribute.AsFloat64Slice(v.slice) + return attribute.AsSlice[float64](v.slice) } // AsString returns the string value. Make sure that the Value's type @@ -193,7 +212,7 @@ func (v Value) AsStringSlice() []string { } func (v Value) asStringSlice() []string { - return attribute.AsStringSlice(v.slice) + return attribute.AsSlice[string](v.slice) } type unknownValueType struct{} @@ -217,6 +236,8 @@ func (v Value) AsInterface() any { return v.stringly case STRINGSLICE: return v.asStringSlice() + case EMPTY: + return nil } return unknownValueType{} } @@ -252,6 +273,8 @@ func (v Value) Emit() string { return string(j) case STRING: return v.stringly + case EMPTY: + return "" default: return "unknown" } diff --git a/vendor/go.opentelemetry.io/otel/dependencies.Dockerfile b/vendor/go.opentelemetry.io/otel/dependencies.Dockerfile index f0cc942baea75..7a9b3c055905e 100644 --- a/vendor/go.opentelemetry.io/otel/dependencies.Dockerfile +++ b/vendor/go.opentelemetry.io/otel/dependencies.Dockerfile @@ -1,4 +1,4 @@ # This is a renovate-friendly source of Docker images. FROM python:3.13.6-slim-bullseye@sha256:e98b521460ee75bca92175c16247bdf7275637a8faaeb2bcfa19d879ae5c4b9a AS python -FROM otel/weaver:v0.21.2@sha256:2401de985c38bdb98b43918e2f43aa36b2afed4aa5669ac1c1de0a17301cd36d AS weaver +FROM otel/weaver:v0.22.1@sha256:33ae522ae4b71c1c562563c1d81f46aa0f79f088a0873199143a1f11ac30e5c9 AS weaver FROM avtodev/markdown-lint:v1@sha256:6aeedc2f49138ce7a1cd0adffc1b1c0321b841dc2102408967d9301c031949ee AS markdown diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/attribute.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/attribute.go index d9bfd6e1765b9..12e243e042b46 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/attribute.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/attribute.go @@ -93,6 +93,7 @@ func Value(v attribute.Value) *commonpb.AnyValue { Values: stringSliceValues(v.AsStringSlice()), }, } + case attribute.EMPTY: default: av.Value = &commonpb.AnyValue_StringValue{ StringValue: "INVALID", diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/version.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/version.go index 9d4b311920956..7a1c420ecb991 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/version.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/version.go @@ -5,4 +5,4 @@ package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/ot // Version is the current release version of the OpenTelemetry OTLP gRPC trace // exporter in use. -const Version = "1.42.0" +const Version = "1.43.0" diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/client.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/client.go index 05cb2334317c7..4ae569ff4b12b 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/client.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/client.go @@ -32,6 +32,13 @@ import ( const contentTypeProto = "application/x-protobuf" +// maxResponseBodySize is the maximum number of bytes to read from a response +// body. It is set to 4 MiB per the OTLP specification recommendation to +// mitigate excessive memory usage caused by a misconfigured or malicious +// server. If exceeded, the response is treated as a not-retryable error. +// This is a variable to allow tests to override it. +var maxResponseBodySize int64 = 4 * 1024 * 1024 + var gzPool = sync.Pool{ New: func() any { w := gzip.NewWriter(io.Discard) @@ -203,7 +210,11 @@ func (d *client) UploadTraces(ctx context.Context, protoSpans []*tracepb.Resourc // Success, do not retry. // Read the partial success message, if any. var respData bytes.Buffer - if _, err := io.Copy(&respData, resp.Body); err != nil { + if _, err := io.Copy(&respData, http.MaxBytesReader(nil, resp.Body, maxResponseBodySize)); err != nil { + var maxBytesErr *http.MaxBytesError + if errors.As(err, &maxBytesErr) { + return fmt.Errorf("response body too large: exceeded %d bytes", maxBytesErr.Limit) + } return err } if respData.Len() == 0 { @@ -234,7 +245,11 @@ func (d *client) UploadTraces(ctx context.Context, protoSpans []*tracepb.Resourc // message to be returned. It will help in // debugging the actual issue. var respData bytes.Buffer - if _, err := io.Copy(&respData, resp.Body); err != nil { + if _, err := io.Copy(&respData, http.MaxBytesReader(nil, resp.Body, maxResponseBodySize)); err != nil { + var maxBytesErr *http.MaxBytesError + if errors.As(err, &maxBytesErr) { + return fmt.Errorf("response body too large: exceeded %d bytes", maxBytesErr.Limit) + } return err } respStr := strings.TrimSpace(respData.String()) @@ -259,7 +274,7 @@ func (d *client) UploadTraces(ctx context.Context, protoSpans []*tracepb.Resourc func (d *client) newRequest(body []byte) (request, error) { u := url.URL{Scheme: d.getScheme(), Host: d.cfg.Endpoint, Path: d.cfg.URLPath} - r, err := http.NewRequest(http.MethodPost, u.String(), http.NoBody) + r, err := http.NewRequestWithContext(context.Background(), http.MethodPost, u.String(), http.NoBody) if err != nil { return request{Request: r}, err } diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/doc.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/doc.go index 9fea75ad19c46..85645e118e5a1 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/doc.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/doc.go @@ -24,6 +24,11 @@ The value may additionally contain a port and a path. The value should not contain a query string or fragment. The configuration can be overridden by [WithEndpoint], [WithEndpointURL], [WithInsecure], and [WithURLPath] options. +OTEL_EXPORTER_OTLP_INSECURE, OTEL_EXPORTER_OTLP_TRACES_INSECURE (default: "false") - +setting "true" disables client transport security for the exporter's HTTP connection. +OTEL_EXPORTER_OTLP_TRACES_INSECURE takes precedence over OTEL_EXPORTER_OTLP_INSECURE. +The configuration can be overridden by [WithInsecure] and [WithTLSClientConfig] options. + OTEL_EXPORTER_OTLP_HEADERS, OTEL_EXPORTER_OTLP_TRACES_HEADERS (default: none) - key-value pairs used as headers associated with HTTP requests. The value is expected to be represented in a format matching the [W3C Baggage HTTP Header Content Format], diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/version.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/version.go index c1e93d98c9a75..3e43f77113166 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/version.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/version.go @@ -5,4 +5,4 @@ package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/ot // Version is the current release version of the OpenTelemetry OTLP HTTP trace // exporter in use. -const Version = "1.42.0" +const Version = "1.43.0" diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/version.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/version.go index d1b43c3ba43f0..087e95f7b838f 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/version.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/version.go @@ -5,5 +5,5 @@ package otlptrace // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace" // Version is the current release version of the OpenTelemetry OTLP trace exporter in use. func Version() string { - return "1.42.0" + return "1.43.0" } diff --git a/vendor/go.opentelemetry.io/otel/sdk/internal/x/features.go b/vendor/go.opentelemetry.io/otel/sdk/internal/x/features.go index bfeb73e811bf7..694b64a318053 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/internal/x/features.go +++ b/vendor/go.opentelemetry.io/otel/sdk/internal/x/features.go @@ -37,3 +37,18 @@ var Observability = newFeature( return "", false }, ) + +// PerSeriesStartTimestamps is an experimental feature flag that determines if the SDK +// uses the new Start Timestamps specification. +// +// To enable this feature set the OTEL_GO_X_PER_SERIES_START_TIMESTAMPS environment variable +// to the case-insensitive string value of "true". +var PerSeriesStartTimestamps = newFeature( + []string{"PER_SERIES_START_TIMESTAMPS"}, + func(v string) (bool, bool) { + if strings.EqualFold(v, "true") { + return true, true + } + return false, false + }, +) diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/config.go b/vendor/go.opentelemetry.io/otel/sdk/resource/config.go index 0d6e213d92455..a3d647d92c29c 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/config.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/config.go @@ -193,3 +193,11 @@ func WithContainer() Option { func WithContainerID() Option { return WithDetectors(cgroupContainerIDDetector{}) } + +// WithService adds all the Service attributes to the configured Resource. +func WithService() Option { + return WithDetectors( + defaultServiceInstanceIDDetector{}, + defaultServiceNameDetector{}, + ) +} diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/host_id.go b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id.go index 1a72b756ae247..755c082427483 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/host_id.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id.go @@ -31,19 +31,19 @@ type hostIDReaderBSD struct { readFile fileReader } -// read attempts to read the machine-id from /etc/hostid. If not found it will -// execute `kenv -q smbios.system.uuid`. If neither location yields an id an -// error will be returned. +// read attempts to read the machine-id from /etc/hostid. +// If not found it will execute: /bin/kenv -q smbios.system.uuid. +// If neither location yields an id an error will be returned. func (r *hostIDReaderBSD) read() (string, error) { if result, err := r.readFile("/etc/hostid"); err == nil { return strings.TrimSpace(result), nil } - if result, err := r.execCommand("kenv", "-q", "smbios.system.uuid"); err == nil { + if result, err := r.execCommand("/bin/kenv", "-q", "smbios.system.uuid"); err == nil { return strings.TrimSpace(result), nil } - return "", errors.New("host id not found in: /etc/hostid or kenv") + return "", errors.New("host id not found in: /etc/hostid or /bin/kenv") } // hostIDReaderDarwin implements hostIDReader. diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/resource.go b/vendor/go.opentelemetry.io/otel/sdk/resource/resource.go index 28e1e4f7ebd5e..f715be53edaff 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/resource.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/resource.go @@ -232,6 +232,15 @@ func Empty() *Resource { // Default returns an instance of Resource with a default // "service.name" and OpenTelemetrySDK attributes. func Default() *Resource { + return DefaultWithContext(context.Background()) +} + +// DefaultWithContext returns an instance of Resource with a default +// "service.name" and OpenTelemetrySDK attributes. +// +// If the default resource has already been initialized, the provided ctx +// is ignored and the cached resource is returned. +func DefaultWithContext(ctx context.Context) *Resource { defaultResourceOnce.Do(func() { var err error defaultDetectors := []Detector{ @@ -243,7 +252,7 @@ func Default() *Resource { defaultDetectors = append([]Detector{defaultServiceInstanceIDDetector{}}, defaultDetectors...) } defaultResource, err = Detect( - context.Background(), + ctx, defaultDetectors..., ) if err != nil { @@ -260,8 +269,14 @@ func Default() *Resource { // Environment returns an instance of Resource with attributes // extracted from the OTEL_RESOURCE_ATTRIBUTES environment variable. func Environment() *Resource { + return EnvironmentWithContext(context.Background()) +} + +// EnvironmentWithContext returns an instance of Resource with attributes +// extracted from the OTEL_RESOURCE_ATTRIBUTES environment variable. +func EnvironmentWithContext(ctx context.Context) *Resource { detector := &fromEnv{} - resource, err := detector.Detect(context.Background()) + resource, err := detector.Detect(ctx) if err != nil { otel.Handle(err) } diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/batch_span_processor.go b/vendor/go.opentelemetry.io/otel/sdk/trace/batch_span_processor.go index c7c317fbcae48..32854b14a35ca 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/trace/batch_span_processor.go +++ b/vendor/go.opentelemetry.io/otel/sdk/trace/batch_span_processor.go @@ -68,7 +68,7 @@ type batchSpanProcessor struct { o BatchSpanProcessorOptions queue chan ReadOnlySpan - dropped uint32 + dropped atomic.Uint32 inst *observ.BSP @@ -293,7 +293,7 @@ func (bsp *batchSpanProcessor) exportSpans(ctx context.Context) error { } if l := len(bsp.batch); l > 0 { - global.Debug("exporting spans", "count", len(bsp.batch), "total_dropped", atomic.LoadUint32(&bsp.dropped)) + global.Debug("exporting spans", "count", len(bsp.batch), "total_dropped", bsp.dropped.Load()) if bsp.inst != nil { bsp.inst.Processed(ctx, int64(l)) } @@ -421,7 +421,7 @@ func (bsp *batchSpanProcessor) enqueueDrop(ctx context.Context, sd ReadOnlySpan) case bsp.queue <- sd: return true default: - atomic.AddUint32(&bsp.dropped, 1) + bsp.dropped.Add(1) if bsp.inst != nil { bsp.inst.ProcessedQueueFull(ctx, 1) } diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/internal/observ/tracer.go b/vendor/go.opentelemetry.io/otel/sdk/trace/internal/observ/tracer.go index a2334811ef579..560d316f2f7f2 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/trace/internal/observ/tracer.go +++ b/vendor/go.opentelemetry.io/otel/sdk/trace/internal/observ/tracer.go @@ -55,6 +55,10 @@ func NewTracer() (Tracer, error) { func (t Tracer) Enabled() bool { return t.enabled } func (t Tracer) SpanStarted(ctx context.Context, psc trace.SpanContext, span trace.Span) { + if !t.started.Enabled(ctx) { + return + } + key := spanStartedKey{ parent: parentStateNoParent, sampling: samplingStateDrop, @@ -89,6 +93,10 @@ func (t Tracer) SpanEnded(ctx context.Context, span trace.Span) { } func (t Tracer) spanLive(ctx context.Context, value int64, span trace.Span) { + if !t.live.Enabled(ctx) { + return + } + key := spanLiveKey{sampled: span.SpanContext().IsSampled()} opts := spanLiveOpts[key] t.live.Add(ctx, value, opts...) diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/provider.go b/vendor/go.opentelemetry.io/otel/sdk/trace/provider.go index 4ba4acf130e22..cd40d299d6cea 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/trace/provider.go +++ b/vendor/go.opentelemetry.io/otel/sdk/trace/provider.go @@ -303,14 +303,7 @@ func (p *TracerProvider) Shutdown(ctx context.Context) error { sps.state.Do(func() { err = sps.sp.Shutdown(ctx) }) - if err != nil { - if retErr == nil { - retErr = err - } else { - // Poor man's list of errors - retErr = fmt.Errorf("%w; %w", retErr, err) - } - } + retErr = errors.Join(retErr, err) } p.spanProcessors.Store(&spanProcessorStates{}) return retErr diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/sampling.go b/vendor/go.opentelemetry.io/otel/sdk/trace/sampling.go index 81c5060ad6616..845e292c2bbc9 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/trace/sampling.go +++ b/vendor/go.opentelemetry.io/otel/sdk/trace/sampling.go @@ -69,17 +69,17 @@ type traceIDRatioSampler struct { } func (ts traceIDRatioSampler) ShouldSample(p SamplingParameters) SamplingResult { - psc := trace.SpanContextFromContext(p.ParentContext) + state := trace.SpanContextFromContext(p.ParentContext).TraceState() x := binary.BigEndian.Uint64(p.TraceID[8:16]) >> 1 if x < ts.traceIDUpperBound { return SamplingResult{ Decision: RecordAndSample, - Tracestate: psc.TraceState(), + Tracestate: state, } } return SamplingResult{ Decision: Drop, - Tracestate: psc.TraceState(), + Tracestate: state, } } @@ -94,12 +94,20 @@ func (ts traceIDRatioSampler) Description() string { // //nolint:revive // revive complains about stutter of `trace.TraceIDRatioBased` func TraceIDRatioBased(fraction float64) Sampler { + // Cannot use AlwaysSample() and NeverSample(), must return spec-compliant descriptions. + // See https://opentelemetry.io/docs/specs/otel/trace/sdk/#traceidratiobased. if fraction >= 1 { - return AlwaysSample() + return predeterminedSampler{ + description: "TraceIDRatioBased{1}", + decision: RecordAndSample, + } } if fraction <= 0 { - fraction = 0 + return predeterminedSampler{ + description: "TraceIDRatioBased{0}", + decision: Drop, + } } return &traceIDRatioSampler{ @@ -118,6 +126,7 @@ func (alwaysOnSampler) ShouldSample(p SamplingParameters) SamplingResult { } func (alwaysOnSampler) Description() string { + // https://opentelemetry.io/docs/specs/otel/trace/sdk/#alwayson return "AlwaysOnSampler" } @@ -139,6 +148,7 @@ func (alwaysOffSampler) ShouldSample(p SamplingParameters) SamplingResult { } func (alwaysOffSampler) Description() string { + // https://opentelemetry.io/docs/specs/otel/trace/sdk/#alwaysoff return "AlwaysOffSampler" } @@ -147,6 +157,22 @@ func NeverSample() Sampler { return alwaysOffSampler{} } +type predeterminedSampler struct { + description string + decision SamplingDecision +} + +func (s predeterminedSampler) ShouldSample(p SamplingParameters) SamplingResult { + return SamplingResult{ + Decision: s.decision, + Tracestate: trace.SpanContextFromContext(p.ParentContext).TraceState(), + } +} + +func (s predeterminedSampler) Description() string { + return s.description +} + // ParentBased returns a sampler decorator which behaves differently, // based on the parent of the span. If the span has no parent, // the decorated sampler is used to make sampling decision. If the span has diff --git a/vendor/go.opentelemetry.io/otel/sdk/version.go b/vendor/go.opentelemetry.io/otel/sdk/version.go index 96e0fc60f9e64..766731dd25d27 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/version.go +++ b/vendor/go.opentelemetry.io/otel/sdk/version.go @@ -6,5 +6,5 @@ package sdk // import "go.opentelemetry.io/otel/sdk" // Version is the current release version of the OpenTelemetry SDK in use. func Version() string { - return "1.42.0" + return "1.43.0" } diff --git a/vendor/go.opentelemetry.io/otel/trace/trace.go b/vendor/go.opentelemetry.io/otel/trace/trace.go index 96c06ec321b30..e3d103c4b61d6 100644 --- a/vendor/go.opentelemetry.io/otel/trace/trace.go +++ b/vendor/go.opentelemetry.io/otel/trace/trace.go @@ -196,6 +196,20 @@ func (tf TraceFlags) WithSampled(sampled bool) TraceFlags { // nolint:revive // return tf &^ FlagsSampled } +// IsRandom reports whether the random bit is set in the TraceFlags. +func (tf TraceFlags) IsRandom() bool { + return tf&FlagsRandom == FlagsRandom +} + +// WithRandom sets the random bit in a new copy of the TraceFlags. +func (tf TraceFlags) WithRandom(random bool) TraceFlags { // nolint:revive // random is not a control flag. + if random { + return tf | FlagsRandom + } + + return tf &^ FlagsRandom +} + // MarshalJSON implements a custom marshal function to encode TraceFlags // as a hex string. func (tf TraceFlags) MarshalJSON() ([]byte, error) { @@ -322,6 +336,11 @@ func (sc SpanContext) IsSampled() bool { return sc.traceFlags.IsSampled() } +// IsRandom reports whether the random bit is set in the SpanContext's TraceFlags. +func (sc SpanContext) IsRandom() bool { + return sc.traceFlags.IsRandom() +} + // WithTraceFlags returns a new SpanContext with the TraceFlags replaced. func (sc SpanContext) WithTraceFlags(flags TraceFlags) SpanContext { return SpanContext{ diff --git a/vendor/go.opentelemetry.io/otel/version.go b/vendor/go.opentelemetry.io/otel/version.go index 2dae06f25fe32..1db4f47e435ef 100644 --- a/vendor/go.opentelemetry.io/otel/version.go +++ b/vendor/go.opentelemetry.io/otel/version.go @@ -5,5 +5,5 @@ package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.42.0" + return "1.43.0" } diff --git a/vendor/go.opentelemetry.io/otel/versions.yaml b/vendor/go.opentelemetry.io/otel/versions.yaml index 6c634ef316d86..bcc6ee78a48ac 100644 --- a/vendor/go.opentelemetry.io/otel/versions.yaml +++ b/vendor/go.opentelemetry.io/otel/versions.yaml @@ -3,7 +3,7 @@ module-sets: stable-v1: - version: v1.42.0 + version: v1.43.0 modules: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opencensus @@ -22,11 +22,11 @@ module-sets: - go.opentelemetry.io/otel/sdk/metric - go.opentelemetry.io/otel/trace experimental-metrics: - version: v0.64.0 + version: v0.65.0 modules: - go.opentelemetry.io/otel/exporters/prometheus experimental-logs: - version: v0.18.0 + version: v0.19.0 modules: - go.opentelemetry.io/otel/log - go.opentelemetry.io/otel/log/logtest @@ -64,3 +64,6 @@ modules: go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp: version-refs: - ./internal/version.go + go.opentelemetry.io/otel/exporters/stdout/stdoutlog: + version-refs: + - ./internal/version.go diff --git a/vendor/go.opentelemetry.io/proto/otlp/common/v1/common.pb.go b/vendor/go.opentelemetry.io/proto/otlp/common/v1/common.pb.go index 1f8d49bc98379..304f647637403 100644 --- a/vendor/go.opentelemetry.io/proto/otlp/common/v1/common.pb.go +++ b/vendor/go.opentelemetry.io/proto/otlp/common/v1/common.pb.go @@ -53,6 +53,7 @@ type AnyValue struct { // *AnyValue_ArrayValue // *AnyValue_KvlistValue // *AnyValue_BytesValue + // *AnyValue_StringValueStrindex Value isAnyValue_Value `protobuf_oneof:"value"` } @@ -144,6 +145,13 @@ func (x *AnyValue) GetBytesValue() []byte { return nil } +func (x *AnyValue) GetStringValueStrindex() int32 { + if x, ok := x.GetValue().(*AnyValue_StringValueStrindex); ok { + return x.StringValueStrindex + } + return 0 +} + type isAnyValue_Value interface { isAnyValue_Value() } @@ -176,6 +184,20 @@ type AnyValue_BytesValue struct { BytesValue []byte `protobuf:"bytes,7,opt,name=bytes_value,json=bytesValue,proto3,oneof"` } +type AnyValue_StringValueStrindex struct { + // Reference to the string value in ProfilesDictionary.string_table. + // + // Note: This is currently used exclusively in the Profiling signal. + // Implementers of OTLP receivers for signals other than Profiling should + // treat the presence of this value as a non-fatal issue. + // Log an error or warning indicating an unexpected field intended for the + // Profiling signal and process the data as if this value were absent or + // empty, ignoring its semantic content for the non-Profiling signal. + // + // Status: [Development] + StringValueStrindex int32 `protobuf:"varint,8,opt,name=string_value_strindex,json=stringValueStrindex,proto3,oneof"` +} + func (*AnyValue_StringValue) isAnyValue_Value() {} func (*AnyValue_BoolValue) isAnyValue_Value() {} @@ -190,6 +212,8 @@ func (*AnyValue_KvlistValue) isAnyValue_Value() {} func (*AnyValue_BytesValue) isAnyValue_Value() {} +func (*AnyValue_StringValueStrindex) isAnyValue_Value() {} + // ArrayValue is a list of AnyValue messages. We need ArrayValue as a message // since oneof in AnyValue does not allow repeated fields. type ArrayValue struct { @@ -306,9 +330,22 @@ type KeyValue struct { unknownFields protoimpl.UnknownFields // The key name of the pair. + // key_ref MUST NOT be set if key is used. Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // The value of the pair. Value *AnyValue `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + // Reference to the string key in ProfilesDictionary.string_table. + // key MUST NOT be set if key_strindex is used. + // + // Note: This is currently used exclusively in the Profiling signal. + // Implementers of OTLP receivers for signals other than Profiling should + // treat the presence of this key as a non-fatal issue. + // Log an error or warning indicating an unexpected field intended for the + // Profiling signal and process the data as if this value were absent or + // empty, ignoring its semantic content for the non-Profiling signal. + // + // Status: [Development] + KeyStrindex int32 `protobuf:"varint,3,opt,name=key_strindex,json=keyStrindex,proto3" json:"key_strindex,omitempty"` } func (x *KeyValue) Reset() { @@ -357,6 +394,13 @@ func (x *KeyValue) GetValue() *AnyValue { return nil } +func (x *KeyValue) GetKeyStrindex() int32 { + if x != nil { + return x.KeyStrindex + } + return 0 +} + // InstrumentationScope is a message representing the instrumentation scope information // such as the fully qualified name and version. type InstrumentationScope struct { @@ -543,7 +587,7 @@ var file_opentelemetry_proto_common_v1_common_proto_rawDesc = []byte{ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1d, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x22, 0xe0, 0x02, 0x0a, 0x08, + 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x22, 0x96, 0x03, 0x0a, 0x08, 0x41, 0x6e, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, 0x0a, @@ -565,52 +609,58 @@ var file_opentelemetry_proto_common_v1_common_proto_rawDesc = []byte{ 0x69, 0x73, 0x74, 0x48, 0x00, 0x52, 0x0b, 0x6b, 0x76, 0x6c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0b, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x0a, 0x62, 0x79, 0x74, 0x65, 0x73, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x4d, - 0x0a, 0x0a, 0x41, 0x72, 0x72, 0x61, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3f, 0x0a, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, - 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6e, 0x79, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x22, 0x4f, 0x0a, - 0x0c, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x3f, 0x0a, - 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, - 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x65, - 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x22, 0x5b, - 0x0a, 0x08, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x3d, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6e, 0x79, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xc7, 0x01, 0x0a, 0x14, - 0x49, 0x6e, 0x73, 0x74, 0x72, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, - 0x63, 0x6f, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x12, 0x47, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, - 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, - 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, - 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, - 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x38, 0x0a, 0x18, 0x64, - 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, - 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x16, 0x64, - 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x82, 0x01, 0x0a, 0x09, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, - 0x52, 0x65, 0x66, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, 0x75, 0x72, - 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x55, - 0x72, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x69, 0x64, 0x5f, 0x6b, 0x65, 0x79, - 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x69, 0x64, 0x4b, 0x65, 0x79, 0x73, 0x12, - 0x29, 0x0a, 0x10, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6b, - 0x65, 0x79, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x64, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x73, 0x42, 0x7b, 0x0a, 0x20, 0x69, 0x6f, - 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x42, 0x0b, - 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x28, 0x67, - 0x6f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, - 0x69, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6f, 0x74, 0x6c, 0x70, 0x2f, 0x63, 0x6f, - 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0xaa, 0x02, 0x1d, 0x4f, 0x70, 0x65, 0x6e, 0x54, 0x65, - 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, - 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x34, 0x0a, 0x15, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x08, + 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x13, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, + 0x6c, 0x75, 0x65, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x42, 0x07, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x22, 0x4d, 0x0a, 0x0a, 0x41, 0x72, 0x72, 0x61, 0x79, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x12, 0x3f, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, + 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, + 0x76, 0x31, 0x2e, 0x41, 0x6e, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x06, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x22, 0x4f, 0x0a, 0x0c, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4c, + 0x69, 0x73, 0x74, 0x12, 0x3f, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, + 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, + 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x06, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x22, 0x7e, 0x0a, 0x08, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x12, 0x3d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, + 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, + 0x31, 0x2e, 0x41, 0x6e, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x6b, 0x65, 0x79, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x64, 0x65, + 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x6b, 0x65, 0x79, 0x53, 0x74, 0x72, 0x69, + 0x6e, 0x64, 0x65, 0x78, 0x22, 0xc7, 0x01, 0x0a, 0x14, 0x49, 0x6e, 0x73, 0x74, 0x72, 0x75, 0x6d, + 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x12, 0x0a, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x47, 0x0a, 0x0a, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x27, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, + 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x65, 0x73, 0x12, 0x38, 0x0a, 0x18, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x5f, + 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x16, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x41, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x82, + 0x01, 0x0a, 0x09, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x52, 0x65, 0x66, 0x12, 0x1d, 0x0a, 0x0a, + 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x09, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x55, 0x72, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x74, + 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, + 0x17, 0x0a, 0x07, 0x69, 0x64, 0x5f, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x06, 0x69, 0x64, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x29, 0x0a, 0x10, 0x64, 0x65, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x04, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x0f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x4b, + 0x65, 0x79, 0x73, 0x42, 0x7b, 0x0a, 0x20, 0x69, 0x6f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, + 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x63, 0x6f, + 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x28, 0x67, 0x6f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, + 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x69, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2f, 0x6f, 0x74, 0x6c, 0x70, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x76, 0x31, + 0xaa, 0x02, 0x1d, 0x4f, 0x70, 0x65, 0x6e, 0x54, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, + 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x56, 0x31, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -735,6 +785,7 @@ func file_opentelemetry_proto_common_v1_common_proto_init() { (*AnyValue_ArrayValue)(nil), (*AnyValue_KvlistValue)(nil), (*AnyValue_BytesValue)(nil), + (*AnyValue_StringValueStrindex)(nil), } type x struct{} out := protoimpl.TypeBuilder{ diff --git a/vendor/golang.org/x/net/http2/http2.go b/vendor/golang.org/x/net/http2/http2.go index 6320f4eb4c1ba..0b99d832faa97 100644 --- a/vendor/golang.org/x/net/http2/http2.go +++ b/vendor/golang.org/x/net/http2/http2.go @@ -4,13 +4,17 @@ // Package http2 implements the HTTP/2 protocol. // -// This package is low-level and intended to be used directly by very -// few people. Most users will use it indirectly through the automatic -// use by the net/http package (from Go 1.6 and later). -// For use in earlier Go versions see ConfigureServer. (Transport support -// requires Go 1.6 or later) +// Almost no users should need to import this package directly. +// The net/http package supports HTTP/2 natively. // -// See https://http2.github.io/ for more information on HTTP/2. +// To enable or disable HTTP/2 support in net/http clients and servers, see +// [http.Transport.Protocols] and [http.Server.Protocols]. +// +// To configure HTTP/2 parameters, see +// [http.Transport.HTTP2] and [http.Server.HTTP2]. +// +// To create HTTP/1 or HTTP/2 connections, see +// [http.Transport.NewClientConn]. package http2 // import "golang.org/x/net/http2" import ( diff --git a/vendor/golang.org/x/net/http2/server.go b/vendor/golang.org/x/net/http2/server.go index 7ef807f79df98..65da5175c9baf 100644 --- a/vendor/golang.org/x/net/http2/server.go +++ b/vendor/golang.org/x/net/http2/server.go @@ -164,6 +164,8 @@ type Server struct { // NewWriteScheduler constructs a write scheduler for a connection. // If nil, a default scheduler is chosen. + // + // Deprecated: User-provided write schedulers are deprecated. NewWriteScheduler func() WriteScheduler // CountError, if non-nil, is called on HTTP/2 server errors. diff --git a/vendor/golang.org/x/net/http2/transport.go b/vendor/golang.org/x/net/http2/transport.go index 8cf64b78e288a..2e9c2f6a52b45 100644 --- a/vendor/golang.org/x/net/http2/transport.go +++ b/vendor/golang.org/x/net/http2/transport.go @@ -712,10 +712,6 @@ func canRetryError(err error) bool { return true } if se, ok := err.(StreamError); ok { - if se.Code == ErrCodeProtocol && se.Cause == errFromPeer { - // See golang/go#47635, golang/go#42777 - return true - } return se.Code == ErrCodeRefusedStream } return false @@ -3233,10 +3229,6 @@ func (gz *gzipReader) Close() error { return gz.body.Close() } -type errorReader struct{ err error } - -func (r errorReader) Read(p []byte) (int, error) { return 0, r.err } - // isConnectionCloseRequest reports whether req should use its own // connection for a single request and then close the connection. func isConnectionCloseRequest(req *http.Request) bool { diff --git a/vendor/golang.org/x/net/http2/writesched.go b/vendor/golang.org/x/net/http2/writesched.go index 7de27be525094..551545f313ff1 100644 --- a/vendor/golang.org/x/net/http2/writesched.go +++ b/vendor/golang.org/x/net/http2/writesched.go @@ -8,6 +8,8 @@ import "fmt" // WriteScheduler is the interface implemented by HTTP/2 write schedulers. // Methods are never called concurrently. +// +// Deprecated: User-provided write schedulers are deprecated. type WriteScheduler interface { // OpenStream opens a new stream in the write scheduler. // It is illegal to call this with streamID=0 or with a streamID that is @@ -38,6 +40,8 @@ type WriteScheduler interface { } // OpenStreamOptions specifies extra options for WriteScheduler.OpenStream. +// +// Deprecated: User-provided write schedulers are deprecated. type OpenStreamOptions struct { // PusherID is zero if the stream was initiated by the client. Otherwise, // PusherID names the stream that pushed the newly opened stream. @@ -47,6 +51,8 @@ type OpenStreamOptions struct { } // FrameWriteRequest is a request to write a frame. +// +// Deprecated: User-provided write schedulers are deprecated. type FrameWriteRequest struct { // write is the interface value that does the writing, once the // WriteScheduler has selected this frame to write. The write diff --git a/vendor/golang.org/x/net/http2/writesched_priority_rfc7540.go b/vendor/golang.org/x/net/http2/writesched_priority_rfc7540.go index 7803a9261b019..c3d3e9bed6323 100644 --- a/vendor/golang.org/x/net/http2/writesched_priority_rfc7540.go +++ b/vendor/golang.org/x/net/http2/writesched_priority_rfc7540.go @@ -14,6 +14,8 @@ import ( const priorityDefaultWeightRFC7540 = 15 // 16 = 15 + 1 // PriorityWriteSchedulerConfig configures a priorityWriteScheduler. +// +// Deprecated: User-provided write schedulers are deprecated. type PriorityWriteSchedulerConfig struct { // MaxClosedNodesInTree controls the maximum number of closed streams to // retain in the priority tree. Setting this to zero saves a small amount @@ -55,6 +57,9 @@ type PriorityWriteSchedulerConfig struct { // NewPriorityWriteScheduler constructs a WriteScheduler that schedules // frames by following HTTP/2 priorities as described in RFC 7540 Section 5.3. // If cfg is nil, default options are used. +// +// Deprecated: The RFC 7540 write scheduler has known bugs and performance issues, +// and RFC 7540 prioritization was deprecated in RFC 9113. func NewPriorityWriteScheduler(cfg *PriorityWriteSchedulerConfig) WriteScheduler { return newPriorityWriteSchedulerRFC7540(cfg) } diff --git a/vendor/golang.org/x/net/http2/writesched_random.go b/vendor/golang.org/x/net/http2/writesched_random.go index f2e55e05ce908..d5d4e22148976 100644 --- a/vendor/golang.org/x/net/http2/writesched_random.go +++ b/vendor/golang.org/x/net/http2/writesched_random.go @@ -10,6 +10,8 @@ import "math" // priorities. Control frames like SETTINGS and PING are written before DATA // frames, but if no control frames are queued and multiple streams have queued // HEADERS or DATA frames, Pop selects a ready stream arbitrarily. +// +// Deprecated: User-provided write schedulers are deprecated. func NewRandomWriteScheduler() WriteScheduler { return &randomWriteScheduler{sq: make(map[uint32]*writeQueue)} } diff --git a/vendor/google.golang.org/genproto/googleapis/api/httpbody/httpbody.pb.go b/vendor/google.golang.org/genproto/googleapis/api/httpbody/httpbody.pb.go index d083dde3ed782..902ae44983d8d 100644 --- a/vendor/google.golang.org/genproto/googleapis/api/httpbody/httpbody.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/api/httpbody/httpbody.pb.go @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/vendor/google.golang.org/genproto/googleapis/rpc/code/code.pb.go b/vendor/google.golang.org/genproto/googleapis/rpc/code/code.pb.go index 85a9387f79f2e..d7e7647d883d3 100644 --- a/vendor/google.golang.org/genproto/googleapis/rpc/code/code.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/rpc/code/code.pb.go @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/vendor/google.golang.org/genproto/googleapis/rpc/errdetails/error_details.pb.go b/vendor/google.golang.org/genproto/googleapis/rpc/errdetails/error_details.pb.go index e017ef0714292..842a5d9b5fcb8 100644 --- a/vendor/google.golang.org/genproto/googleapis/rpc/errdetails/error_details.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/rpc/errdetails/error_details.pb.go @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -957,17 +957,17 @@ type BadRequest_FieldViolation struct { // In this example, in proto `field` could take one of the following values: // // - `full_name` for a violation in the `full_name` value - // - `email_addresses[1].email` for a violation in the `email` field of the + // - `email_addresses[0].email` for a violation in the `email` field of the // first `email_addresses` message - // - `email_addresses[3].type[2]` for a violation in the second `type` + // - `email_addresses[2].type[1]` for a violation in the second `type` // value in the third `email_addresses` message. // // In JSON, the same values are represented as: // // - `fullName` for a violation in the `fullName` value - // - `emailAddresses[1].email` for a violation in the `email` field of the + // - `emailAddresses[0].email` for a violation in the `email` field of the // first `emailAddresses` message - // - `emailAddresses[3].type[2]` for a violation in the second `type` + // - `emailAddresses[2].type[1]` for a violation in the second `type` // value in the third `emailAddresses` message. Field string `protobuf:"bytes,1,opt,name=field,proto3" json:"field,omitempty"` // A description of why the request element is bad. diff --git a/vendor/google.golang.org/genproto/googleapis/rpc/status/status.pb.go b/vendor/google.golang.org/genproto/googleapis/rpc/status/status.pb.go index 06a3f71063360..f25a7bcc77894 100644 --- a/vendor/google.golang.org/genproto/googleapis/rpc/status/status.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/rpc/status/status.pb.go @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -127,14 +127,13 @@ var file_google_rpc_status_proto_rawDesc = []byte{ 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x2e, 0x0a, 0x07, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x18, 0x03, 0x20, 0x03, 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, - 0x07, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x42, 0x61, 0x0a, 0x0e, 0x63, 0x6f, 0x6d, 0x2e, + 0x07, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x42, 0x5e, 0x0a, 0x0e, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x72, 0x70, 0x63, 0x42, 0x0b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x37, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x67, 0x65, 0x6e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x3b, 0x73, 0x74, 0x61, 0x74, - 0x75, 0x73, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x52, 0x50, 0x43, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x75, 0x73, 0xa2, 0x02, 0x03, 0x52, 0x50, 0x43, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/vendor/google.golang.org/grpc/attributes/attributes.go b/vendor/google.golang.org/grpc/attributes/attributes.go index 52d530d7ad01c..4c60518c74f17 100644 --- a/vendor/google.golang.org/grpc/attributes/attributes.go +++ b/vendor/google.golang.org/grpc/attributes/attributes.go @@ -27,6 +27,8 @@ package attributes import ( "fmt" + "iter" + "maps" "strings" ) @@ -37,37 +39,46 @@ import ( // any) bool', it will be called by (*Attributes).Equal to determine whether // two values with the same key should be considered equal. type Attributes struct { - m map[any]any + parent *Attributes + key, value any } // New returns a new Attributes containing the key/value pair. func New(key, value any) *Attributes { - return &Attributes{m: map[any]any{key: value}} + return &Attributes{ + key: key, + value: value, + } } // WithValue returns a new Attributes containing the previous keys and values // and the new key/value pair. If the same key appears multiple times, the -// last value overwrites all previous values for that key. To remove an -// existing key, use a nil value. value should not be modified later. +// last value overwrites all previous values for that key. value should not be +// modified later. +// +// Note that Attributes do not support deletion. Avoid using untyped nil values. +// Since the Value method returns an untyped nil when a key is absent, it is +// impossible to distinguish between a missing key and a key explicitly set to +// an untyped nil. If you need to represent a value being unset, consider +// storing a specific sentinel type or a wrapper struct with a boolean field +// indicating presence. func (a *Attributes) WithValue(key, value any) *Attributes { - if a == nil { - return New(key, value) + return &Attributes{ + parent: a, + key: key, + value: value, } - n := &Attributes{m: make(map[any]any, len(a.m)+1)} - for k, v := range a.m { - n.m[k] = v - } - n.m[key] = value - return n } // Value returns the value associated with these attributes for key, or nil if // no value is associated with key. The returned value should not be modified. func (a *Attributes) Value(key any) any { - if a == nil { - return nil + for cur := a; cur != nil; cur = cur.parent { + if cur.key == key { + return cur.value + } } - return a.m[key] + return nil } // Equal returns whether a and o are equivalent. If 'Equal(o any) bool' is @@ -83,11 +94,15 @@ func (a *Attributes) Equal(o *Attributes) bool { if a == nil || o == nil { return false } - if len(a.m) != len(o.m) { - return false + if a == o { + return true } - for k, v := range a.m { - ov, ok := o.m[k] + m := maps.Collect(o.all()) + lenA := 0 + + for k, v := range a.all() { + lenA++ + ov, ok := m[k] if !ok { // o missing element of a return false @@ -101,7 +116,7 @@ func (a *Attributes) Equal(o *Attributes) bool { return false } } - return true + return lenA == len(m) } // String prints the attribute map. If any key or values throughout the map @@ -110,11 +125,11 @@ func (a *Attributes) String() string { var sb strings.Builder sb.WriteString("{") first := true - for k, v := range a.m { + for k, v := range a.all() { if !first { sb.WriteString(", ") } - sb.WriteString(fmt.Sprintf("%q: %q ", str(k), str(v))) + fmt.Fprintf(&sb, "%q: %q ", str(k), str(v)) first = false } sb.WriteString("}") @@ -139,3 +154,21 @@ func str(x any) (s string) { func (a *Attributes) MarshalJSON() ([]byte, error) { return []byte(a.String()), nil } + +// all returns an iterator that yields all key-value pairs in the Attributes +// chain. If a key appears multiple times, only the most recently added value +// is yielded. +func (a *Attributes) all() iter.Seq2[any, any] { + return func(yield func(any, any) bool) { + seen := map[any]bool{} + for cur := a; cur != nil; cur = cur.parent { + if seen[cur.key] { + continue + } + if !yield(cur.key, cur.value) { + return + } + seen[cur.key] = true + } + } +} diff --git a/vendor/google.golang.org/grpc/balancer/balancer.go b/vendor/google.golang.org/grpc/balancer/balancer.go index d08b7ad6371b2..326888ae35aaa 100644 --- a/vendor/google.golang.org/grpc/balancer/balancer.go +++ b/vendor/google.golang.org/grpc/balancer/balancer.go @@ -33,6 +33,7 @@ import ( estats "google.golang.org/grpc/experimental/stats" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/internal" + "google.golang.org/grpc/internal/envconfig" "google.golang.org/grpc/metadata" "google.golang.org/grpc/resolver" "google.golang.org/grpc/serviceconfig" @@ -46,8 +47,8 @@ var ( ) // Register registers the balancer builder to the balancer map. b.Name -// (lowercased) will be used as the name registered with this builder. If the -// Builder implements ConfigParser, ParseConfig will be called when new service +// will be used as the name registered with this builder. If the Builder +// implements ConfigParser, ParseConfig will be called when new service // configs are received by the resolver, and the result will be provided to the // Balancer in UpdateClientConnState. // @@ -55,12 +56,12 @@ var ( // an init() function), and is not thread-safe. If multiple Balancers are // registered with the same name, the one registered last will take effect. func Register(b Builder) { - name := strings.ToLower(b.Name()) - if name != b.Name() { - // TODO: Skip the use of strings.ToLower() to index the map after v1.59 - // is released to switch to case sensitive balancer registry. Also, - // remove this warning and update the docstrings for Register and Get. - logger.Warningf("Balancer registered with name %q. grpc-go will be switching to case sensitive balancer registries soon", b.Name()) + name := b.Name() + if !envconfig.CaseSensitiveBalancerRegistries { + name = strings.ToLower(name) + if name != b.Name() { + logger.Warningf("Balancer registered with name %q. grpc-go will be switching to case sensitive balancer registries soon. After 2 releases, we will enable the env var by default.", b.Name()) + } } m[name] = b } @@ -78,16 +79,17 @@ func init() { } // Get returns the resolver builder registered with the given name. -// Note that the compare is done in a case-insensitive fashion. +// Note that the compare is done in a case-sensitive fashion. // If no builder is register with the name, nil will be returned. func Get(name string) Builder { - if strings.ToLower(name) != name { - // TODO: Skip the use of strings.ToLower() to index the map after v1.59 - // is released to switch to case sensitive balancer registry. Also, - // remove this warning and update the docstrings for Register and Get. - logger.Warningf("Balancer retrieved for name %q. grpc-go will be switching to case sensitive balancer registries soon", name) + if !envconfig.CaseSensitiveBalancerRegistries { + lowerName := strings.ToLower(name) + if lowerName != name { + logger.Warningf("Balancer retrieved for name %q. grpc-go will be switching to case sensitive balancer registries soon. After 2 releases, we will enable the env var by default.", name) + } + name = lowerName } - if b, ok := m[strings.ToLower(name)]; ok { + if b, ok := m[name]; ok { return b } return nil diff --git a/vendor/google.golang.org/grpc/balancer/base/balancer.go b/vendor/google.golang.org/grpc/balancer/base/balancer.go index 4d576876d8c80..4399ba0140b33 100644 --- a/vendor/google.golang.org/grpc/balancer/base/balancer.go +++ b/vendor/google.golang.org/grpc/balancer/base/balancer.go @@ -121,8 +121,7 @@ func (b *baseBalancer) UpdateClientConnState(s balancer.ClientConnState) error { sc.Connect() } } - for _, a := range b.subConns.Keys() { - sc, _ := b.subConns.Get(a) + for a, sc := range b.subConns.All() { // a was removed by resolver. if _, ok := addrsSet.Get(a); !ok { sc.Shutdown() @@ -171,8 +170,7 @@ func (b *baseBalancer) regeneratePicker() { readySCs := make(map[balancer.SubConn]SubConnInfo) // Filter out all ready SCs from full subConn map. - for _, addr := range b.subConns.Keys() { - sc, _ := b.subConns.Get(addr) + for addr, sc := range b.subConns.All() { if st, ok := b.scStates[sc]; ok && st == connectivity.Ready { readySCs[sc] = SubConnInfo{Address: addr} } diff --git a/vendor/google.golang.org/grpc/balancer/endpointsharding/endpointsharding.go b/vendor/google.golang.org/grpc/balancer/endpointsharding/endpointsharding.go index 360db08ebc13d..12479f69851fc 100644 --- a/vendor/google.golang.org/grpc/balancer/endpointsharding/endpointsharding.go +++ b/vendor/google.golang.org/grpc/balancer/endpointsharding/endpointsharding.go @@ -187,8 +187,7 @@ func (es *endpointSharding) UpdateClientConnState(state balancer.ClientConnState } } // Delete old children that are no longer present. - for _, e := range children.Keys() { - child, _ := children.Get(e) + for e, child := range children.All() { if _, ok := newChildren.Get(e); !ok { child.closeLocked() } @@ -212,7 +211,7 @@ func (es *endpointSharding) ResolverError(err error) { es.updateState() }() children := es.children.Load() - for _, child := range children.Values() { + for _, child := range children.All() { child.resolverErrorLocked(err) } } @@ -225,7 +224,7 @@ func (es *endpointSharding) Close() { es.childMu.Lock() defer es.childMu.Unlock() children := es.children.Load() - for _, child := range children.Values() { + for _, child := range children.All() { child.closeLocked() } } @@ -233,7 +232,7 @@ func (es *endpointSharding) Close() { func (es *endpointSharding) ExitIdle() { es.childMu.Lock() defer es.childMu.Unlock() - for _, bw := range es.children.Load().Values() { + for _, bw := range es.children.Load().All() { if !bw.isClosed { bw.child.ExitIdle() } @@ -255,7 +254,7 @@ func (es *endpointSharding) updateState() { children := es.children.Load() childStates := make([]ChildState, 0, children.Len()) - for _, child := range children.Values() { + for _, child := range children.All() { childState := child.childState childStates = append(childStates, childState) childPicker := childState.State.Picker diff --git a/vendor/google.golang.org/grpc/balancer/pickfirst/pickfirst.go b/vendor/google.golang.org/grpc/balancer/pickfirst/pickfirst.go index dccd9f0bf3988..518a69d573dea 100644 --- a/vendor/google.golang.org/grpc/balancer/pickfirst/pickfirst.go +++ b/vendor/google.golang.org/grpc/balancer/pickfirst/pickfirst.go @@ -399,14 +399,14 @@ func (b *pickfirstBalancer) startFirstPassLocked() { b.firstPass = true b.numTF = 0 // Reset the connection attempt record for existing SubConns. - for _, sd := range b.subConns.Values() { + for _, sd := range b.subConns.All() { sd.connectionFailedInFirstPass = false } b.requestConnectionLocked() } func (b *pickfirstBalancer) closeSubConnsLocked() { - for _, sd := range b.subConns.Values() { + for _, sd := range b.subConns.All() { sd.subConn.Shutdown() } b.subConns = resolver.NewAddressMapV2[*scData]() @@ -506,7 +506,7 @@ func (b *pickfirstBalancer) reconcileSubConnsLocked(newAddrs []resolver.Address) newAddrsMap.Set(addr, true) } - for _, oldAddr := range b.subConns.Keys() { + for oldAddr := range b.subConns.All() { if _, ok := newAddrsMap.Get(oldAddr); ok { continue } @@ -520,7 +520,7 @@ func (b *pickfirstBalancer) reconcileSubConnsLocked(newAddrs []resolver.Address) // becomes ready, which means that all other subConn must be shutdown. func (b *pickfirstBalancer) shutdownRemainingLocked(selected *scData) { b.cancelConnectionTimer() - for _, sd := range b.subConns.Values() { + for _, sd := range b.subConns.All() { if sd.subConn != selected.subConn { sd.subConn.Shutdown() } @@ -771,7 +771,7 @@ func (b *pickfirstBalancer) endFirstPassIfPossibleLocked(lastErr error) { } // Connect() has been called on all the SubConns. The first pass can be // ended if all the SubConns have reported a failure. - for _, sd := range b.subConns.Values() { + for _, sd := range b.subConns.All() { if !sd.connectionFailedInFirstPass { return } @@ -782,7 +782,7 @@ func (b *pickfirstBalancer) endFirstPassIfPossibleLocked(lastErr error) { Picker: &picker{err: lastErr}, }) // Start re-connecting all the SubConns that are already in IDLE. - for _, sd := range b.subConns.Values() { + for _, sd := range b.subConns.All() { if sd.rawConnectivityState == connectivity.Idle { sd.subConn.Connect() } diff --git a/vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go b/vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go index 42c61cf9fe520..296123e20d487 100644 --- a/vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go +++ b/vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go @@ -18,7 +18,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.10 +// protoc-gen-go v1.36.11 // protoc v5.27.1 // source: grpc/binlog/v1/binarylog.proto diff --git a/vendor/google.golang.org/grpc/credentials/tls.go b/vendor/google.golang.org/grpc/credentials/tls.go index 0bcd16dbbf1d5..a6083c3b0389c 100644 --- a/vendor/google.golang.org/grpc/credentials/tls.go +++ b/vendor/google.golang.org/grpc/credentials/tls.go @@ -22,7 +22,6 @@ import ( "context" "crypto/tls" "crypto/x509" - "errors" "fmt" "net" "net/url" @@ -52,22 +51,21 @@ func (t TLSInfo) AuthType() string { } // ValidateAuthority validates the provided authority being used to override the -// :authority header by verifying it against the peer certificates. It returns a +// :authority header by verifying it against the peer certificate. It returns a // non-nil error if the validation fails. func (t TLSInfo) ValidateAuthority(authority string) error { - var errs []error host, _, err := net.SplitHostPort(authority) if err != nil { host = authority } - for _, cert := range t.State.PeerCertificates { - var err error - if err = cert.VerifyHostname(host); err == nil { - return nil - } - errs = append(errs, err) + + // Verify authority against the leaf certificate. + if len(t.State.PeerCertificates) == 0 { + // This is not expected to happen as the TLS handshake has already + // completed and should have populated PeerCertificates. + return fmt.Errorf("credentials: no peer certificates found to verify authority %q", host) } - return fmt.Errorf("credentials: invalid authority %q: %v", authority, errors.Join(errs...)) + return t.State.PeerCertificates[0].VerifyHostname(host) } // cipherSuiteLookup returns the string version of a TLS cipher suite ID. diff --git a/vendor/google.golang.org/grpc/dialoptions.go b/vendor/google.golang.org/grpc/dialoptions.go index 7a5ac2e7c4948..4ec5f9cd093a9 100644 --- a/vendor/google.golang.org/grpc/dialoptions.go +++ b/vendor/google.golang.org/grpc/dialoptions.go @@ -705,10 +705,11 @@ func WithDisableHealthCheck() DialOption { func defaultDialOptions() dialOptions { return dialOptions{ copts: transport.ConnectOptions{ - ReadBufferSize: defaultReadBufSize, - WriteBufferSize: defaultWriteBufSize, - UserAgent: grpcUA, - BufferPool: mem.DefaultBufferPool(), + ReadBufferSize: defaultReadBufSize, + WriteBufferSize: defaultWriteBufSize, + SharedWriteBuffer: true, + UserAgent: grpcUA, + BufferPool: mem.DefaultBufferPool(), }, bs: internalbackoff.DefaultExponential, idleTimeout: 30 * time.Minute, diff --git a/vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go b/vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go index 8f7d9f6bbe6d3..dcb98cdbc1ebb 100644 --- a/vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go +++ b/vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go @@ -17,7 +17,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.10 +// protoc-gen-go v1.36.11 // protoc v5.27.1 // source: grpc/health/v1/health.proto diff --git a/vendor/google.golang.org/grpc/health/grpc_health_v1/health_grpc.pb.go b/vendor/google.golang.org/grpc/health/grpc_health_v1/health_grpc.pb.go index e99cd5c838588..9e10fdd2eb912 100644 --- a/vendor/google.golang.org/grpc/health/grpc_health_v1/health_grpc.pb.go +++ b/vendor/google.golang.org/grpc/health/grpc_health_v1/health_grpc.pb.go @@ -17,7 +17,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.6.0 +// - protoc-gen-go-grpc v1.6.1 // - protoc v5.27.1 // source: grpc/health/v1/health.proto diff --git a/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go b/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go index 7ad6fb44ca859..3ae45faa40199 100644 --- a/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go +++ b/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go @@ -54,17 +54,16 @@ var ( // XDSEndpointHashKeyBackwardCompat controls the parsing of the endpoint hash // key from EDS LbEndpoint metadata. Endpoint hash keys can be disabled by - // setting "GRPC_XDS_ENDPOINT_HASH_KEY_BACKWARD_COMPAT" to "true". When the - // implementation of A76 is stable, we will flip the default value to false - // in a subsequent release. A final release will remove this environment - // variable, enabling the new behavior unconditionally. - XDSEndpointHashKeyBackwardCompat = boolFromEnv("GRPC_XDS_ENDPOINT_HASH_KEY_BACKWARD_COMPAT", true) + // setting "GRPC_XDS_ENDPOINT_HASH_KEY_BACKWARD_COMPAT" to "true". A future + // release will remove this environment variable, enabling the new behavior + // unconditionally. + XDSEndpointHashKeyBackwardCompat = boolFromEnv("GRPC_XDS_ENDPOINT_HASH_KEY_BACKWARD_COMPAT", false) // RingHashSetRequestHashKey is set if the ring hash balancer can get the // request hash header by setting the "requestHashHeader" field, according - // to gRFC A76. It can be enabled by setting the environment variable - // "GRPC_EXPERIMENTAL_RING_HASH_SET_REQUEST_HASH_KEY" to "true". - RingHashSetRequestHashKey = boolFromEnv("GRPC_EXPERIMENTAL_RING_HASH_SET_REQUEST_HASH_KEY", false) + // to gRFC A76. It can be disabled by setting the environment variable + // "GRPC_EXPERIMENTAL_RING_HASH_SET_REQUEST_HASH_KEY" to "false". + RingHashSetRequestHashKey = boolFromEnv("GRPC_EXPERIMENTAL_RING_HASH_SET_REQUEST_HASH_KEY", true) // ALTSHandshakerKeepaliveParams is set if we should add the // KeepaliveParams when dial the ALTS handshaker service. @@ -78,6 +77,14 @@ var ( // - The DNS resolver is being used. EnableDefaultPortForProxyTarget = boolFromEnv("GRPC_EXPERIMENTAL_ENABLE_DEFAULT_PORT_FOR_PROXY_TARGET", true) + // CaseSensitiveBalancerRegistries is set if the balancer registry should be + // case-sensitive. This is disabled by default, but can be enabled by setting + // the env variable "GRPC_GO_EXPERIMENTAL_CASE_SENSITIVE_BALANCER_REGISTRIES" + // to "true". + // + // TODO: After 2 releases, we will enable the env var by default. + CaseSensitiveBalancerRegistries = boolFromEnv("GRPC_GO_EXPERIMENTAL_CASE_SENSITIVE_BALANCER_REGISTRIES", false) + // XDSAuthorityRewrite indicates whether xDS authority rewriting is enabled. // This feature is defined in gRFC A81 and is enabled by setting the // environment variable GRPC_EXPERIMENTAL_XDS_AUTHORITY_REWRITE to "true". @@ -89,6 +96,14 @@ var ( // GRPC_EXPERIMENTAL_PF_WEIGHTED_SHUFFLING to "false". PickFirstWeightedShuffling = boolFromEnv("GRPC_EXPERIMENTAL_PF_WEIGHTED_SHUFFLING", true) + // XDSRecoverPanicInResourceParsing indicates whether the xdsclient should + // recover from panics while parsing xDS resources. + // + // This feature can be disabled (e.g. for fuzz testing) by setting the + // environment variable "GRPC_GO_EXPERIMENTAL_XDS_RESOURCE_PANIC_RECOVERY" + // to "false". + XDSRecoverPanicInResourceParsing = boolFromEnv("GRPC_GO_EXPERIMENTAL_XDS_RESOURCE_PANIC_RECOVERY", true) + // DisableStrictPathChecking indicates whether strict path checking is // disabled. This feature can be disabled by setting the environment // variable GRPC_GO_EXPERIMENTAL_DISABLE_STRICT_PATH_CHECKING to "true". @@ -104,6 +119,13 @@ var ( // A future release will remove this environment variable, enabling strict // path checking behavior unconditionally. DisableStrictPathChecking = boolFromEnv("GRPC_GO_EXPERIMENTAL_DISABLE_STRICT_PATH_CHECKING", false) + + // EnablePriorityLBChildPolicyCache controls whether the priority balancer + // should cache child balancers that are removed from the LB policy config, + // for a period of 15 minutes. This is disabled by default, but can be + // enabled by setting the env variable + // GRPC_EXPERIMENTAL_ENABLE_PRIORITY_LB_CHILD_POLICY_CACHE to true. + EnablePriorityLBChildPolicyCache = boolFromEnv("GRPC_EXPERIMENTAL_ENABLE_PRIORITY_LB_CHILD_POLICY_CACHE", false) ) func boolFromEnv(envVar string, def bool) bool { diff --git a/vendor/google.golang.org/grpc/internal/mem/buffer_pool.go b/vendor/google.golang.org/grpc/internal/mem/buffer_pool.go new file mode 100644 index 0000000000000..c2348a82efebc --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/mem/buffer_pool.go @@ -0,0 +1,338 @@ +/* + * + * Copyright 2026 gRPC 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 mem provides utilities that facilitate memory reuse in byte slices +// that are used as buffers. +package mem + +import ( + "fmt" + "math/bits" + "slices" + "sort" + "sync" +) + +const ( + goPageSize = 4 * 1024 // 4KiB. N.B. this must be a power of 2. +) + +var uintSize = bits.UintSize // use a variable for mocking during tests. + +// bufferPool is a copy of the public bufferPool interface used to avoid +// circular dependencies. +type bufferPool interface { + // Get returns a buffer with specified length from the pool. + Get(length int) *[]byte + + // Put returns a buffer to the pool. + // + // The provided pointer must hold a prefix of the buffer obtained via + // BufferPool.Get to ensure the buffer's entire capacity can be re-used. + Put(*[]byte) +} + +// BinaryTieredBufferPool is a buffer pool that uses multiple sub-pools with +// power-of-two sizes. +type BinaryTieredBufferPool struct { + // exponentToNextLargestPoolMap maps a power-of-two exponent (e.g., 12 for + // 4KB) to the index of the next largest sizedBufferPool. This is used by + // Get() to find the smallest pool that can satisfy a request for a given + // size. + exponentToNextLargestPoolMap []int + // exponentToPreviousLargestPoolMap maps a power-of-two exponent to the + // index of the previous largest sizedBufferPool. This is used by Put() + // to return a buffer to the most appropriate pool based on its capacity. + exponentToPreviousLargestPoolMap []int + sizedPools []bufferPool + fallbackPool bufferPool + maxPoolCap int // Optimization: Cache max capacity +} + +// NewBinaryTieredBufferPool returns a BufferPool backed by multiple sub-pools. +// This structure enables O(1) lookup time for Get and Put operations. +// +// The arguments provided are the exponents for the buffer capacities (powers +// of 2), not the raw byte sizes. For example, to create a pool of 16KB buffers +// (2^14 bytes), pass 14 as the argument. +func NewBinaryTieredBufferPool(powerOfTwoExponents ...uint8) (*BinaryTieredBufferPool, error) { + return newBinaryTiered(func(size int) bufferPool { + return newSizedBufferPool(size, true) + }, &simpleBufferPool{shouldZero: true}, powerOfTwoExponents...) +} + +// NewDirtyBinaryTieredBufferPool returns a BufferPool backed by multiple +// sub-pools. It is similar to NewBinaryTieredBufferPool but it does not +// initialize the buffers before returning them. +func NewDirtyBinaryTieredBufferPool(powerOfTwoExponents ...uint8) (*BinaryTieredBufferPool, error) { + return newBinaryTiered(func(size int) bufferPool { + return newSizedBufferPool(size, false) + }, &simpleBufferPool{shouldZero: false}, powerOfTwoExponents...) +} + +func newBinaryTiered(sizedPoolFactory func(int) bufferPool, fallbackPool bufferPool, powerOfTwoExponents ...uint8) (*BinaryTieredBufferPool, error) { + slices.Sort(powerOfTwoExponents) + powerOfTwoExponents = slices.Compact(powerOfTwoExponents) + + // Determine the maximum exponent we need to support. This depends on the + // word size (32-bit vs 64-bit). + maxExponent := uintSize - 2 + indexOfNextLargestBit := slices.Repeat([]int{-1}, maxExponent+1) + indexOfPreviousLargestBit := slices.Repeat([]int{-1}, maxExponent+1) + + maxTier := 0 + pools := make([]bufferPool, 0, len(powerOfTwoExponents)) + + for i, exp := range powerOfTwoExponents { + // Allocating slices of size > 2^maxExponent isn't possible on + // maxExponent-bit machines. + if int(exp) > maxExponent { + return nil, fmt.Errorf("mem: allocating slice of size 2^%d is not possible", exp) + } + tierSize := 1 << exp + pools = append(pools, sizedPoolFactory(tierSize)) + maxTier = max(maxTier, tierSize) + + // Map the exact power of 2 to this pool index. + indexOfNextLargestBit[exp] = i + indexOfPreviousLargestBit[exp] = i + } + + // Fill gaps for Get() (Next Largest) + // We iterate backwards. If current is empty, take the value from the right (larger). + for i := maxExponent - 1; i >= 0; i-- { + if indexOfNextLargestBit[i] == -1 { + indexOfNextLargestBit[i] = indexOfNextLargestBit[i+1] + } + } + + // Fill gaps for Put() (Previous Largest) + // We iterate forwards. If current is empty, take the value from the left (smaller). + for i := 1; i <= maxExponent; i++ { + if indexOfPreviousLargestBit[i] == -1 { + indexOfPreviousLargestBit[i] = indexOfPreviousLargestBit[i-1] + } + } + + return &BinaryTieredBufferPool{ + exponentToNextLargestPoolMap: indexOfNextLargestBit, + exponentToPreviousLargestPoolMap: indexOfPreviousLargestBit, + sizedPools: pools, + maxPoolCap: maxTier, + fallbackPool: fallbackPool, + }, nil +} + +// Get returns a buffer with specified length from the pool. +func (b *BinaryTieredBufferPool) Get(size int) *[]byte { + return b.poolForGet(size).Get(size) +} + +func (b *BinaryTieredBufferPool) poolForGet(size int) bufferPool { + if size == 0 || size > b.maxPoolCap { + return b.fallbackPool + } + + // Calculate the exponent of the smallest power of 2 >= size. + // We subtract 1 from size to handle exact powers of 2 correctly. + // + // Examples: + // size=16 (0b10000) -> size-1=15 (0b01111) -> bits.Len=4 -> Pool for 2^4 + // size=17 (0b10001) -> size-1=16 (0b10000) -> bits.Len=5 -> Pool for 2^5 + querySize := uint(size - 1) + poolIdx := b.exponentToNextLargestPoolMap[bits.Len(querySize)] + + return b.sizedPools[poolIdx] +} + +// Put returns a buffer to the pool. +func (b *BinaryTieredBufferPool) Put(buf *[]byte) { + // We pass the capacity of the buffer, and not the size of the buffer here. + // If we did the latter, all buffers would eventually move to the smallest + // pool. + b.poolForPut(cap(*buf)).Put(buf) +} + +func (b *BinaryTieredBufferPool) poolForPut(bCap int) bufferPool { + if bCap == 0 { + return NopBufferPool{} + } + if bCap > b.maxPoolCap { + return b.fallbackPool + } + // Find the pool with the largest capacity <= bCap. + // + // We calculate the exponent of the largest power of 2 <= bCap. + // bits.Len(x) returns the minimum number of bits required to represent x; + // i.e. the number of bits up to and including the most significant bit. + // Subtracting 1 gives the 0-based index of the most significant bit, + // which is the exponent of the largest power of 2 <= bCap. + // + // Examples: + // cap=16 (0b10000) -> Len=5 -> 5-1=4 -> 2^4 + // cap=15 (0b01111) -> Len=4 -> 4-1=3 -> 2^3 + largestPowerOfTwo := bits.Len(uint(bCap)) - 1 + poolIdx := b.exponentToPreviousLargestPoolMap[largestPowerOfTwo] + // The buffer is smaller than the smallest power of 2, discard it. + if poolIdx == -1 { + // Buffer is smaller than our smallest pool bucket. + return NopBufferPool{} + } + return b.sizedPools[poolIdx] +} + +// NopBufferPool is a buffer pool that returns new buffers without pooling. +type NopBufferPool struct{} + +// Get returns a buffer with specified length from the pool. +func (NopBufferPool) Get(length int) *[]byte { + b := make([]byte, length) + return &b +} + +// Put returns a buffer to the pool. +func (NopBufferPool) Put(*[]byte) { +} + +// sizedBufferPool is a BufferPool implementation that is optimized for specific +// buffer sizes. For example, HTTP/2 frames within gRPC have a default max size +// of 16kb and a sizedBufferPool can be configured to only return buffers with a +// capacity of 16kb. Note that however it does not support returning larger +// buffers and in fact panics if such a buffer is requested. Because of this, +// this BufferPool implementation is not meant to be used on its own and rather +// is intended to be embedded in a TieredBufferPool such that Get is only +// invoked when the required size is smaller than or equal to defaultSize. +type sizedBufferPool struct { + pool sync.Pool + defaultSize int + shouldZero bool +} + +func (p *sizedBufferPool) Get(size int) *[]byte { + buf, ok := p.pool.Get().(*[]byte) + if !ok { + buf := make([]byte, size, p.defaultSize) + return &buf + } + b := *buf + if p.shouldZero { + clear(b[:cap(b)]) + } + *buf = b[:size] + return buf +} + +func (p *sizedBufferPool) Put(buf *[]byte) { + if cap(*buf) < p.defaultSize { + // Ignore buffers that are too small to fit in the pool. Otherwise, when + // Get is called it will panic as it tries to index outside the bounds + // of the buffer. + return + } + p.pool.Put(buf) +} + +func newSizedBufferPool(size int, zero bool) *sizedBufferPool { + return &sizedBufferPool{ + defaultSize: size, + shouldZero: zero, + } +} + +// TieredBufferPool implements the BufferPool interface with multiple tiers of +// buffer pools for different sizes of buffers. +type TieredBufferPool struct { + sizedPools []*sizedBufferPool + fallbackPool simpleBufferPool +} + +// NewTieredBufferPool returns a BufferPool implementation that uses multiple +// underlying pools of the given pool sizes. +func NewTieredBufferPool(poolSizes ...int) *TieredBufferPool { + sort.Ints(poolSizes) + pools := make([]*sizedBufferPool, len(poolSizes)) + for i, s := range poolSizes { + pools[i] = newSizedBufferPool(s, true) + } + return &TieredBufferPool{ + sizedPools: pools, + fallbackPool: simpleBufferPool{shouldZero: true}, + } +} + +// Get returns a buffer with specified length from the pool. +func (p *TieredBufferPool) Get(size int) *[]byte { + return p.getPool(size).Get(size) +} + +// Put returns a buffer to the pool. +func (p *TieredBufferPool) Put(buf *[]byte) { + p.getPool(cap(*buf)).Put(buf) +} + +func (p *TieredBufferPool) getPool(size int) bufferPool { + poolIdx := sort.Search(len(p.sizedPools), func(i int) bool { + return p.sizedPools[i].defaultSize >= size + }) + + if poolIdx == len(p.sizedPools) { + return &p.fallbackPool + } + + return p.sizedPools[poolIdx] +} + +// simpleBufferPool is an implementation of the BufferPool interface that +// attempts to pool buffers with a sync.Pool. When Get is invoked, it tries to +// acquire a buffer from the pool but if that buffer is too small, it returns it +// to the pool and creates a new one. +type simpleBufferPool struct { + pool sync.Pool + shouldZero bool +} + +func (p *simpleBufferPool) Get(size int) *[]byte { + bs, ok := p.pool.Get().(*[]byte) + if ok && cap(*bs) >= size { + if p.shouldZero { + clear((*bs)[:cap(*bs)]) + } + *bs = (*bs)[:size] + return bs + } + + // A buffer was pulled from the pool, but it is too small. Put it back in + // the pool and create one large enough. + if ok { + p.pool.Put(bs) + } + + // If we're going to allocate, round up to the nearest page. This way if + // requests frequently arrive with small variation we don't allocate + // repeatedly if we get unlucky and they increase over time. By default we + // only allocate here if size > 1MiB. Because goPageSize is a power of 2, we + // can round up efficiently. + allocSize := (size + goPageSize - 1) & ^(goPageSize - 1) + + b := make([]byte, size, allocSize) + return &b +} + +func (p *simpleBufferPool) Put(buf *[]byte) { + p.pool.Put(buf) +} diff --git a/vendor/google.golang.org/grpc/internal/transport/defaults.go b/vendor/google.golang.org/grpc/internal/transport/defaults.go index bc8ee07474968..0b2269a503941 100644 --- a/vendor/google.golang.org/grpc/internal/transport/defaults.go +++ b/vendor/google.golang.org/grpc/internal/transport/defaults.go @@ -46,6 +46,7 @@ const ( defaultWriteQuota = 64 * 1024 defaultClientMaxHeaderListSize = uint32(16 << 20) defaultServerMaxHeaderListSize = uint32(16 << 20) + upcomingDefaultHeaderListSize = uint32(8 << 10) ) // MaxStreamID is the upper bound for the stream ID before the current diff --git a/vendor/google.golang.org/grpc/internal/transport/http2_client.go b/vendor/google.golang.org/grpc/internal/transport/http2_client.go index 37b1acc340be0..c943503f35901 100644 --- a/vendor/google.golang.org/grpc/internal/transport/http2_client.go +++ b/vendor/google.golang.org/grpc/internal/transport/http2_client.go @@ -871,11 +871,15 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr, handler s } var sz int64 for _, f := range hdr.hf { - if sz += int64(f.Size()); sz > int64(*t.maxSendHeaderListSize) { + sz += int64(f.Size()) + if sz > int64(*t.maxSendHeaderListSize) { hdrListSizeErr = status.Errorf(codes.Internal, "header list size to send violates the maximum size (%d bytes) set by server", *t.maxSendHeaderListSize) return false } } + if sz > int64(upcomingDefaultHeaderListSize) { + t.logger.Warningf("Header list size to send (%d bytes) is larger than the upcoming default limit (%d bytes). In a future release, this will be restricted to %d bytes.", sz, upcomingDefaultHeaderListSize, upcomingDefaultHeaderListSize) + } return true } for { diff --git a/vendor/google.golang.org/grpc/internal/transport/http2_server.go b/vendor/google.golang.org/grpc/internal/transport/http2_server.go index a1a14e14fc8ed..3a8c36e4f94fe 100644 --- a/vendor/google.golang.org/grpc/internal/transport/http2_server.go +++ b/vendor/google.golang.org/grpc/internal/transport/http2_server.go @@ -940,13 +940,17 @@ func (t *http2Server) checkForHeaderListSize(hf []hpack.HeaderField) bool { } var sz int64 for _, f := range hf { - if sz += int64(f.Size()); sz > int64(*t.maxSendHeaderListSize) { + sz += int64(f.Size()) + if sz > int64(*t.maxSendHeaderListSize) { if t.logger.V(logLevel) { t.logger.Infof("Header list size to send violates the maximum size (%d bytes) set by client", *t.maxSendHeaderListSize) } return false } } + if sz > int64(upcomingDefaultHeaderListSize) { + t.logger.Warningf("Header list size to send (%d bytes) is larger than the upcoming default limit (%d bytes). In a future release, this will be restricted to %d bytes.", sz, upcomingDefaultHeaderListSize, upcomingDefaultHeaderListSize) + } return true } diff --git a/vendor/google.golang.org/grpc/mem/buffer_pool.go b/vendor/google.golang.org/grpc/mem/buffer_pool.go index 2ea763a49a2ff..3b02b909164fd 100644 --- a/vendor/google.golang.org/grpc/mem/buffer_pool.go +++ b/vendor/google.golang.org/grpc/mem/buffer_pool.go @@ -19,10 +19,10 @@ package mem import ( - "sort" - "sync" + "fmt" "google.golang.org/grpc/internal" + "google.golang.org/grpc/internal/mem" ) // BufferPool is a pool of buffers that can be shared and reused, resulting in @@ -38,20 +38,23 @@ type BufferPool interface { Put(*[]byte) } -const goPageSize = 4 << 10 // 4KiB. N.B. this must be a power of 2. - -var defaultBufferPoolSizes = []int{ - 256, - goPageSize, - 16 << 10, // 16KB (max HTTP/2 frame size used by gRPC) - 32 << 10, // 32KB (default buffer size for io.Copy) - 1 << 20, // 1MB -} - -var defaultBufferPool BufferPool +var ( + defaultBufferPoolSizeExponents = []uint8{ + 8, + 12, // Go page size, 4KB + 14, // 16KB (max HTTP/2 frame size used by gRPC) + 15, // 32KB (default buffer size for io.Copy) + 20, // 1MB + } + defaultBufferPool BufferPool +) func init() { - defaultBufferPool = NewTieredBufferPool(defaultBufferPoolSizes...) + var err error + defaultBufferPool, err = NewBinaryTieredBufferPool(defaultBufferPoolSizeExponents...) + if err != nil { + panic(fmt.Sprintf("Failed to create default buffer pool: %v", err)) + } internal.SetDefaultBufferPool = func(pool BufferPool) { defaultBufferPool = pool @@ -72,134 +75,22 @@ func DefaultBufferPool() BufferPool { // NewTieredBufferPool returns a BufferPool implementation that uses multiple // underlying pools of the given pool sizes. func NewTieredBufferPool(poolSizes ...int) BufferPool { - sort.Ints(poolSizes) - pools := make([]*sizedBufferPool, len(poolSizes)) - for i, s := range poolSizes { - pools[i] = newSizedBufferPool(s) - } - return &tieredBufferPool{ - sizedPools: pools, - } -} - -// tieredBufferPool implements the BufferPool interface with multiple tiers of -// buffer pools for different sizes of buffers. -type tieredBufferPool struct { - sizedPools []*sizedBufferPool - fallbackPool simpleBufferPool -} - -func (p *tieredBufferPool) Get(size int) *[]byte { - return p.getPool(size).Get(size) + return mem.NewTieredBufferPool(poolSizes...) } -func (p *tieredBufferPool) Put(buf *[]byte) { - p.getPool(cap(*buf)).Put(buf) +// NewBinaryTieredBufferPool returns a BufferPool backed by multiple sub-pools. +// This structure enables O(1) lookup time for Get and Put operations. +// +// The arguments provided are the exponents for the buffer capacities (powers +// of 2), not the raw byte sizes. For example, to create a pool of 16KB buffers +// (2^14 bytes), pass 14 as the argument. +func NewBinaryTieredBufferPool(powerOfTwoExponents ...uint8) (BufferPool, error) { + return mem.NewBinaryTieredBufferPool(powerOfTwoExponents...) } -func (p *tieredBufferPool) getPool(size int) BufferPool { - poolIdx := sort.Search(len(p.sizedPools), func(i int) bool { - return p.sizedPools[i].defaultSize >= size - }) - - if poolIdx == len(p.sizedPools) { - return &p.fallbackPool - } - - return p.sizedPools[poolIdx] -} - -// sizedBufferPool is a BufferPool implementation that is optimized for specific -// buffer sizes. For example, HTTP/2 frames within gRPC have a default max size -// of 16kb and a sizedBufferPool can be configured to only return buffers with a -// capacity of 16kb. Note that however it does not support returning larger -// buffers and in fact panics if such a buffer is requested. Because of this, -// this BufferPool implementation is not meant to be used on its own and rather -// is intended to be embedded in a tieredBufferPool such that Get is only -// invoked when the required size is smaller than or equal to defaultSize. -type sizedBufferPool struct { - pool sync.Pool - defaultSize int -} - -func (p *sizedBufferPool) Get(size int) *[]byte { - buf, ok := p.pool.Get().(*[]byte) - if !ok { - buf := make([]byte, size, p.defaultSize) - return &buf - } - b := *buf - clear(b[:cap(b)]) - *buf = b[:size] - return buf -} - -func (p *sizedBufferPool) Put(buf *[]byte) { - if cap(*buf) < p.defaultSize { - // Ignore buffers that are too small to fit in the pool. Otherwise, when - // Get is called it will panic as it tries to index outside the bounds - // of the buffer. - return - } - p.pool.Put(buf) -} - -func newSizedBufferPool(size int) *sizedBufferPool { - return &sizedBufferPool{ - defaultSize: size, - } -} - -var _ BufferPool = (*simpleBufferPool)(nil) - -// simpleBufferPool is an implementation of the BufferPool interface that -// attempts to pool buffers with a sync.Pool. When Get is invoked, it tries to -// acquire a buffer from the pool but if that buffer is too small, it returns it -// to the pool and creates a new one. -type simpleBufferPool struct { - pool sync.Pool -} - -func (p *simpleBufferPool) Get(size int) *[]byte { - bs, ok := p.pool.Get().(*[]byte) - if ok && cap(*bs) >= size { - clear((*bs)[:cap(*bs)]) - *bs = (*bs)[:size] - return bs - } - - // A buffer was pulled from the pool, but it is too small. Put it back in - // the pool and create one large enough. - if ok { - p.pool.Put(bs) - } - - // If we're going to allocate, round up to the nearest page. This way if - // requests frequently arrive with small variation we don't allocate - // repeatedly if we get unlucky and they increase over time. By default we - // only allocate here if size > 1MiB. Because goPageSize is a power of 2, we - // can round up efficiently. - allocSize := (size + goPageSize - 1) & ^(goPageSize - 1) - - b := make([]byte, size, allocSize) - return &b -} - -func (p *simpleBufferPool) Put(buf *[]byte) { - p.pool.Put(buf) -} - -var _ BufferPool = NopBufferPool{} - // NopBufferPool is a buffer pool that returns new buffers without pooling. -type NopBufferPool struct{} - -// Get returns a buffer with specified length from the pool. -func (NopBufferPool) Get(length int) *[]byte { - b := make([]byte, length) - return &b +type NopBufferPool struct { + mem.NopBufferPool } -// Put returns a buffer to the pool. -func (NopBufferPool) Put(*[]byte) { -} +var _ BufferPool = NopBufferPool{} diff --git a/vendor/google.golang.org/grpc/picker_wrapper.go b/vendor/google.golang.org/grpc/picker_wrapper.go index aa52bfe95fd85..0183ab22f4121 100644 --- a/vendor/google.golang.org/grpc/picker_wrapper.go +++ b/vendor/google.golang.org/grpc/picker_wrapper.go @@ -192,7 +192,9 @@ func (pw *pickerWrapper) pick(ctx context.Context, failfast bool, info balancer. // DoneInfo with default value works. pickResult.Done(balancer.DoneInfo{}) } - logger.Infof("blockingPicker: the picked transport is not ready, loop back to repick") + if logger.V(2) { + logger.Infof("blockingPicker: the picked transport is not ready, loop back to repick") + } // If ok == false, ac.state is not READY. // A valid picker always returns READY subConn. This means the state of ac // just changed, and picker will be updated shortly. diff --git a/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1/reflection.pb.go b/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1/reflection.pb.go index 92fdc3afabf53..556ab033d25e2 100644 --- a/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1/reflection.pb.go +++ b/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1/reflection.pb.go @@ -21,7 +21,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.10 +// protoc-gen-go v1.36.11 // protoc v5.27.1 // source: grpc/reflection/v1/reflection.proto diff --git a/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1/reflection_grpc.pb.go b/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1/reflection_grpc.pb.go index 93a243631c11e..81ced2fbf5e00 100644 --- a/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1/reflection_grpc.pb.go +++ b/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1/reflection_grpc.pb.go @@ -21,7 +21,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.6.0 +// - protoc-gen-go-grpc v1.6.1 // - protoc v5.27.1 // source: grpc/reflection/v1/reflection.proto diff --git a/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection.pb.go b/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection.pb.go index c803cf3ba1b79..6a46bb51fb060 100644 --- a/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection.pb.go +++ b/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection.pb.go @@ -18,7 +18,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.10 +// protoc-gen-go v1.36.11 // protoc v5.27.1 // grpc/reflection/v1alpha/reflection.proto is a deprecated file. diff --git a/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection_grpc.pb.go b/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection_grpc.pb.go index cee004ab57356..18061e8ba6385 100644 --- a/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection_grpc.pb.go +++ b/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection_grpc.pb.go @@ -18,7 +18,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.6.0 +// - protoc-gen-go-grpc v1.6.1 // - protoc v5.27.1 // grpc/reflection/v1alpha/reflection.proto is a deprecated file. diff --git a/vendor/google.golang.org/grpc/resolver/map.go b/vendor/google.golang.org/grpc/resolver/map.go index c3c15ac96f131..789a5abab6fcc 100644 --- a/vendor/google.golang.org/grpc/resolver/map.go +++ b/vendor/google.golang.org/grpc/resolver/map.go @@ -20,6 +20,7 @@ package resolver import ( "encoding/base64" + "iter" "sort" "strings" ) @@ -135,6 +136,7 @@ func (a *AddressMapV2[T]) Len() int { } // Keys returns a slice of all current map keys. +// Deprecated: Use AddressMapV2.All() instead. func (a *AddressMapV2[T]) Keys() []Address { ret := make([]Address, 0, a.Len()) for _, entryList := range a.m { @@ -146,6 +148,7 @@ func (a *AddressMapV2[T]) Keys() []Address { } // Values returns a slice of all current map values. +// Deprecated: Use AddressMapV2.All() instead. func (a *AddressMapV2[T]) Values() []T { ret := make([]T, 0, a.Len()) for _, entryList := range a.m { @@ -156,6 +159,19 @@ func (a *AddressMapV2[T]) Values() []T { return ret } +// All returns an iterator over all elements. +func (a *AddressMapV2[T]) All() iter.Seq2[Address, T] { + return func(yield func(Address, T) bool) { + for _, entryList := range a.m { + for _, entry := range entryList { + if !yield(entry.addr, entry.value) { + return + } + } + } + } +} + type endpointMapKey string // EndpointMap is a map of endpoints to arbitrary values keyed on only the @@ -223,6 +239,7 @@ func (em *EndpointMap[T]) Len() int { // the unordered set of addresses. Thus, endpoint information returned is not // the full endpoint data (drops duplicated addresses and attributes) but can be // used for EndpointMap accesses. +// Deprecated: Use EndpointMap.All() instead. func (em *EndpointMap[T]) Keys() []Endpoint { ret := make([]Endpoint, 0, len(em.endpoints)) for _, en := range em.endpoints { @@ -232,6 +249,7 @@ func (em *EndpointMap[T]) Keys() []Endpoint { } // Values returns a slice of all current map values. +// Deprecated: Use EndpointMap.All() instead. func (em *EndpointMap[T]) Values() []T { ret := make([]T, 0, len(em.endpoints)) for _, val := range em.endpoints { @@ -240,6 +258,22 @@ func (em *EndpointMap[T]) Values() []T { return ret } +// All returns an iterator over all elements. +// The map keys are endpoints specifying the addresses present in the endpoint +// map, in which uniqueness is determined by the unordered set of addresses. +// Thus, endpoint information returned is not the full endpoint data (drops +// duplicated addresses and attributes) but can be used for EndpointMap +// accesses. +func (em *EndpointMap[T]) All() iter.Seq2[Endpoint, T] { + return func(yield func(Endpoint, T) bool) { + for _, en := range em.endpoints { + if !yield(en.decodedKey, en.value) { + return + } + } + } +} + // Delete removes the specified endpoint from the map. func (em *EndpointMap[T]) Delete(e Endpoint) { en := encodeEndpoint(e) diff --git a/vendor/google.golang.org/grpc/rpc_util.go b/vendor/google.golang.org/grpc/rpc_util.go index 8160f94304051..ee7f7dead1a3c 100644 --- a/vendor/google.golang.org/grpc/rpc_util.go +++ b/vendor/google.golang.org/grpc/rpc_util.go @@ -961,24 +961,32 @@ func recvAndDecompress(p *parser, s recvCompressor, dc Decompressor, maxReceiveM return out, nil } -// decompress processes the given data by decompressing it using either a custom decompressor or a standard compressor. -// If a custom decompressor is provided, it takes precedence. The function validates that the decompressed data -// does not exceed the specified maximum size and returns an error if this limit is exceeded. -// On success, it returns the decompressed data. Otherwise, it returns an error if decompression fails or the data exceeds the size limit. +// decompress processes the given data by decompressing it using either +// a custom decompressor or a standard compressor. If a custom decompressor +// is provided, it takes precedence. The function validates that +// the decompressed data does not exceed the specified maximum size and returns +// an error if this limit is exceeded. On success, it returns the decompressed +// data. Otherwise, it returns an error if decompression fails or the data +// exceeds the size limit. func decompress(compressor encoding.Compressor, d mem.BufferSlice, dc Decompressor, maxReceiveMessageSize int, pool mem.BufferPool) (mem.BufferSlice, error) { if dc != nil { - uncompressed, err := dc.Do(d.Reader()) + r := d.Reader() + uncompressed, err := dc.Do(r) if err != nil { + r.Close() // ensure buffers are reused return nil, status.Errorf(codes.Internal, "grpc: failed to decompress the received message: %v", err) } if len(uncompressed) > maxReceiveMessageSize { + r.Close() // ensure buffers are reused return nil, status.Errorf(codes.ResourceExhausted, "grpc: message after decompression larger than max (%d vs. %d)", len(uncompressed), maxReceiveMessageSize) } return mem.BufferSlice{mem.SliceBuffer(uncompressed)}, nil } if compressor != nil { - dcReader, err := compressor.Decompress(d.Reader()) + r := d.Reader() + dcReader, err := compressor.Decompress(r) if err != nil { + r.Close() // ensure buffers are reused return nil, status.Errorf(codes.Internal, "grpc: failed to decompress the message: %v", err) } @@ -990,11 +998,13 @@ func decompress(compressor encoding.Compressor, d mem.BufferSlice, dc Decompress } out, err := mem.ReadAll(dcReader, pool) if err != nil { + r.Close() // ensure buffers are reused out.Free() return nil, status.Errorf(codes.Internal, "grpc: failed to read decompressed data: %v", err) } if out.Len() > maxReceiveMessageSize { + r.Close() // ensure buffers are reused out.Free() return nil, status.Errorf(codes.ResourceExhausted, "grpc: received message after decompression larger than max %d", maxReceiveMessageSize) } diff --git a/vendor/google.golang.org/grpc/server.go b/vendor/google.golang.org/grpc/server.go index 8efb29a7b95cc..5229adf71174b 100644 --- a/vendor/google.golang.org/grpc/server.go +++ b/vendor/google.golang.org/grpc/server.go @@ -192,6 +192,7 @@ var defaultServerOptions = serverOptions{ maxSendMessageSize: defaultServerMaxSendMessageSize, connectionTimeout: 120 * time.Second, writeBufferSize: defaultWriteBufSize, + sharedWriteBuffer: true, readBufferSize: defaultReadBufSize, bufferPool: mem.DefaultBufferPool(), } diff --git a/vendor/google.golang.org/grpc/version.go b/vendor/google.golang.org/grpc/version.go index 76c2eed773a2c..12f649dcb7b99 100644 --- a/vendor/google.golang.org/grpc/version.go +++ b/vendor/google.golang.org/grpc/version.go @@ -19,4 +19,4 @@ package grpc // Version is the current grpc version. -const Version = "1.79.3" +const Version = "1.80.0" diff --git a/vendor/modules.txt b/vendor/modules.txt index 9224856091373..91a3492dad96e 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -595,7 +595,7 @@ go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/inte go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/request go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv -# go.opentelemetry.io/otel v1.42.0 +# go.opentelemetry.io/otel v1.43.0 ## explicit; go 1.25.0 go.opentelemetry.io/otel go.opentelemetry.io/otel/attribute @@ -613,11 +613,11 @@ go.opentelemetry.io/otel/semconv/v1.40.0 go.opentelemetry.io/otel/semconv/v1.40.0/httpconv go.opentelemetry.io/otel/semconv/v1.40.0/otelconv go.opentelemetry.io/otel/semconv/v1.40.0/rpcconv -# go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.42.0 +# go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.43.0 ## explicit; go 1.25.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform -# go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.42.0 +# go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.43.0 ## explicit; go 1.25.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal @@ -627,7 +627,7 @@ go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/observ go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/retry go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/x -# go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.42.0 +# go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.43.0 ## explicit; go 1.25.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal @@ -637,12 +637,12 @@ go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/observ go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/retry go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/x -# go.opentelemetry.io/otel/metric v1.42.0 +# go.opentelemetry.io/otel/metric v1.43.0 ## explicit; go 1.25.0 go.opentelemetry.io/otel/metric go.opentelemetry.io/otel/metric/embedded go.opentelemetry.io/otel/metric/noop -# go.opentelemetry.io/otel/sdk v1.42.0 +# go.opentelemetry.io/otel/sdk v1.43.0 ## explicit; go 1.25.0 go.opentelemetry.io/otel/sdk go.opentelemetry.io/otel/sdk/instrumentation @@ -652,14 +652,14 @@ go.opentelemetry.io/otel/sdk/trace go.opentelemetry.io/otel/sdk/trace/internal/env go.opentelemetry.io/otel/sdk/trace/internal/observ go.opentelemetry.io/otel/sdk/trace/tracetest -# go.opentelemetry.io/otel/trace v1.42.0 +# go.opentelemetry.io/otel/trace v1.43.0 ## explicit; go 1.25.0 go.opentelemetry.io/otel/trace go.opentelemetry.io/otel/trace/embedded go.opentelemetry.io/otel/trace/internal/telemetry go.opentelemetry.io/otel/trace/noop -# go.opentelemetry.io/proto/otlp v1.9.0 -## explicit; go 1.23.0 +# go.opentelemetry.io/proto/otlp v1.10.0 +## explicit; go 1.24.0 go.opentelemetry.io/proto/otlp/collector/trace/v1 go.opentelemetry.io/proto/otlp/common/v1 go.opentelemetry.io/proto/otlp/resource/v1 @@ -667,8 +667,8 @@ go.opentelemetry.io/proto/otlp/trace/v1 # go.yaml.in/yaml/v2 v2.4.3 ## explicit; go 1.15 go.yaml.in/yaml/v2 -# golang.org/x/crypto v0.48.0 -## explicit; go 1.24.0 +# golang.org/x/crypto v0.49.0 +## explicit; go 1.25.0 golang.org/x/crypto/cast5 golang.org/x/crypto/cryptobyte golang.org/x/crypto/cryptobyte/asn1 @@ -684,7 +684,7 @@ golang.org/x/exp/constraints # golang.org/x/mod v0.34.0 ## explicit; go 1.25.0 golang.org/x/mod/semver -# golang.org/x/net v0.51.0 +# golang.org/x/net v0.52.0 ## explicit; go 1.25.0 golang.org/x/net/bpf golang.org/x/net/http/httpguts @@ -716,11 +716,11 @@ golang.org/x/sys/windows/registry golang.org/x/sys/windows/svc golang.org/x/sys/windows/svc/debug golang.org/x/sys/windows/svc/mgr -# golang.org/x/term v0.40.0 -## explicit; go 1.24.0 +# golang.org/x/term v0.41.0 +## explicit; go 1.25.0 golang.org/x/term -# golang.org/x/text v0.34.0 -## explicit; go 1.24.0 +# golang.org/x/text v0.35.0 +## explicit; go 1.25.0 golang.org/x/text/secure/bidirule golang.org/x/text/transform golang.org/x/text/unicode/bidi @@ -728,15 +728,15 @@ golang.org/x/text/unicode/norm # golang.org/x/time v0.15.0 ## explicit; go 1.25.0 golang.org/x/time/rate -# google.golang.org/genproto/googleapis/api v0.0.0-20260209200024-4cfbd4190f57 -## explicit; go 1.24.0 +# google.golang.org/genproto/googleapis/api v0.0.0-20260401024825-9d38bb4040a9 +## explicit; go 1.25.0 google.golang.org/genproto/googleapis/api/httpbody -# google.golang.org/genproto/googleapis/rpc v0.0.0-20260226221140-a57be14db171 +# google.golang.org/genproto/googleapis/rpc v0.0.0-20260401024825-9d38bb4040a9 ## explicit; go 1.25.0 google.golang.org/genproto/googleapis/rpc/code google.golang.org/genproto/googleapis/rpc/errdetails google.golang.org/genproto/googleapis/rpc/status -# google.golang.org/grpc v1.79.3 +# google.golang.org/grpc v1.80.0 ## explicit; go 1.24.0 google.golang.org/grpc google.golang.org/grpc/attributes @@ -777,6 +777,7 @@ google.golang.org/grpc/internal/grpclog google.golang.org/grpc/internal/grpcsync google.golang.org/grpc/internal/grpcutil google.golang.org/grpc/internal/idle +google.golang.org/grpc/internal/mem google.golang.org/grpc/internal/metadata google.golang.org/grpc/internal/pretty google.golang.org/grpc/internal/proxyattributes From 790b0ead7bc4e234b5ce90b9a1225b60bad34d75 Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Fri, 23 Jan 2026 15:57:11 -0800 Subject: [PATCH 02/29] 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 03/29] 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 04/29] 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 05/29] 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 06/29] 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 07/29] 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 08/29] 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 09/29] 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 10/29] 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 11/29] 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 12/29] 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 13/29] 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 14/29] 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 15/29] 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 16/29] 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 17/29] 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 18/29] 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 19/29] 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 20/29] 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 21/29] 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 22/29] 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 23/29] 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 24/29] 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 25/29] 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 26/29] 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 27/29] 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 28/29] 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 29/29] 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 {