[#910] control: Take empty namespace for 'root'

Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
This commit is contained in:
Airat Arifullin 2024-01-12 17:56:35 +03:00 committed by Evgenii Stratonikov
parent 63d3ed1ad8
commit be33070550

View file

@ -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,