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 possibility to setup limits for user sessions #417

Closed
ondrejv2 opened this issue Mar 1, 2024 · 6 comments · Fixed by #420
Closed

Add possibility to setup limits for user sessions #417

ondrejv2 opened this issue Mar 1, 2024 · 6 comments · Fixed by #420
Labels
enhancement New feature or request

Comments

@ondrejv2
Copy link

ondrejv2 commented Mar 1, 2024

In service-limits.pp I see:

if $name !~ Pattern['^.+\.(service|socket|mount|swap)$'] {
fail('$name must match Pattern["^.+\.(service|socket|mount|swap)$"]')
}

But I need to set limits for user slices, i.e. "user-.slice.d".

Please ad support for user slice limits

@kenyon kenyon added the enhancement New feature or request label Mar 2, 2024
@traylenator
Copy link
Contributor

Which directives are you hoping to use there? e.g. MemoryMax . CPUWeight , ...

@traylenator
Copy link
Contributor

Please check that #420 include the directives you were hoping to set for a slice.

@ondrejv2
Copy link
Author

ondrejv2 commented Mar 4, 2024

Correct, MemoryMax , CPUWeight , are most useful here

@ekohl ekohl changed the title Add possibiliry to setup limits for user sessions Add possibility to setup limits for user sessions Mar 5, 2024
@ondrejv2
Copy link
Author

ondrejv2 commented Mar 11, 2024

Quick question, how do I apply these settings via hiera?
Tried:

systemd::dropin_files:
  'user-limits.conf':
    unit: 'user-.slice'
    slice_entry:
        'MemoryMax': '17G'

but it does not work

@kenyon
Copy link
Member

kenyon commented Mar 11, 2024

@ondrejv2 systemd::dropin_files creates systemd::dropin_file resources, which don't have slice_entry parameters, you would have to use content or source. systemd::manage_dropin has the slice_entry parameter, but there is no parameter in this module to create systemd::manage_dropin resources from hiera, you would have to do it in your code, or make a PR to have it done in init.pp in this module.

@traylenator
Copy link
Contributor

See #436 you can create a dropin to a slice from hiera with systemd::mange_dropins parameter. Only just merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants