Skip to content

feat: expose *ns keys to consumers #525

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

Merged
merged 1 commit into from
Mar 27, 2025

Conversation

josegomezr
Copy link
Contributor

cgroupns, ipcns, pidns, userns, utsns now support setting the value attribute.

This allows to mimic the behavior of --userns0 cli arg via this API.

Maybe related to #499


We spotted this missing behavior when using salt-podman-formula, we realized that setting:

container:
  userns_mode:
     nsmode: keep-id
     value: "uid=1000"

Was not bringing the .container.userns_mode.value to the actual invocation. The patch allows consumers to send a dict with the options, there's potential to do string parsing (to mimic 1:1 the parsing that the cli does) if desired.

josegomezr added a commit to josegomezr/podman-py that referenced this pull request Mar 13, 2025
feat: expose *ns keys to consumers, see: containers#525
@inknos inknos self-requested a review March 18, 2025 13:51
Copy link
Contributor

@inknos inknos left a comment

Choose a reason for hiding this comment

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

hey, @josegomezr thanks. the PR looks good to me. did you think of any tests to add? I can help you with it if you want to work on it.

also, please sign your commit. that would also retrigger the automation which had a flaky test and it should then pass

@josegomezr
Copy link
Contributor Author

Hmm, I took the lint suggestions from black but seems like the CI uses ruff instead?

`cgroupns`, `ipcns`, `pidns`, `userns`, `utsns` now support setting the
`value` attribute.

This allows to mimic the behavior of `--userns`[0] cli arg via this API.

[0]: https://docs.podman.io/en/stable/markdown/podman-create.1.html#userns-mode

Signed-off-by: Jose D. Gomez R <[email protected]>
@inknos
Copy link
Contributor

inknos commented Mar 27, 2025

Hmm, I took the lint suggestions from black but seems like the CI uses ruff instead?

Sorry got late to the party. Where's the suggestion from black? we migrated recently to ruff (which uses their black implementation) so it might be a leftover from the past workflows

@inknos inknos self-requested a review March 27, 2025 16:36
@inknos
Copy link
Contributor

inknos commented Mar 27, 2025

/approve
/lgtm

Copy link
Contributor

openshift-ci bot commented Mar 27, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: inknos, josegomezr

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit a75e8c2 into containers:main Mar 27, 2025
25 checks passed
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.

2 participants