feat(driver-podman): add userns config - #2562
Conversation
|
All contributors have signed the DCO ✍️ ✅ |
32a94ab to
31a1f54
Compare
|
Potential Concerns
Minor: extraction runs on the sandbox-create path rather than driver startup (first create per digest pays inspect + create + download + remove); the mid-file use openshell_core::driver_utils::SUPERVISOR_IMAGE_BINARY_PATH; at driver.rs:964 breaks the file's import convention; #[serde(rename = "AutoUserNs")] would be cleaner than #[allow(non_snake_case)]. |
31a1f54 to
e3619ff
Compare
|
I have read the DCO document and I hereby sign the DCO. |
e3619ff to
444fe35
Compare
|
thanks! Comments addressed |
|
• ## PR review: Request changes Findings
Required follow-ups
|
…hell-core Move supervisor binary extraction, caching, and validation helpers from the Docker driver into openshell-core::driver_utils so both Docker and Podman drivers can reuse them. Moved helpers: extract_first_tar_entry, write_cache_binary_atomic, supervisor_cache_path, temp_extract_container_name, and validate_linux_elf_binary. The shared extract_first_tar_entry gains entry-type and empty-payload checks that the Docker-local version lacked. supervisor_cache_path takes a driver_subdir parameter so each driver caches under its own namespace (docker-supervisor vs podman-supervisor). Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
…lback Add a `userns` option to the Podman compute driver that maps to Podman's user namespace modes. The mode string is split on the first colon into the API's `nsmode` and `value` fields so parameterized values like `auto:size=65536` and `keep-id:uid=1000,gid=1000` are forwarded correctly. When the mode is `auto`, the container spec also sets `idmappings.AutoUserNs = true` as required by the API. An allowlist validates the mode at startup: `auto` and `keep-id` accept optional parameters; `host`, `private`, and `nomap` reject them; everything else is an error. Podman image volumes use overlay mounts internally and the kernel does not support idmapped mounts on overlay (`mount_setattr` returns EINVAL). When userns is configured (any mode except `host`), the driver extracts the supervisor binary from the image to a host-side cache and bind-mounts it instead of using an image volume. Configurable via TOML `userns = "auto"`, CLI `--userns`, or environment variable `OPENSHELL_PODMAN_USERNS`. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
444fe35 to
573f5dc
Compare
Summary
Add user namespace support to the Podman compute driver. The
usernsconfig option maps to Podman's namespace modes with parameterized value support (auto:size=65536,keep-id:uid=1000,gid=1000). When userns is configured, the driver extracts the supervisor binary to a host-side cache and bind-mounts it instead of using an OCI image volume, because the kernel does not support idmapped mounts on overlay.A preparatory refactor commit extracts shared supervisor binary helpers (extraction, caching, ELF validation) from the Docker driver into
openshell-core::driver_utilsso both drivers reuse the same code with hardened integrity checks.Related Issue
Fixes: #2554
Changes
Commit 1: refactor(driver): extract shared supervisor binary helpers into openshell-core
extract_first_tar_entry,write_cache_binary_atomic,supervisor_cache_path,temp_extract_container_name, andvalidate_linux_elf_binaryfrom Docker driver toopenshell-core::driver_utilsextract_first_tar_entrysupervisor_cache_pathby driver name (docker-supervisorvspodman-supervisor)Commit 2: feat(driver-podman): add userns config with supervisor bind-mount fallback
usernsfield toPodmanComputeConfig(TOMLuserns, CLI--userns, envOPENSHELL_PODMAN_USERNS):into Podman APInsmode+valuefieldsidmappings.AutoUserNs = truewhen base mode isautoauto/keep-idaccept params,host/private/nomapreject themhost)copy_from_containerAPI method to PodmanClientTesting
mise run pre-commitpassesChecklist