From 0166783c79caf155ebfbcae3962441c3029ab9f2 Mon Sep 17 00:00:00 2001 From: Casey Callendrello Date: Wed, 8 Feb 2023 15:57:30 +0100 Subject: [PATCH] cni: pass in the cgroupPath capability argument There is a new CNI capability argument, cgroupPath, where runtimes can pass cgroup paths to CNI plugins. Implement that. Signed-off-by: Casey Callendrello --- pkg/cri/sbserver/sandbox_run.go | 4 ++++ pkg/cri/server/sandbox_run.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/pkg/cri/sbserver/sandbox_run.go b/pkg/cri/sbserver/sandbox_run.go index db38fb133..e0b0f3fa6 100644 --- a/pkg/cri/sbserver/sandbox_run.go +++ b/pkg/cri/sbserver/sandbox_run.go @@ -396,6 +396,10 @@ func cniNamespaceOpts(id string, config *runtime.PodSandboxConfig) ([]cni.Namesp opts = append(opts, cni.WithCapabilityDNS(*dns)) } + if cgroup := config.GetLinux().GetCgroupParent(); cgroup != "" { + opts = append(opts, cni.WithCapabilityCgroupPath(cgroup)) + } + return opts, nil } diff --git a/pkg/cri/server/sandbox_run.go b/pkg/cri/server/sandbox_run.go index b03d33496..a4d802204 100644 --- a/pkg/cri/server/sandbox_run.go +++ b/pkg/cri/server/sandbox_run.go @@ -597,6 +597,10 @@ func cniNamespaceOpts(id string, config *runtime.PodSandboxConfig) ([]cni.Namesp opts = append(opts, cni.WithCapabilityDNS(*dns)) } + if cgroup := config.GetLinux().GetCgroupParent(); cgroup != "" { + opts = append(opts, cni.WithCapabilityCgroupPath(cgroup)) + } + return opts, nil }