diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-07-06 15:52:25 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-06 15:52:25 -0400 |
commit | b8ad7f241aba622b23b2cfab6fb5284cd26125e3 (patch) | |
tree | f957873174291cfc4380478c43cf265757cbaf0c /pkg | |
parent | 1a60550bef976a57777c75e055ad35ff8cf87f23 (diff) | |
parent | c4023a9302c81f04865646d765caf58ccf556cae (diff) | |
download | podman-b8ad7f241aba622b23b2cfab6fb5284cd26125e3.tar.gz podman-b8ad7f241aba622b23b2cfab6fb5284cd26125e3.tar.bz2 podman-b8ad7f241aba622b23b2cfab6fb5284cd26125e3.zip |
Merge pull request #6870 from rhatdan/v2.0
Pids-limit should only be set if the user set it
Diffstat (limited to 'pkg')
-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) } |