Skip to content

Commit

Permalink
fix: managementcontext secretref namespace not used
Browse files Browse the repository at this point in the history
  • Loading branch information
Jachym Solecky authored and a-cordier committed Jan 17, 2025
1 parent 0811414 commit fc425cd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/k8s/dynamic/mctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit fc425cd

Please sign in to comment.