client: skip runc options unmarshal for non-runc runtime types#12986
Closed
fidencio wants to merge 1 commit into
Closed
client: skip runc options unmarshal for non-runc runtime types#12986fidencio wants to merge 1 commit into
fidencio wants to merge 1 commit into
Conversation
Contributor
Author
Member
|
My attempt to solve this at a fundamental level: #12786 |
Contributor
Author
getRuncOptions() tries to copy the container's stored runtimeOptions into a fresh *runc.v1.Options before returning it to callers like WithTaskAPIEndpoint. This works for runc containers but fails when the container's runtime options are of a different type, e.g. runtimeoptions.v1.Options used by Kata Containers and other non-runc runtimes. typeurl.UnmarshalTo() rejects the cross-type unmarshal with: ``` can't unmarshal type "runtimeoptions.v1.Options" to output "containerd.runc.v1.Options" ``` The error then propagates as "failed to create containerd task: failed to get runtime v2 options: ..." and breaks container start for every test that runs inside a Kata sandbox when the shim sandboxer is active. Let's ensure we check typeurl.Is() efore attempting the unmarshal. If the stored runtimeOptions are not runc.v1.Options we simply return an empty *options.Options so that callers can still populate task-level fields (TaskApiAddress, TaskApiVersion, etc.) without error. Signed-off-by: Fabiano Fidêncio <ffidencio@nvidia.com>
25e7c62 to
553b530
Compare
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.
getRuncOptions() tries to copy the container's stored runtimeOptions into a fresh *runc.v1.Options before returning it to callers like WithTaskAPIEndpoint. This works for runc containers but fails when the container's runtime options are of a different type, e.g. runtimeoptions.v1.Options used by Kata Containers and other non-runc runtimes. typeurl.UnmarshalTo() rejects the cross-type unmarshal with:
The error then propagates as "failed to create containerd task: failed to get runtime v2 options: ..." and breaks container start for every test that runs inside a Kata sandbox when the shim sandboxer is active.
Let's ensure we check typeurl.Is() efore attempting the unmarshal. If the stored runtimeOptions are not runc.v1.Options we simply return an empty *options.Options so that callers can still populate task-level fields (TaskApiAddress, TaskApiVersion, etc.) without error.