Skip to content

cri: Don't use rel path for image volumes#8885

Merged
fuweid merged 1 commit intocontainerd:mainfrom
kinvolk:rata/runc-abs-path
Jul 31, 2023
Merged

cri: Don't use rel path for image volumes#8885
fuweid merged 1 commit intocontainerd:mainfrom
kinvolk:rata/runc-abs-path

Conversation

@rata
Copy link
Copy Markdown
Contributor

@rata rata commented Jul 27, 2023

Runc 1.1 throws a warning when using rel destination paths, and runc 1.2 is planning to thow an error (i.e. won't start the container).

Let's just make this an abs path in the only place it might not be: the mounts created due to VOLUME directives in the Dockerfile.


We discussed this issue in today's containerd community meeting and decided to make this small PR that should fix it, and if this is merged without concerns, backport it to 1.6 and 1.7.

cc @mikebrow

@k8s-ci-robot
Copy link
Copy Markdown

Hi @rata. 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.

Copy link
Copy Markdown
Member

@mikebrow mikebrow left a comment

Choose a reason for hiding this comment

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

see suggestion..

tagging related PR #8524 @gabriel-samfira

@mikebrow
Copy link
Copy Markdown
Member

As discussed in the community meeting, perhaps a switch is nec. in runc, deprecated/temporary, to enable ignoring/disabling the abs check, until such time as the affected container runtimes have been patched and deployed and/or are no longer in support.

@mikebrow
Copy link
Copy Markdown
Member

/ok-to-test

Copy link
Copy Markdown
Contributor

@gabriel-samfira gabriel-samfira left a comment

Choose a reason for hiding this comment

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

Handling paths is tricky. Generally speaking, paths should be "normalized" based on target OS. The target OS in containerd is generally set by the sandbox image.

In the case of this PR, I think we can get the desired result if we move the check for relative paths closer to where those volumes need used.

@rata rata force-pushed the rata/runc-abs-path branch from cf4fa93 to 27650c2 Compare July 28, 2023 09:14
Copy link
Copy Markdown
Member

@fuweid fuweid left a comment

Choose a reason for hiding this comment

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

LGTM

@rata
Copy link
Copy Markdown
Contributor Author

rata commented Jul 28, 2023

@gabriel-samfira thanks for the review and catching the issue with Linux containers on Windows hosts!

I think this changes now should fix that and make everyone happy. PTAL @gabriel-samfira @fuweid @mikebrow

Copy link
Copy Markdown
Contributor

@gabriel-samfira gabriel-samfira left a comment

Choose a reason for hiding this comment

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

LGTM. Some tests seem to be failing, but otherwise seems ok.

@rata rata force-pushed the rata/runc-abs-path branch from 27650c2 to 4e834dc Compare July 28, 2023 10:05
@rata
Copy link
Copy Markdown
Contributor Author

rata commented Jul 28, 2023

@gabriel-samfira @fuweid thanks! Re-pushed so tests run again, it didn't seem related to this PR.

@rata rata force-pushed the rata/runc-abs-path branch 6 times, most recently from b11717c to ae719ea Compare July 28, 2023 15:01
@rata
Copy link
Copy Markdown
Contributor Author

rata commented Jul 28, 2023

@gabriel-samfira @fuweid fixed the CI now, PTAL (the tests I added were quite useful!).

The issue was that when executing on Windows, filepath.Join() does a clean, which changes from slash to backslash, and didn't match the expected paths.

I've adjusted the code to work fine on windows and linux, and added a log line as @mikebrow suggested. The changes were basically this.

@rata rata requested a review from fuweid July 28, 2023 16:15
Copy link
Copy Markdown
Member

@mikebrow mikebrow left a comment

Choose a reason for hiding this comment

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

LGTM

@fuweid
Copy link
Copy Markdown
Member

fuweid commented Jul 31, 2023

@rata would you update with mike's suggestion? after update, I will merge it. Thanks

Runc 1.1 throws a warning when using rel destination paths, and runc 1.2
is planning to thow an error (i.e. won't start the container).

Let's just make this an abs path in the only place it might not be: the
mounts created due to `VOLUME` directives in the Dockerfile.

Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
@rata rata force-pushed the rata/runc-abs-path branch from ae719ea to 2d64ab8 Compare July 31, 2023 10:34
@rata
Copy link
Copy Markdown
Contributor Author

rata commented Jul 31, 2023

@fuweid just changed the log line from info to debug, thanks!

Copy link
Copy Markdown
Member

@fuweid fuweid left a comment

Choose a reason for hiding this comment

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

LGTM

Thompson1985

This comment was marked as spam.

@rata rata deleted the rata/runc-abs-path branch March 28, 2024 09:52
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.

7 participants