From 1bbfe186aee010d426dbafafc49239944d44d440 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Fri, 12 Jan 2024 17:56:35 +0300 Subject: [PATCH] [#910] control: Take empty namespace for 'root' Signed-off-by: Airat Arifullin --- pkg/services/control/server/policy_engine.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/services/control/server/policy_engine.go b/pkg/services/control/server/policy_engine.go index 519b21035..9b42f3a98 100644 --- a/pkg/services/control/server/policy_engine.go +++ b/pkg/services/control/server/policy_engine.go @@ -17,7 +17,12 @@ func apeTarget(chainTarget *control.ChainTarget) (engine.Target, error) { case control.ChainTarget_CONTAINER: return engine.ContainerTarget(chainTarget.GetName()), nil case control.ChainTarget_NAMESPACE: - return engine.NamespaceTarget(chainTarget.GetName()), nil + namespace := chainTarget.GetName() + // If namespace is empty, we take it for root namespace. + if namespace == "" { + namespace = "root" + } + return engine.NamespaceTarget(namespace), nil default: } return engine.Target{}, status.Error(codes.InvalidArgument, -- 2.45.2