summaryrefslogtreecommitdiff
path: root/pkg/specgen
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2020-07-10 03:29:34 -0400
committerDaniel J Walsh <dwalsh@redhat.com>2020-07-10 12:46:16 -0400
commit677ad10e0756212bf4fbbed2797d2c110aaa8374 (patch)
tree9e7e25d7cbf3427943c047deffff94415f055a33 /pkg/specgen
parent2ac8c6953481eb7391a6a7594709811f7ae3167f (diff)
downloadpodman-677ad10e0756212bf4fbbed2797d2c110aaa8374.tar.gz
podman-677ad10e0756212bf4fbbed2797d2c110aaa8374.tar.bz2
podman-677ad10e0756212bf4fbbed2797d2c110aaa8374.zip
Pids-limit should only be set if the user set it
Currently we are sending over pids-limits from the user even if they never modified the defaults. The pids limit should be set at the server side unless modified by the user. This issue has led to failures on systems that were running with cgroups V1. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'pkg/specgen')
-rw-r--r--pkg/specgen/generate/container.go16
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)
}