diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-07-13 20:53:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-13 20:53:20 +0200 |
commit | d86acf2caea68d1dbf349c54d0532b3ce92dcb85 (patch) | |
tree | 3191375b0465096dfb1e26a26d9faaa09c0d90ac /pkg/specgen/generate | |
parent | e2a8e037d1c3a2176cd15493812bf165faea63f2 (diff) | |
parent | 677ad10e0756212bf4fbbed2797d2c110aaa8374 (diff) | |
download | podman-d86acf2caea68d1dbf349c54d0532b3ce92dcb85.tar.gz podman-d86acf2caea68d1dbf349c54d0532b3ce92dcb85.tar.bz2 podman-d86acf2caea68d1dbf349c54d0532b3ce92dcb85.zip |
Merge pull request #6842 from rhatdan/pids-limit
Pids-limit should only be set if the user set it
Diffstat (limited to 'pkg/specgen/generate')
-rw-r--r-- | pkg/specgen/generate/container.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/pkg/specgen/generate/container.go b/pkg/specgen/generate/container.go index dee79cf67..f0d52d0c3 100644 --- a/pkg/specgen/generate/container.go +++ b/pkg/specgen/generate/container.go @@ -10,6 +10,7 @@ import ( envLib "github.com/containers/libpod/v2/pkg/env" "github.com/containers/libpod/v2/pkg/signal" "github.com/containers/libpod/v2/pkg/specgen" + spec "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" "golang.org/x/sys/unix" ) @@ -169,6 +170,21 @@ func CompleteSpec(ctx context.Context, r *libpod.Runtime, s *specgen.SpecGenerat } } + // If caller did not specify Pids Limits load default + if s.ResourceLimits == nil || s.ResourceLimits.Pids == nil { + if s.CgroupsMode != "disabled" { + limit := rtc.PidsLimit() + if limit != 0 { + if s.ResourceLimits == nil { + s.ResourceLimits = &spec.LinuxResources{} + } + s.ResourceLimits.Pids = &spec.LinuxPids{ + Limit: limit, + } + } + } + } + return verifyContainerResources(s) } |