mirror of
https://github.com/containers/podman.git
synced 2025-08-03 01:37:51 +08:00
resource limits for pods
added the following flags and handling for podman pod create --memory-swap --cpuset-mems --device-read-bps --device-write-bps --blkio-weight --blkio-weight-device --cpu-shares given the new backend for systemd in c/common, all of these can now be exposed to pod create. most of the heavy lifting (nearly all) is done within c/common. However, some rewiring needed to be done here as well! Signed-off-by: Charlie Doern <cdoern@redhat.com>
This commit is contained in:
@ -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 {
|
||||
|
Reference in New Issue
Block a user