summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-05-11 15:10:12 +0200
committerGitHub <noreply@github.com>2020-05-11 15:10:12 +0200
commit6a26caf6bf09c5481e14af56bf3e96852bac2680 (patch)
treeb938c08824938b7adcce3888c9954e3118337b89
parent18b273b72ba76d485eb1b4d5df48bff1685953ff (diff)
parent76f8efc0d0d7a697a4821d01f3c5dbf67bf33d8e (diff)
downloadpodman-6a26caf6bf09c5481e14af56bf3e96852bac2680.tar.gz
podman-6a26caf6bf09c5481e14af56bf3e96852bac2680.tar.bz2
podman-6a26caf6bf09c5481e14af56bf3e96852bac2680.zip
Merge pull request #6167 from giuseppe/fix-setting-limits
spec: fix order for setting rlimits
-rw-r--r--pkg/spec/spec.go20
-rw-r--r--test/e2e/generate_kube_test.go1
-rw-r--r--test/e2e/play_kube_test.go1
3 files changed, 14 insertions, 8 deletions
diff --git a/pkg/spec/spec.go b/pkg/spec/spec.go
index 77e92ae29..25cad9578 100644
--- a/pkg/spec/spec.go
+++ b/pkg/spec/spec.go
@@ -545,10 +545,14 @@ func addRlimits(config *CreateConfig, g *generate.Generator) error {
if err := unix.Getrlimit(unix.RLIMIT_NOFILE, &rlimit); err != nil {
logrus.Warnf("failed to return RLIMIT_NOFILE ulimit %q", err)
}
- current = rlimit.Cur
- max = rlimit.Max
+ if rlimit.Cur < current {
+ current = rlimit.Cur
+ }
+ if rlimit.Max < max {
+ max = rlimit.Max
+ }
}
- g.AddProcessRlimits("RLIMIT_NOFILE", current, max)
+ g.AddProcessRlimits("RLIMIT_NOFILE", max, current)
}
if !nprocSet {
max := kernelMax
@@ -558,10 +562,14 @@ func addRlimits(config *CreateConfig, g *generate.Generator) error {
if err := unix.Getrlimit(unix.RLIMIT_NPROC, &rlimit); err != nil {
logrus.Warnf("failed to return RLIMIT_NPROC ulimit %q", err)
}
- current = rlimit.Cur
- max = rlimit.Max
+ if rlimit.Cur < current {
+ current = rlimit.Cur
+ }
+ if rlimit.Max < max {
+ max = rlimit.Max
+ }
}
- g.AddProcessRlimits("RLIMIT_NPROC", current, max)
+ g.AddProcessRlimits("RLIMIT_NPROC", max, current)
}
return nil
diff --git a/test/e2e/generate_kube_test.go b/test/e2e/generate_kube_test.go
index 1650831a5..389f2c822 100644
--- a/test/e2e/generate_kube_test.go
+++ b/test/e2e/generate_kube_test.go
@@ -21,7 +21,6 @@ var _ = Describe("Podman generate kube", func() {
)
BeforeEach(func() {
- SkipIfRootlessV2()
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go
index fa943c12f..9daf266b8 100644
--- a/test/e2e/play_kube_test.go
+++ b/test/e2e/play_kube_test.go
@@ -217,7 +217,6 @@ var _ = Describe("Podman generate kube", func() {
)
BeforeEach(func() {
- SkipIfRootlessV2()
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)