From c25cc7230fa1d54903728626584d30808539cc04 Mon Sep 17 00:00:00 2001 From: Urvashi Mohnani Date: Wed, 29 Sep 2021 16:22:55 -0400 Subject: Allow a value of -1 to set unlimited pids limit Users can set --pids-limit to -1 now to set unlimited pids limit for a container - this matches the convention. [NO TESTS NEEDED] Signed-off-by: Urvashi Mohnani --- pkg/specgen/generate/validate.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'pkg/specgen') diff --git a/pkg/specgen/generate/validate.go b/pkg/specgen/generate/validate.go index 50efe7fa3..b0d84825e 100644 --- a/pkg/specgen/generate/validate.go +++ b/pkg/specgen/generate/validate.go @@ -72,10 +72,9 @@ func verifyContainerResourcesCgroupV1(s *specgen.SpecGenerator) ([]string, error // Pids checks if s.ResourceLimits.Pids != nil { - pids := s.ResourceLimits.Pids // TODO: Should this be 0, or checking that ResourceLimits.Pids // is set at all? - if pids.Limit > 0 && !sysInfo.PidsLimit { + if s.ResourceLimits.Pids.Limit >= 0 && !sysInfo.PidsLimit { warnings = append(warnings, "Your kernel does not support pids limit capabilities or the cgroup is not mounted. PIDs limit discarded.") s.ResourceLimits.Pids = nil } -- cgit v1.2.3-54-g00ecf