From e4d72bc6e9133e7a257b790e5a3fc4c03f30a437 Mon Sep 17 00:00:00 2001 From: Manabu McCloskey Date: Mon, 20 Nov 2023 12:15:33 -0800 Subject: [PATCH] use known namespace (#87) Signed-off-by: Manabu Mccloskey --- pkg/controllers/localbuild/installer.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/controllers/localbuild/installer.go b/pkg/controllers/localbuild/installer.go index 74277885..36298a51 100644 --- a/pkg/controllers/localbuild/installer.go +++ b/pkg/controllers/localbuild/installer.go @@ -86,7 +86,7 @@ func (e *EmbeddedInstallation) Install(ctx context.Context, req ctrl.Request, re _ = appsv1.AddToScheme(sch) if gvkObj, err := sch.New(gvk); err == nil { if gotObj, ok := gvkObj.(client.Object); ok { - if err := cli.Get(ctx, types.NamespacedName{Namespace: obj.GetNamespace(), Name: obj.GetName()}, gotObj); err != nil { + if err := cli.Get(ctx, types.NamespacedName{Namespace: e.namespace, Name: obj.GetName()}, gotObj); err != nil { if err = controllerutil.SetControllerReference(resource, obj, sc); err != nil { log.Error(err, "Setting controller reference for deployment", obj.GetName(), obj) return ctrl.Result{}, err @@ -132,7 +132,7 @@ func (e *EmbeddedInstallation) Install(ctx context.Context, req ctrl.Request, re for { if gotObj, ok := gvkObj.(client.Object); ok { - if err := cli.Get(ctx, types.NamespacedName{Namespace: obj.GetNamespace(), Name: obj.GetName()}, gotObj); err != nil { + if err := cli.Get(ctx, types.NamespacedName{Namespace: e.namespace, Name: obj.GetName()}, gotObj); err != nil { errCh <- err return }