Skip to content

v2, util: Take the full binary path when starting the shimv2 process#5007

Merged
mxpv merged 1 commit intocontainerd:masterfrom
fidencio:wip/allow-shimv2-to-also-be-loaded-from-an-arbitrary-path
Mar 1, 2021
Merged

v2, util: Take the full binary path when starting the shimv2 process#5007
mxpv merged 1 commit intocontainerd:masterfrom
fidencio:wip/allow-shimv2-to-also-be-loaded-from-an-arbitrary-path

Conversation

@fidencio
Copy link
Copy Markdown
Contributor

@fidencio fidencio commented Feb 5, 2021

The current code simply ignores the full binary path when starting the
shimv2 process, and instead fallbacks to a binary in the path, and this
is problematic (and confusing) for those using CRI-O, which has this
bits vendored.

The reason it's problematic with CRI-O is because the user can simply
set the full binary path and, instead of having that executed, CRI-O
will simply fail to create the container unless that binary is part of
the path, which may not be case in a few different scenarios (testing
being the most common one).

Fixes: #5006

Signed-off-by: Fabiano Fidêncio [email protected]

The current code simply ignores the full binary path when starting the
shimv2 process, and instead fallbacks to a binary in the path, and this
is problematic (and confusing) for those using CRI-O, which has this
bits vendored.

The reason it's problematic with CRI-O is because the user can simply
set the full binary path and, instead of having that executed, CRI-O
will simply fail to create the container unless that binary is part of
the path, which may not be case in a few different scenarios (testing
being the most common one).

Fixes: containerd#5006

Signed-off-by: Fabiano Fidêncio <[email protected]>
@k8s-ci-robot
Copy link
Copy Markdown

Hi @fidencio. Thanks for your PR.

I'm waiting for a containerd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Feb 5, 2021

Build succeeded.

Comment thread runtime/v2/shim/util.go
if cmdPath == "" {
return nil, errors.Wrapf(os.ErrNotExist, "runtime %q binary not installed %q", runtime, name)
binaryPath := BinaryPath(runtime)
if _, serr := os.Stat(binaryPath); serr == nil {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

os.Stat works for relative paths as well no? how do we test binaryPath is indeed a "full binary path"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@dims, first of all, thanks for the very quick review.

Please, take a look at the newly introduced BinaryPath().

There I'm getting the joining the $prefix and the binary name, and returning its absolute path. This is enough to take the full path into consideration, right?

Or your consideration is that filepath.Abs() returns also a relative path and using the relative path could be problematic?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ah i missed that. thanks! (the logic in the BinaryPath)

@fidencio
Copy link
Copy Markdown
Contributor Author

fidencio commented Feb 9, 2021

@mxpv, may I bother you to take a look at this one?

@fidencio
Copy link
Copy Markdown
Contributor Author

@dims, may I bother you for an "/okay-to-test"? :-)

@dims
Copy link
Copy Markdown
Member

dims commented Feb 16, 2021

/ok-to-test

@fidencio
Copy link
Copy Markdown
Contributor Author

@dims, @mxpv, is there something blocking / missing this PR to be merged?

Please, do not take this as a push, I'm just trying to get information on all the needed pieces to have kata-deploy properly working with both containerd and CRI-O, and this is one piece that I'd needed merged, to then update the vendored containerd bits on CRI-O side. :-)

@dims
Copy link
Copy Markdown
Member

dims commented Mar 1, 2021

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow shim v2 binary to also be loaded from an arbitrary path

4 participants