Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not display the resource limits warning message #18052

Merged
merged 1 commit into from
Apr 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions pkg/specgen/generate/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ import (
"fmt"
"os"
"path/filepath"
"reflect"

"github.com/containers/common/pkg/cgroups"
"github.com/containers/common/pkg/sysinfo"
"github.com/containers/podman/v4/pkg/rootless"
"github.com/containers/podman/v4/pkg/specgen"
"github.com/containers/podman/v4/utils"
"github.com/opencontainers/runtime-spec/specs-go"
)

// Verify resource limits are sanely set when running on cgroup v1.
Expand All @@ -19,13 +21,16 @@ func verifyContainerResourcesCgroupV1(s *specgen.SpecGenerator) ([]string, error

sysInfo := sysinfo.New(true)

if s.ResourceLimits != nil && rootless.IsRootless() {
s.ResourceLimits = nil
warnings = append(warnings, "Resource limits are not supported and ignored on cgroups V1 rootless systems")
// If ResourceLimits is nil, return without warning
resourceNil := &specgen.SpecGenerator{}
resourceNil.ResourceLimits = &specs.LinuxResources{}
if s.ResourceLimits == nil || reflect.DeepEqual(s.ResourceLimits, resourceNil.ResourceLimits) {
return nil, nil
}

if s.ResourceLimits == nil {
return warnings, nil
// Cgroups V1 rootless system does not support Resource limits
if rootless.IsRootless() {
return []string{"Resource limits are not supported and ignored on cgroups V1 rootless systems"}, nil
}

if s.ResourceLimits.Unified != nil {
Expand Down
1 change: 0 additions & 1 deletion test/system/700-play.bats
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ EOF
}

@test "podman kube --network" {
skip_if_rootless_cgroupsv1 "Test will never be supported, see #17582."
TESTDIR=$PODMAN_TMPDIR/testdir
mkdir -p $TESTDIR
echo "$testYaml" | sed "s|TESTDIR|${TESTDIR}|g" > $PODMAN_TMPDIR/test.yaml
Expand Down