Skip to content

Comments

add and patch containerd/pkg/shim to be used with new Windows shims#2601

Merged
rawahars merged 2 commits intomicrosoft:mainfrom
rawahars:feat/shim-pkg
Feb 24, 2026
Merged

add and patch containerd/pkg/shim to be used with new Windows shims#2601
rawahars merged 2 commits intomicrosoft:mainfrom
rawahars:feat/shim-pkg

Conversation

@rawahars
Copy link
Contributor

@rawahars rawahars commented Feb 17, 2026

This PR introduces a vendored and modified version of the upstream containerd/pkg/shim package. This transition will benefit the newer Windows shims, allowing for a more modular and reusable shim management logic. Moreover, By aligning with the upstream pkg/shim structure, we enable better interoperability with containerd v2 while maintaining the specific hooks necessary for Windows.

Key changes

Testing

Created a new shim and tested it with this logic.

@helsaawy
Copy link
Contributor

theres already containerd/pkg/shim that implements a lot of the management and parsing needed, can we leverage that?

@rawahars
Copy link
Contributor Author

@helsaawy Using the upstream shim pkg would have been the absolute right way to go. However, Windows implementation is not yet robust upstream. Reference- https://github.com/containerd/containerd/blob/main/pkg/shim/shim_windows.go

Also, we have custom logic related to setting up ETW provider among other things.

In my opinion, as a follow-up to the new shim, we can work to ensure that containerd's shim pkg has robust Windows implementation and then move our new shim to the upstream package once it is released.

What are your thoughts?

@helsaawy
Copy link
Contributor

Even without the Run logic to start and manage a shim server, integrating with it now would allow moving to the BootstrapParams containerd is now expecting (instead of the "address" file)
especially for utilities like ReadRuntimeOptions and the event publisher plugin

@rawahars
Copy link
Contributor Author

@helsaawy While I totally agree, the upstream shim implementation has stubbed out even newServer method which is used for creating the TTRPC server. Without that we cannot integrate at all.

@rawahars rawahars changed the title add reusable package for managing windows shims add and patch containerd/pkg/shim to be used with new Windows shims Feb 21, 2026
@rawahars rawahars force-pushed the feat/shim-pkg branch 3 times, most recently from 03bafb4 to e5ada72 Compare February 21, 2026 22:48
@@ -0,0 +1,186 @@
//go:build windows
Copy link
Contributor

Choose a reason for hiding this comment

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

Hey can we check in the exact 2.X package then do the delta commit to make it work. That will give us a history that is the changes you made and will make it easier for us to see what needs to be patched back to containerd/containerd to get this to work upstream.

Copy link
Contributor

Choose a reason for hiding this comment

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

Any of the _windows are not really that important as its obvious where they changed. But I'm just surprised to see we had to change the shim.go file. That "should" be platform agnostic

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes sure. I have bifurcated the commits into 2 as requested.

The existing runhcs shim management logic is tightly coupled, making it difficult to reuse for new shim implementations. Additionally, aligning with upstream's move toward BootstrapParams requires additional effort in existing logic.

To maintain compatibility and reduce technical debt, this commit vendors the containerd/pkg/shim implementation.

Source: https://github.com/containerd/containerd/tree/64ed272067a24c2d917064eea25a78e1479d632f/pkg/shim (based on v2.1.2)

Signed-off-by: Harsh Rawat <harshrawat@microsoft.com>
This commit adds the changes to ensure that upstream pkg/shim works with Windows shims.

Signed-off-by: Harsh Rawat <harshrawat@microsoft.com>
@rawahars rawahars merged commit fa57661 into microsoft:main Feb 24, 2026
17 checks passed
@rawahars rawahars deleted the feat/shim-pkg branch February 24, 2026 22:00
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