-
Notifications
You must be signed in to change notification settings - Fork 69
add uid/gid mapping to mount #296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@YamasouA thank you for the PR, do you mind signing-off the commit? |
Signed-off-by: YamasouA <akiakiskyhand@gmail.com>
70af9fe to
ad0a564
Compare
|
@saschagrunert |
|
|
||
| #[serde( | ||
| default, | ||
| skip_serializing_if = "Option::is_none", | ||
| rename = "uidMappings" | ||
| )] | ||
| /// UID mappings used for changing file owners w/o calling chown, fs should support it. Every mount point could have its own mapping. | ||
| uid_mappings: Option<Vec<LinuxIdMapping>>, | ||
|
|
||
| #[serde( | ||
| default, | ||
| skip_serializing_if = "Option::is_none", | ||
| rename = "gidMappings" | ||
| )] | ||
| /// GID mappings used for changing file owners w/o calling chown, fs should support it. Every mount point could have its own mapping. | ||
| gid_mappings: Option<Vec<LinuxIdMapping>>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the OCI spec, uidMappings and gidMappings must be specified together. The current implementation allows setting one without the other.
I'd say we could add validation in the builder or as a separate validation method, like:
- Add a custom build() validation in derive_builder
- Add a validation method on Mount to check consistency
- Document this requirement in the field comments
src/runtime/miscellaneous.rs
Outdated
| skip_serializing_if = "Option::is_none", | ||
| rename = "uidMappings" | ||
| )] | ||
| /// UID mappings used for changing file owners w/o calling chown, fs should support it. Every mount point could have its own mapping. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about being a bit more verbose here:
| /// UID mappings used for changing file owners w/o calling chown, fs should support it. Every mount point could have its own mapping. | |
| /// UID mappings for ID-mapped mounts (Linux 5.12+). | |
| /// | |
| /// Specifies how to map UIDs from the source filesystem to the destination mount point. | |
| /// This allows changing file ownership without calling chown. | |
| /// | |
| /// **Important**: If specified, gid_mappings MUST also be specified. | |
| /// The mount options SHOULD include "idmap" or "ridmap". | |
| /// | |
| /// See: https://github.com/opencontainers/runtime-spec/blob/main/config.md#posix-platform-mounts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@saschagrunert
Sorry for the late response.
I've fixed your review comments.
Signed-off-by: Akiyama <akiakiskyhand@gmail.com>
|
@YamasouA May I ask you to check the failed CI? |
Signed-off-by: Akiyama <akiakiskyhand@gmail.com>
10cea57 to
9e8d302
Compare
|
@utam0k |
|
Thanks! |
What type of PR is this?
/kind feature
What this PR does / why we need it:
We support idmapped mount
youki-dev/youki#2307
Which issue(s) this PR fixes:
Closed. #295
Special notes for your reviewer:
ref
Does this PR introduce a user-facing change?