Skip to content
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

podman: add option --cgroup-conf #7372

Merged

Conversation

giuseppe
Copy link
Member

@giuseppe giuseppe commented Aug 19, 2020

it allows to manually tweak the configuration for cgroup v2.

we will expose some of the options in future as single options (e.g. the new memory knobs), but for now add the more generic
--cgroup-conf mechanism for maximum control on the cgroup configuration.

OCI specs change: opencontainers/runtime-spec#1040

Requires: containers/crun#459

Signed-off-by: Giuseppe Scrivano [email protected]

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 19, 2020
@giuseppe giuseppe force-pushed the add-unified-configuration branch 2 times, most recently from cf81b3d to 666612b Compare August 19, 2020 12:32
@mheon
Copy link
Member

mheon commented Aug 19, 2020

Should we look into exposing any commonly-set versions of this as specific CLI options? This doesn't seem like a very easy/intuitive flag to use, but some of the advanced settings are going to be useful and should probably be documented independently.

@giuseppe
Copy link
Member Author

Should we look into exposing any commonly-set versions of this as specific CLI options? This doesn't seem like a very easy/intuitive flag to use, but some of the advanced settings are going to be useful and should probably be documented independently.

yes definitely. We will need to expose some of them in a more user friendly way. This is just to make sure we have full control on the cgroup if required, since the OCI specs permit it

@rhatdan
Copy link
Member

rhatdan commented Aug 19, 2020

I would prefer this to be hidden for now. since we have no idea what would be useful or not, or I guess we could state it as experimental. We also need to know if the oci runtime supports it.

@giuseppe
Copy link
Member Author

I would prefer this to be hidden for now. since we have no idea what would be useful or not, or I guess we could state it as experimental. We also need to know if the oci runtime supports it.

I am fine with hiding the feature for now, or marking it experimental but the idea is that we don't want to know what each option really means. The OCI runtime will take care of that. --unified is to give complete control over the cgroup configuration. Today for example it is not possible to configure the hugetlb controller because we are not exposing the knobs for doing that.

@rhatdan
Copy link
Member

rhatdan commented Aug 20, 2020

@giuseppe Why don't we add a option for that then? I can understand future proofing the tool, but if there is a primary feature of cgroups available in the kernel, we should expose an option for that controller. That would greatly increase the number of people who would use the option. Do we set sane defaults for Hugetlb.

@giuseppe
Copy link
Member Author

@giuseppe Why don't we add a option for that then? I can understand future proofing the tool, but if there is a primary feature of cgroups available in the kernel, we should expose an option for that controller. That would greatly increase the number of people who would use the option. Do we set sane defaults for Hugetlb.

hugetlb requires a system wide configuration before it can be used, but I agree we need a way to set it up (for cgroup v1 as well).

I still would like a way to have full control on the cgroup, also for knobs that we don't want to expose. cgroupv2 makes it easier as all the files are in the same directory so it is enough to have a map file name -> value to cover any possible configuration.

@giuseppe giuseppe force-pushed the add-unified-configuration branch from 666612b to 3b68abf Compare August 21, 2020 09:55
@giuseppe giuseppe changed the title podman: add option --unified podman: add option --cgroup-unified-configuration Aug 21, 2020
@giuseppe giuseppe force-pushed the add-unified-configuration branch from 3b68abf to 3706353 Compare August 21, 2020 13:27
@giuseppe giuseppe changed the title podman: add option --cgroup-unified-configuration podman: add option --cgroup-conf Aug 21, 2020
for _, unified := range c.CgroupConf {
splitUnified := strings.SplitN(unified, "=", 2)
if len(splitUnified) < 2 {
return errors.Errorf("Unifieds must be formatted KEY=VALUE")
Copy link
Member

Choose a reason for hiding this comment

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

--cgroup-conf must be formatted ...

pkg/spec/createconfig.go Outdated Show resolved Hide resolved
pkg/specgen/generate/validate.go Outdated Show resolved Hide resolved
@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: giuseppe, rhatdan

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

it allows to manually tweak the configuration for cgroup v2.

we will expose some of the options in future as single
options (e.g. the new memory knobs), but for now add the more generic
--cgroup-conf mechanism for maximum control on the cgroup
configuration.

OCI specs change: opencontainers/runtime-spec#1040

Requires: containers/crun#459

Signed-off-by: Giuseppe Scrivano <[email protected]>
@giuseppe giuseppe force-pushed the add-unified-configuration branch from 3706353 to d856210 Compare August 21, 2020 17:06
@giuseppe
Copy link
Member Author

addressed the comments

@@ -89,6 +89,10 @@ The *split* option splits the current cgroup in two sub-cgroups: one for conmon

Path to cgroups under which the cgroup for the container will be created. If the path is not absolute, the path is considered to be relative to the cgroups path of the init process. Cgroups will be created if they do not already exist.

**--cgroup-conf**=*KEY=VALUE*

When running on cgroup v2, specify the cgroup file to write to and its value. For example **--cgroup-conf=memory.high=1073741824** sets the memory.high limit to 1GB.
Copy link
Member

Choose a reason for hiding this comment

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

is it file or option?

Suggested change
When running on cgroup v2, specify the cgroup file to write to and its value. For example **--cgroup-conf=memory.high=1073741824** sets the memory.high limit to 1GB.
When running on cgroup v2, specify the cgroup option to write to and its value. For example **--cgroup-conf=memory.high=1073741824** sets the memory.high limit to 1GB.

Copy link
Member Author

Choose a reason for hiding this comment

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

File is correct, the key is the file name in the cgroup directory

@@ -104,6 +104,10 @@ The **split** option splits the current cgroup in two sub-cgroups: one for conmo

Path to cgroups under which the cgroup for the container will be created. If the path is not absolute, the path is considered to be relative to the cgroups path of the init process. Cgroups will be created if they do not already exist.

**--cgroup-conf**=*KEY=VALUE*

When running on cgroup v2, specify the cgroup file to write to and its value. For example **--cgroup-conf=memory.high=1073741824** sets the memory.high limit to 1GB.
Copy link
Member

Choose a reason for hiding this comment

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

see prior

@rhatdan
Copy link
Member

rhatdan commented Aug 24, 2020

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 24, 2020
@openshift-merge-robot openshift-merge-robot merged commit 8fdc116 into containers:master Aug 24, 2020
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants