add uid/gid mapping to mount#296
Merged
utam0k merged 5 commits intoyouki-dev:mainfrom Dec 29, 2025
Merged
Conversation
Contributor
|
@YamasouA thank you for the PR, do you mind signing-off the commit? |
Signed-off-by: YamasouA <akiakiskyhand@gmail.com>
70af9fe to
ad0a564
Compare
Contributor
Author
|
@saschagrunert |
Comment on lines
+80
to
+95
|
|
||
| #[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>>, |
Contributor
There was a problem hiding this comment.
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
| 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. |
Contributor
There was a problem hiding this comment.
How about being a bit more verbose here:
Suggested change
| /// 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 |
Contributor
Author
There was a problem hiding this comment.
@saschagrunert
Sorry for the late response.
I've fixed your review comments.
Signed-off-by: Akiyama <akiakiskyhand@gmail.com>
utam0k
approved these changes
Dec 29, 2025
Member
|
@YamasouA May I ask you to check the failed CI? |
Signed-off-by: Akiyama <akiakiskyhand@gmail.com>
10cea57 to
9e8d302
Compare
Contributor
Author
|
@utam0k |
Member
|
Thanks! |
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.
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?