Skip to content

shim: support shim bootstrap protocol - #499

Open
mxpv wants to merge 2 commits into
mainfrom
bootstrap
Open

mxpv wants to merge 2 commits into
mainfrom
bootstrap

Conversation

@mxpv

@mxpv mxpv commented Oct 19, 2026

Copy link
Copy Markdown
Member

No description provided.

containerd 2.3 passes a protobuf BootstrapParams message on stdin to the
shim's start action and expects a BootstrapResult on stdout, replacing the
flags, environment variables and runtime options the start action used to
receive. Older daemons still use the legacy mechanism, so the shim now
detects which one launched it and replies in kind, mirroring the compat
layer in containerd's pkg/shim. The identity check against the command
line is needed because a legacy Options Any decodes as a BootstrapParams
whose first two fields hold the type URL and value; a real BootstrapParams
for another shim is rejected, as containerd 2.4 does.

StartOpts now carries the log level, containerd version, the socket
directory containerd requested and the extensions it attached, with
StartOpts::extension for typed lookups. spawn places the socket in the
requested directory, passes TTRPC_ADDRESS to the shim server explicitly
and takes the shim cgroup from the extensions, so set_cgroup_and_oom_score
takes the cgroup path instead of re-reading an already consumed stdin.
The start action fails fast when no TTRPC address is known instead of
leaving the detached server to die silently.

The runc shim needs no changes of its own. Run the Linux integration
tests against containerd 2.3 and 2.4 as well, and drop 1.7.
@mxpv
mxpv requested a balanced review from Copilot October 19, 2026 16:59
@github-actions github-actions Bot added T-docs Improvements or additions to documentation C-shim Containerd shim T-CI Changes in project's CI labels Oct 19, 2026
@mxpv
mxpv requested a review from a team October 19, 2026 16:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

TTRPC URI handling can prevent server startup, and requested log levels are not propagated to the server.

2 open issues
What changed in this PR

Adds containerd’s bootstrap protocol to the shim library while retaining legacy startup support.

Changes:

  • Decodes bootstrap parameters and encodes startup replies.
  • Carries startup options into socket creation, server launch, and cgroup setup.
  • Adds protocol tests, documentation, and updated CI coverage.
File Description
crates/​shim/​src/​synchronous/​mod.rs Integrates bootstrap handling into synchronous startup.
crates/​shim/​src/​lib.rs Extends startup options and socket placement.
crates/​shim/​src/​cgroup.rs Accepts explicit cgroup configuration.
crates/​shim/​src/​bootstrap.rs Adds protocol compatibility helpers and tests.
crates/​shim/​src/​asynchronous/​mod.rs Integrates bootstrap handling and confinement cleanup.
crates/​shim/​README.md Documents bootstrap compatibility.
.github/​workflows/​ci.yml Updates containerd versions and clarifies a test comment.

Review effort: Balanced

Comment thread crates/shim/src/bootstrap.rs
Comment thread crates/shim/src/bootstrap.rs
containerd passes its TTRPC address as a plain path today, but the
bootstrap protocol documents it as a unix:// URL and containerd's own
dialer strips that prefix, so do the same before connecting.
@mxpv mxpv changed the title shim: support him bootstrap protocol shim: support shim bootstrap protocol Oct 19, 2026
@mxpv
mxpv requested a balanced review from Copilot October 19, 2026 19:32

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Cross-version startup and child-process confinement changes warrant human review supported by integration results.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-shim Containerd shim T-CI Changes in project's CI T-docs Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants