From fc425cd193ddce9b056629f77bb07256c92fbba9 Mon Sep 17 00:00:00 2001 From: Jachym Solecky Date: Thu, 16 Jan 2025 09:37:19 +0100 Subject: [PATCH] fix: managementcontext secretref namespace not used --- internal/k8s/dynamic/mctx.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/k8s/dynamic/mctx.go b/internal/k8s/dynamic/mctx.go index 707326e06..063c6ed8d 100644 --- a/internal/k8s/dynamic/mctx.go +++ b/internal/k8s/dynamic/mctx.go @@ -42,13 +42,16 @@ func ResolveContext(ctx context.Context, ref core.ObjectRef, parentNs string) (c func InjectSecretIfAny(ctx context.Context, mCtx core.ContextModel, parentNs string) (*core.ContextModel, error) { if mCtx.HasSecretRef() || (mCtx.HasCloud() && mCtx.GetCloud().HasSecretRef()) { //nolint:nestif // normal complexity var name string + var namespace string if mCtx.HasSecretRef() { name = mCtx.GetSecretRef().GetName() + namespace = mCtx.GetSecretRef().GetNamespace() } else { name = mCtx.GetCloud().GetSecretRef().GetName() + namespace = mCtx.GetCloud().GetSecretRef().GetNamespace() } - secret, err := ResolveSecret(ctx, &refs.NamespacedName{Name: name, Namespace: parentNs}, parentNs) + secret, err := ResolveSecret(ctx, &refs.NamespacedName{Name: name, Namespace: namespace}, parentNs) if err != nil { return nil, err }