-
Notifications
You must be signed in to change notification settings - Fork 748
Add support for ulimit in addon config #6206
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
Conversation
Similar to docker-compose, this adds support for setting ulimits for addons via the addon config. This is useful e.g. for InfluxDB which on its own does not support setting higher open file descriptor limits, but recommends increasing limits on the host.
|
I do run into issues on my Supervised based installation: But that seems to be really a problem with the underlying It seems to be a problem as soon as I try to raise the limit higher than the default 1048576. Not sure if this is a containerd 1.7.x linage limitation 🤔 . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for configurable ulimits (user limits) in add-on configuration, allowing add-ons to specify system resource limits such as open files, processes, and memory locks. The implementation supports both simple format (single value for both soft and hard limits) and detailed format (separate soft and hard limits).
- Adds
ulimitsconfiguration option to add-on schema validation with support for both simple and detailed formats - Integrates ulimits into the Docker container creation process, combining with existing realtime ulimits
- Comprehensive test coverage for validation logic and Docker integration
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| supervisor/const.py | Adds ATTR_ULIMITS constant for configuration attribute |
| supervisor/addons/validate.py | Implements schema validation for ulimits configuration supporting both simple and detailed formats |
| supervisor/addons/model.py | Adds ulimits property to Addon model for accessing configuration |
| supervisor/docker/addon.py | Integrates ulimits into Docker container creation, merging with existing realtime limits |
| tests/addons/test_config.py | Adds comprehensive validation tests for ulimits configuration formats |
| tests/docker/test_addon.py | Tests Docker integration including interaction with realtime ulimits |
sairon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice and clean, thanks!
Proposed change
This PR adds support for configurable ulimits (resource limits) in addon configuration. Add-ons can now specify ulimits in their
config.yamlto control system resource limits such as open files, processes, memory locks, and other kernel resource limits.The implementation supports both simple format:
And detailed format for fine-grained control over soft and hard limits:
This is e.g. useful for the InfluxDB add-on. InfluxDB does not have options to raise the limit in its configuration. See also hassio-addons/addon-influxdb#383 and influxdata/influxdb#16065.
Type of change
Additional information
Checklist
ruff format supervisor tests)If API endpoints or add-on configuration are added/changed: