From 522c6c02f799d6bc142dc42a100ff59bee4a11c4 Mon Sep 17 00:00:00 2001 From: spencercjh Date: Thu, 2 Jan 2025 09:05:43 +0000 Subject: [PATCH] fix: adapt to e2e test env Signed-off-by: spencercjh --- agent/common/permission.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/agent/common/permission.go b/agent/common/permission.go index 499cca3..8a1e869 100644 --- a/agent/common/permission.go +++ b/agent/common/permission.go @@ -1,12 +1,17 @@ package common import ( + "os" "slices" "github.com/containerd/containerd/pkg/cap" ) func HasPermission() (bool, error) { + // root is considered as having CAP_BPF capability. + if os.Geteuid() > 0 { + return true, nil + } current, err := cap.Current() if err != nil { return false, err