-
Notifications
You must be signed in to change notification settings - Fork 355
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
Feat/podman rootless #2370
Feat/podman rootless #2370
Conversation
8293065
to
78bb880
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #2370 +/- ##
==========================================
+ Coverage 64.83% 65.99% +1.16%
==========================================
Files 129 133 +4
Lines 15201 16814 +1613
==========================================
+ Hits 9855 11096 +1241
- Misses 5346 5718 +372 |
Signed-off-by: Yashodhan Joshi <[email protected]>
Signed-off-by: Yashodhan Joshi <[email protected]>
systemdClientInterface into dbus_native Signed-off-by: Yashodhan Joshi <[email protected]>
Signed-off-by: Yashodhan Joshi <[email protected]>
Signed-off-by: Yashodhan Joshi <[email protected]>
Signed-off-by: Yashodhan Joshi <[email protected]>
Signed-off-by: Yashodhan Joshi <[email protected]>
Signed-off-by: Yashodhan Joshi <[email protected]>
Signed-off-by: Yashodhan Joshi <[email protected]>
Signed-off-by: Yashodhan Joshi <[email protected]>
Signed-off-by: Yashodhan Joshi <[email protected]>
9a31896
to
a650514
Compare
let cpu_mask: Vec<_> = to_bitmask(cpus) | ||
.map_err(SystemdCpuSetError::CpusBitmask)? | ||
.into_iter() | ||
.map(|v| v as u64) | ||
.collect(); | ||
properties.insert(ALLOWED_CPUS, Variant::ArrayU64(cpu_mask)); | ||
} | ||
|
||
if let Some(mems) = cpu.mems() { | ||
let mems_mask = to_bitmask(mems).map_err(SystemdCpuSetError::MemoryNodesBitmask)?; | ||
properties.insert(ALLOWED_NODES, Box::new(mems_mask)); | ||
let mems_mask: Vec<_> = to_bitmask(mems) | ||
.map_err(SystemdCpuSetError::MemoryNodesBitmask)? | ||
.into_iter() | ||
.map(|v| v as u64) | ||
.collect(); | ||
properties.insert(ALLOWED_NODES, Variant::ArrayU64(mems_mask)); |
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.
In tests as well as other uses, the original code expected u64, so changed this to type u64 as well, instead of casting there
/// socket fd | ||
socket: i32, | ||
/// name id assigned by dbus for the connection | ||
id: Option<String>, |
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.
it is not necessary to send ID, but I have added it as sending it is a better practice
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.
Unit tests in this test the combined functionality of message serialization and individual type serialization. The "original" message in all tests are taken from zbus calls, so we know that those are valid messages.
With these changes, the failing tests in podman rootless are 136, 4 more that current main (132). I'll check and fix them in a separate PR, this only fixes the running with podman issues. The primary test for validating is the following command should run with and without root permissions, both podman create --runtime $PWD/youki --name test hello-world
podman start -ia test # this should print the hello world message on terminal
podman rm test
podman run -it fedora /bin/bash # verify you can run commands inside the container |
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.
Awesome.
Especially, I think it is good to have a good unit tests Why not divert some unit tests and add doc test?
@@ -42,7 +42,7 @@ jobs: | |||
go-version: '1.20' | |||
cache: true | |||
- run: sudo apt-get -y update | |||
- run: sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev libseccomp-dev btrfs-progs libbtrfs-dev |
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.
Hooray!
This is technically a breaking change. I would include this change in a minor version bump. |
Yes, I will be adding a migration guide for this as @utam0k has suggested, just haven't bumped the version in this PR, as we usually do that in the release PRs when we do a new release. |
@utam0k , I'm not sure what you mean by this? Do you want me to change some of the current unit tests that I have added to doc tests instead, or do you want to keep unit tests as they are, and add more tests as doc tests? |
May I ask you to use documentation tests in simple util functions? For example: |
b579273
to
998a715
Compare
Hey @utam0k apologies for the delay. I have updated the migration guide and docs as you commented.
So for now I have kept the unit tests as they were. |
Signed-off-by: Yashodhan Joshi <[email protected]>
998a715
to
263e6b8
Compare
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.
May I ask you to add e2e test for rootless podmain in another PR if possible?
@orimanabu May I ask you to give it a try? |
Yes, I'll do that 👍 |
Ref : #2208 , #719 , #1171
This switches from dbus-rs to natively implemented dbus connection implementation, in order to make rootless invocation with podman work.
This is almost done but still few final touches are remaining, so marked as WIP.This PR can be split into 4 parts :
Apologies for such large PR, but to validate that the code works, I have to completely switch over to dbus_native, and test. If required, I can split the PR into multiple ones according to above splits, but then the individual PRs may not be testable.
There are several places where I'm not particularly happy with my implementation, so any and all comments, suggestions and feedback is welcome to improve this!
Thank you :)