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

Add support for rlimits #48

Merged
merged 5 commits into from
Sep 12, 2023
Merged

Add support for rlimits #48

merged 5 commits into from
Sep 12, 2023

Conversation

samuelkarp
Copy link
Member

@samuelkarp samuelkarp commented Aug 24, 2023

This PR adds support for adjusting rlimits and provides a sample plugin. I was able to test this using a patched version of containerd.

Signed-off-by: Samuel Karp <samuelkarp@google.com>
Signed-off-by: Samuel Karp <samuelkarp@google.com>
@codecov-commenter
Copy link

codecov-commenter commented Aug 24, 2023

Codecov Report

Patch coverage: 70.58% and project coverage change: +0.05% 🎉

Comparison is base (c83954f) 64.44% compared to head (df234b1) 64.50%.

❗ Current head df234b1 differs from pull request most recent head d2dd708. Consider uploading reports for the commit d2dd708 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #48      +/-   ##
==========================================
+ Coverage   64.44%   64.50%   +0.05%     
==========================================
  Files           9        9              
  Lines        1800     1834      +34     
==========================================
+ Hits         1160     1183      +23     
- Misses        494      500       +6     
- Partials      146      151       +5     
Files Changed Coverage Δ
pkg/runtime-tools/generate/generate.go 36.00% <66.66%> (+1.54%) ⬆️
pkg/adaptation/result.go 79.83% <72.72%> (-0.22%) ⬇️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Samuel Karp <samuelkarp@google.com>
ulimit-adjuster tests are written with plain Go tests and do not run
through ginkgo.

Signed-off-by: Samuel Karp <samuelkarp@google.com>
@samuelkarp samuelkarp marked this pull request as ready for review September 8, 2023 16:49
Copy link
Member

@klihub klihub left a comment

Choose a reason for hiding this comment

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

Thank you ! Looks pretty good. I'll read through it again in the morning just in case, but my impression is that it is very much ready to go in.

Copy link

@kad kad left a comment

Choose a reason for hiding this comment

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

/lgtm

Nice to see additional use cases and example plugins.


ulimits are annotated using the key
`ulimits.nri.containerd.io/container.$CONTAINER_NAME`, which adjusts ulimits
for `$CONTAINER_NAME`. The ulimit names are the valid names of Linux resource

Choose a reason for hiding this comment

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

are there scenarios where customer may want to set a single per-pod override that will apply to all containers?

Copy link
Member Author

Choose a reason for hiding this comment

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

Possibly, but I don't have a specific use-case for that right now. I was looking to just build the simplest thing for now; we can always add functionality later if it's desired.

Choose a reason for hiding this comment

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

thank you! If there will be a scenario with some global setting for a Pod that will require all containers to adjust limits, it will make sense to have a single override. I am also not aware of scenarios that would need this.

hard limits should always be >= soft limits

Signed-off-by: Samuel Karp <samuelkarp@google.com>
@SergeyKanzhelev
Copy link

lgtm

@bobbypage
Copy link
Contributor

lgtm

+1 to add support for rlimits in NRI, it will be helpful for folks who need to configure rlimits in k8s environments where rlimits are not natively supported in pod specs.

@dmcgowan dmcgowan merged commit c71c886 into containerd:main Sep 12, 2023
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

7 participants