diff options
author | Sami Hiltunen <shiltunen@gitlab.com> | 2023-10-12 19:43:57 +0300 |
---|---|---|
committer | Sami Hiltunen <shiltunen@gitlab.com> | 2023-10-23 19:47:49 +0300 |
commit | d347233e976adfe590a696b56424ad5d473f733d (patch) | |
tree | e04fe39b1ee50a7ae0e59d5943e4bc773b606d56 /internal/limiter | |
parent | 42c47b90ad97c64dd1ae55760d0d6171833c770f (diff) |
Expose a method to configure a command directly into a cgroup
This commit exposes a method from the cgroup manager to configure a
command directly into a cgroup. This is done by configuring the cgroup
in the SysProcAttr so the command gets spawned directly in the cgroup.
The functionality is only available with cgroups version 2 and kernel
version 5.7 or later.
Diffstat (limited to 'internal/limiter')
-rw-r--r-- | internal/limiter/watchers/testhelper_test.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/internal/limiter/watchers/testhelper_test.go b/internal/limiter/watchers/testhelper_test.go index fa9539a20..81fcef53c 100644 --- a/internal/limiter/watchers/testhelper_test.go +++ b/internal/limiter/watchers/testhelper_test.go @@ -1,6 +1,7 @@ package watchers import ( + "io" "os/exec" "testing" @@ -32,3 +33,11 @@ func (m *testCgroupManager) Collect(ch chan<- prometheus.Metric) {} func (m *testCgroupManager) AddCommand(*exec.Cmd, ...cgroups.AddCommandOption) (string, error) { return "", nil } + +func (m *testCgroupManager) SupportsCloneIntoCgroup() bool { + return true +} + +func (m *testCgroupManager) CloneIntoCgroup(*exec.Cmd, ...cgroups.AddCommandOption) (string, io.Closer, error) { + return "", io.NopCloser(nil), nil +} |