diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-07-21 23:01:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-21 23:01:03 +0200 |
commit | ee937c518e7efb9c47d21a4e1050b966ca02d005 (patch) | |
tree | 2cd2dfd0bcd1332a187f9cb66eff51a9591c4069 /libpod/options.go | |
parent | 34b2018cfc75772e89367614852c382ac47d3ec1 (diff) | |
parent | c00ea686fef5a382849307d393226971fb1da1f3 (diff) | |
download | podman-ee937c518e7efb9c47d21a4e1050b966ca02d005.tar.gz podman-ee937c518e7efb9c47d21a4e1050b966ca02d005.tar.bz2 podman-ee937c518e7efb9c47d21a4e1050b966ca02d005.zip |
Merge pull request #14876 from cdoern/cgroup
resource limits for pods
Diffstat (limited to 'libpod/options.go')
-rw-r--r-- | libpod/options.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libpod/options.go b/libpod/options.go index f03980017..b31cb4ab2 100644 --- a/libpod/options.go +++ b/libpod/options.go @@ -2145,6 +2145,18 @@ func WithServiceContainer(id string) PodCreateOption { } } +// WithPodResources sets resource limits to be applied to the pod's cgroup +// these will be inherited by all containers unless overridden. +func WithPodResources(resources specs.LinuxResources) PodCreateOption { + return func(pod *Pod) error { + if pod.valid { + return define.ErrPodFinalized + } + pod.config.ResourceLimits = resources + return nil + } +} + // WithVolatile sets the volatile flag for the container storage. // The option can potentially cause data loss when used on a container that must survive a machine reboot. func WithVolatile() CtrCreateOption { |