Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: managementcontext secretref namespace not used #985

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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