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

Conversation

sstosh
Copy link
Contributor

@sstosh sstosh commented Apr 5, 2023

If resource limits is not set, do not display the following warning message:
Resource limits are not supported and ignored on cgroups V1 rootless systems

Ref: #17582

Does this PR introduce a user-facing change?

None

Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@giuseppe PTAL

warnings = append(warnings, "Resource limits are not supported and ignored on cgroups V1 rootless systems")
}

if s.ResourceLimits == nil {
if s.ResourceLimits == resourceNil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find the code very hard to read because we're mixing the condition checks with setting s.ResourceLimits in case it's nil.

Can we rewrite it and return []string{"Resource limits are not supported and ignored on cgroups V1 rootless systems"}, nil immediately?

We should also move down the declarations of sysInfo and warnings.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, please rewrite it because it is too difficult to follow now.

Just return the warning immediately, no need to set s.ResourceLimits to a dummy value

@sstosh sstosh force-pushed the resource-rootless branch 2 times, most recently from 91a8606 to a95c9a4 Compare April 7, 2023 02:33
@sstosh sstosh changed the title Do not display the resource limits warning message [WIP]Do not display the resource limits warning message Apr 7, 2023
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 7, 2023
@sstosh sstosh force-pushed the resource-rootless branch from a95c9a4 to 2b3f0ef Compare April 7, 2023 02:54
)

// Verify resource limits are sanely set when running on cgroup v1.
func verifyContainerResourcesCgroupV1(s *specgen.SpecGenerator) ([]string, error) {
var resourceNil *spec.LinuxResources
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this variable still needed? Does the != nil check not work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s.ResourceLimits is not nil when the container created by podman kube play.

s.ResourceLimits
(dlv) p s.ResourceLimits
*github.com/opencontainers/runtime-spec/specs-go.LinuxResources {
        Devices: []github.com/opencontainers/runtime-spec/specs-go.LinuxDeviceCgroup len: 0, cap: 0, nil,
        Memory: *github.com/opencontainers/runtime-spec/specs-go.LinuxMemory nil,
        CPU: *github.com/opencontainers/runtime-spec/specs-go.LinuxCPU nil,
        Pids: *github.com/opencontainers/runtime-spec/specs-go.LinuxPids nil,
        BlockIO: *github.com/opencontainers/runtime-spec/specs-go.LinuxBlockIO nil,
        HugepageLimits: []github.com/opencontainers/runtime-spec/specs-go.LinuxHugepageLimit len: 0, cap: 0, nil,
        Network: *github.com/opencontainers/runtime-spec/specs-go.LinuxNetwork nil,
        Rdma: map[string]github.com/opencontainers/runtime-spec/specs-go.LinuxRdma nil,
        Unified: map[string]string nil,}

I think s.ResourceLimits is equal to var resourceNil *spec.LinuxResources.

@sstosh sstosh force-pushed the resource-rootless branch 3 times, most recently from 23db1ef to af71543 Compare April 11, 2023 08:27
@sstosh sstosh changed the title [WIP]Do not display the resource limits warning message Do not display the resource limits warning message Apr 11, 2023
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 11, 2023
If resource limits is not set, do not display the following warning message:
`Resource limits are not supported and ignored on cgroups V1 rootless systems`

Ref: containers#17582

Signed-off-by: Toshiki Sonoda <[email protected]>
@sstosh sstosh force-pushed the resource-rootless branch from af71543 to 4f5f89c Compare April 11, 2023 10:32
Copy link
Member

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Apr 11, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: giuseppe, sstosh

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 11, 2023
@rhatdan
Copy link
Member

rhatdan commented Apr 12, 2023

/lgtm
Thanks @sstosh

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 12, 2023
@rhatdan rhatdan added the 4.5 label Apr 12, 2023
@openshift-merge-robot openshift-merge-robot merged commit ab30255 into containers:main Apr 12, 2023
@sstosh sstosh deleted the resource-rootless branch April 12, 2023 10:54
sstosh added a commit to sstosh/podman that referenced this pull request Aug 23, 2023
This is a regression for containers#18052.
When podman ignores the resource limits, s.ResourceLimits needs to be
nil.

[NO NEW TESTS NEEDED]

Signed-off-by: Toshiki Sonoda <[email protected]>
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 1, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. release-note-none
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants