-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add warnings for cgroup related options (--cgroup*
) when --pod
or --pod-id-file
is set
#23680
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: ruihe774 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
cc @rhatdan |
Giving setting |
--userns
and --pod-id-file
together; add warnings for cgroup related options (--cgroup*
) when --pod
or --pod-id-file
is set--userns
and --pod-id-file
together; add warnings for cgroup related options (--cgroup*
) when --pod
or --pod-id-file
is set
we must use the same user namespace for all the containers in a pod, otherwise we can't share namespaces. |
I cannot find this guarantee in doc. With different user namespaces the pod do not crash and runs well. I think a warning is enough. Also, it's difficult to ensure this guarantee. |
if you don't share any namespace, why would you need to use a pod? |
Using a Pod allows you to treat the service as a single application. I don't see a requirement to share namespaces. |
in that case we need to enchance the check and verify that the list of shared namespaces is empty. By default pods share the ipc, net, and uts namespaces, so something like: |
Yes I think you would need to change the namespaces shared on the created pod to "". |
I think it is too complicated to implement such checks. And IMO sharing these namespaces or not is orthogonal to each other. |
Doing these checks in the front end is fundamentally flawed. We simply do not have enough knowledge there to know what namespaces are used together and what conflicts,etc... These checks really must be moved into specgen instead, because cli level checks do not cover the API. And overall I agree that we should not throw warnings if the namespace is not shared in the first place, this would be easy to know in specgen.
Well if you do not care about the "owning" user namespaces sure. User namespaces are special in terms of how they work with capabilities and permissions in general, i.e. https://blog.podman.io/2023/12/interaction-between-user-namespaces-and-capabilities/ |
Sorry but I'm not familiar with the codebase. Making such change is too difficult for me. Maybe I shall drop the userns commit out of this PR and only keep the cgroups one. Hope that someone can work on that. |
Signed-off-by: Misaki Kasumi <misakikasumi@outlook.com>
--userns
and --pod-id-file
together; add warnings for cgroup related options (--cgroup*
) when --pod
or --pod-id-file
is set--cgroup*
) when --pod
or --pod-id-file
is set
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.
IMO this is still the wrong place to throw such a warning even for cgroups.
If the pod was created without any cgroup limits then it now always throws warnings to users that didn't need it to begin with. I think structurally it is important to only throw warnings when they are actual warnings, i.e. unexpected things.
Just consider than any quadlet unit using pods will not throw these warnings by default even when no limit was set on the pod which just doesn't make sense for users.
Overall we can only check these things in specgen. The current solution will not work for any API user, it will not work when defaults are set via config file as you only check the flags.
The checks were orignally placed here. I just extended them. Despite that, I agree with you that they should be moved into specgen, which is out of my knowledge.
I do not agree. IMO users expect cgroups of containers are descendants of the cgroup of the pod. |
Does this PR introduce a user-facing change?