Skip CGroup v2 evac when agent is disabled

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
This commit is contained in:
Brad Davidson 2022-01-12 11:20:01 -08:00 committed by Brad Davidson
parent effcb15adb
commit b1e0f4c8fc

View File

@ -55,9 +55,13 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont
// database credentials or other secrets. // database credentials or other secrets.
gspt.SetProcTitle(os.Args[0] + " server") gspt.SetProcTitle(os.Args[0] + " server")
// Evacuate cgroup v2 before doing anything else that may fork. // If the agent is enabled, evacuate cgroup v2 before doing anything else that may fork.
if err := cmds.EvacuateCgroup2(); err != nil { // If the agent is disabled, we don't need to bother doing this as it is only the kubelet
return err // that cares about cgroups.
if !cfg.DisableAgent {
if err := cmds.EvacuateCgroup2(); err != nil {
return err
}
} }
// Initialize logging, and subprocess reaping if necessary. // Initialize logging, and subprocess reaping if necessary.