52aaf86f52
This PR adds support for the raw_exec driver on systems with only cgroups v2. The raw exec driver is able to use cgroups to manage processes. This happens only on Linux, when exec_driver is enabled, and the no_cgroups option is not set. The driver uses the freezer controller to freeze processes of a task, issue a sigkill, then unfreeze. Previously the implementation assumed cgroups v1, and now it also supports cgroups v2. There is a bit of refactoring in this PR, but the fundamental design remains the same. Closes #12351 #12348
34 lines
843 B
Go
34 lines
843 B
Go
//go:build !linux
|
|
|
|
package executor
|
|
|
|
import (
|
|
"os/exec"
|
|
|
|
hclog "github.com/hashicorp/go-hclog"
|
|
"github.com/hashicorp/nomad/client/lib/resources"
|
|
"github.com/hashicorp/nomad/plugins/drivers"
|
|
)
|
|
|
|
func NewExecutorWithIsolation(logger hclog.Logger) Executor {
|
|
logger = logger.Named("executor")
|
|
logger.Error("isolation executor is not supported on this platform, using default")
|
|
return NewExecutor(logger)
|
|
}
|
|
|
|
func (e *UniversalExecutor) configureResourceContainer(_ int) error { return nil }
|
|
|
|
func (e *UniversalExecutor) getAllPids() (resources.PIDs, error) {
|
|
return getAllPidsByScanning()
|
|
}
|
|
|
|
func (e *UniversalExecutor) start(command *ExecCommand) error {
|
|
return e.childCmd.Start()
|
|
}
|
|
|
|
func withNetworkIsolation(f func() error, _ *drivers.NetworkIsolationSpec) error {
|
|
return f()
|
|
}
|
|
|
|
func setCmdUser(*exec.Cmd, string) error { return nil }
|