Skip to content

add reusable package for managing windows shims#2601

Open
rawahars wants to merge 1 commit intomicrosoft:mainfrom
rawahars:feat/shim-pkg
Open

add reusable package for managing windows shims#2601
rawahars wants to merge 1 commit intomicrosoft:mainfrom
rawahars:feat/shim-pkg

Conversation

@rawahars
Copy link
Contributor

This pull request introduces a new reusable Windows containerd shim bootstrap package. The main goal is to provide a generic, shareable shim entrypoint and eventing logic to avoid code duplication across Windows shim binaries.

Key changes:

Shim Bootstrap Implementation:

  • Introduced the pkg/shim package, which provides a reusable shim entrypoint for Windows containerd shims, handling CLI commands (start, serve, delete), ttrpc server setup, event publishing, and logging. Includes a detailed README.md with usage instructions and responsibilities.
    Core Logic:
  • Implemented the serve command to set up ttrpc server, handle log redirection, event publishing, and clean shutdowns.
  • Implemented the delete command to clean up container resources, handle panic logs, and ensure protocol-compliant responses.
  • Centralized CLI setup and argument parsing in shim.go, including ETW logging and OpenCensus tracing.

Event Publishing Infrastructure:

  • Added a Publisher interface and eventPublisher implementation for sending task events back to containerd, including OpenCensus tracing integration.

Testing:

  • Added unit tests for the new logic: limited file reading, option parsing, error trapping, and event publishing no-op behavior.

Documentation:

  • Added README.md for the new shim package, describing its purpose, usage, and integration points for consumers.

@rawahars rawahars requested a review from a team as a code owner February 17, 2026 17:16
Existing `containerd-shim-runhcs-v1` was tightly coupled with the code used for managing the shim lifecycle and other boilerplate code. Since we are adding new shims for Windows, the newly added `shim` package will be used for the boilerplate management code.

This commit adds the same.

Signed-off-by: Harsh Rawat <harshrawat@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants