From 92440dd990d593df3f017230be6436fad30b7683 Mon Sep 17 00:00:00 2001 From: Marcel Zieba Date: Thu, 27 Jun 2024 09:22:13 +0200 Subject: [PATCH] sysdump: derive operator namespace from agent namespace if specified Co-authored-by: Michi Mutsuzaki Signed-off-by: Marcel Zieba --- cli/sysdump.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cli/sysdump.go b/cli/sysdump.go index 2069e548de..98efa7aeaa 100644 --- a/cli/sysdump.go +++ b/cli/sysdump.go @@ -34,8 +34,13 @@ func newCmdSysdump(hooks sysdump.Hooks) *cobra.Command { if sysdumpOptions.CiliumNamespace == "" && cmd.Flags().Changed("namespace") { sysdumpOptions.CiliumNamespace = namespace } - if sysdumpOptions.CiliumOperatorNamespace == "" && cmd.Flags().Changed("namespace") { - sysdumpOptions.CiliumOperatorNamespace = namespace + if sysdumpOptions.CiliumOperatorNamespace == "" { + if cmd.Flags().Changed("namespace") { + sysdumpOptions.CiliumOperatorNamespace = namespace + } else { + // Assume the same namespace for operator as for agent if not specified + sysdumpOptions.CiliumOperatorNamespace = sysdumpOptions.CiliumNamespace + } } // Honor --helm-release-name global flag in case it is set and --cilium-helm-release-name is not set if sysdumpOptions.CiliumHelmReleaseName == "" && cmd.Flags().Changed("helm-release-name") {