Repository navigation
Conversation
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.
There was a problem hiding this comment.
🟡 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
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


No description provided.