From b1e0f4c8fcc8ebceb803f88b21c8dbd4d0460250 Mon Sep 17 00:00:00 2001 From: Brad Davidson Date: Wed, 12 Jan 2022 11:20:01 -0800 Subject: [PATCH] Skip CGroup v2 evac when agent is disabled Signed-off-by: Brad Davidson --- pkg/cli/server/server.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pkg/cli/server/server.go b/pkg/cli/server/server.go index f42c6aee49..95f6010054 100644 --- a/pkg/cli/server/server.go +++ b/pkg/cli/server/server.go @@ -55,9 +55,13 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont // database credentials or other secrets. gspt.SetProcTitle(os.Args[0] + " server") - // Evacuate cgroup v2 before doing anything else that may fork. - if err := cmds.EvacuateCgroup2(); err != nil { - return err + // If the agent is enabled, evacuate cgroup v2 before doing anything else that may fork. + // If the agent is disabled, we don't need to bother doing this as it is only the kubelet + // that cares about cgroups. + if !cfg.DisableAgent { + if err := cmds.EvacuateCgroup2(); err != nil { + return err + } } // Initialize logging, and subprocess reaping if necessary.