Skip to content

Consider adopting containerd's shim bootstrap protocol #2780

@mxpv

Description

@mxpv

In containerd 2.3 we've introduced a new way to launch shims - Shim Bootstrap Protocol.

TLDR: Starting with containerd 2.3, the start command receives all configuration from containerd via a single protobuf-serialized BootstrapParams message on stdin. This replaces the previous scattered mechanisms (CLI flags, environment variables, stdin protobuf options) with a single, versioned, extensible protocol.

However, the new path is currently disabled for shim-runhcs-v1. hcsshim hard-codes the assumption that stdin is a marshalled with runhcsopts.Options (which we now pass as an extension) and hard fails.

The call chain:

It'd be great to have hcsshim's readOptions (serve.go) to first attempt to decode the input as BootstrapParams and extract the Options from its extension (AddExtension/GetExtension), falling back to the legacy Any decode for older containerd.

Relevant runc v2 example:

func (manager) Start(ctx context.Context, opts *bootapi.BootstrapParams) (_ *bootapi.BootstrapResult, retErr error) {
...
    var runcOpts options.Options
    if found, err := opts.FindExtension(&runcOpts); err != nil {
        return nil, fmt.Errorf("failed to fetch runc options: %w", err)
    } else if found {
        if shimCgroup := runcOpts.GetShimCgroup(); shimCgroup != "" {
            ... // join the shim cgroup
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions