Migrated urunc from containerd v1.x to v2.x for fixing unparsed new flag#765
Open
Cicada1107 wants to merge 1 commit into
Open
Migrated urunc from containerd v1.x to v2.x for fixing unparsed new flag#765Cicada1107 wants to merge 1 commit into
Cicada1107 wants to merge 1 commit into
Conversation
This commit: 1. Upgrades dependency and fixes file structure - go.mod, go.sum, vendor/ 2. Upgraded shim bootstrapping logic - containerd-shim-urunc-v2/main.go 3. Added backward compatible TTRPC Protocol layer - pkg/containerd-shim/task_service.go 4. Migrated init function and error mapping to accomodate containerd's v2 changes. - task_plugin.go, task_service.go Signed-off-by: Arijit Dubey <arijitdubey2018@gmail.com>
✅ Deploy Preview for urunc canceled.
|
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.
The issue:
github.com/containerd/containerd/v2instead ofgithub.com/containerd/containerd.github.com/containerd/containerd/runtime/v2/runc/managerin v1 togithub.com/containerd/containerd/v2/cmd/containerd-shim-runc-v2/managerin v2.runtime/v2/runc/taskv1 tocmd/containerd-shim-runc-v2/taskin v2.NewTaskServiceconstructor signature was chnaged from taking a*plugin.InitContextto taking a(context.Context, shim.Publisher, shutdown.Service).github.com/containerd/containerd/api.vendor/github.com/containerd/go-runc/runc.gobut when migrating to v2, the sed command isnt itself wrong, but the files it compiles -cmd/containerd-shim-urunc-v2/main.go- our urunc shim, relied on the oldruntime/v2/runcpaths which don't exit anymore in containerd v2.The changes I made:
and then all the below changes are mostly mitigating the breaking changes this migration would cause as I listed above.
containerd-shim-urunc-v2/main.goto the new paths and to use the shim.RunShim as per the new v2 instead of shim.RunManager API as described above & (This is important: please let me know if this change is fine!) made an intercption hook before executing shim.RunShim (Because v2 container shim outputs a binary protobuf instead of normal string like v1 shim did, so I was getting errors like "Yunix Schemas" and other misinterpretations, so this wrapper basically takes it and converts the protobuf into a oplaintext string like before. This should take care of backward compatibility).containerd-shim/task_plugin.goto use the new paths and the new fn signature, again, as described above.github.com/containerd/containerd/v2/plugins) and also, swapped out deprecatederrdefs.FromGRPCfor theerrgrpc.ToNativeanderrgrpc.ToGRPCFfunctions as per the new standard.Result:
Fixes #750