From ab6d14df641bd404f14c3137c52b1588f06a988b Mon Sep 17 00:00:00 2001 From: Manabu McCloskey Date: Tue, 28 Nov 2023 12:41:09 -0800 Subject: [PATCH] handle localbuild creation error and look for cluster scoped object (#96) --- pkg/build/build.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pkg/build/build.go b/pkg/build/build.go index 6f0c7bc9..f1611486 100644 --- a/pkg/build/build.go +++ b/pkg/build/build.go @@ -140,13 +140,12 @@ func (b *Build) Run(ctx context.Context, recreateCluster bool) error { // Create localbuild resource localBuild := v1alpha1.Localbuild{ ObjectMeta: metav1.ObjectMeta{ - Name: b.name, - Namespace: "default", + Name: b.name, }, } setupLog.Info("Creating localbuild resource") - controllerutil.CreateOrUpdate(ctx, kubeClient, &localBuild, func() error { + _, err = controllerutil.CreateOrUpdate(ctx, kubeClient, &localBuild, func() error { localBuild.Spec = v1alpha1.LocalbuildSpec{ PackageConfigs: v1alpha1.PackageConfigsSpec{ Argo: v1alpha1.ArgoPackageConfigSpec{ @@ -164,6 +163,11 @@ func (b *Build) Run(ctx context.Context, recreateCluster bool) error { return nil }) + if err != nil { + setupLog.Error(err, "Error creating localbuild resource") + return err + } + err = <-managerExit close(managerExit) return err