From 03d52ffd56976707a417f791215aa3945b1efafc Mon Sep 17 00:00:00 2001 From: Aniruddha Basak Date: Fri, 16 Aug 2024 18:39:11 +0200 Subject: [PATCH] fixup! Implement skip preflight flag --- pkg/conformance/deploy.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/conformance/deploy.go b/pkg/conformance/deploy.go index f1b88e0..db03d9d 100644 --- a/pkg/conformance/deploy.go +++ b/pkg/conformance/deploy.go @@ -206,21 +206,22 @@ func (r *TestRunner) Deploy(ctx context.Context, focus string, skipPreflight str return fmt.Errorf("namespace %s already exists, please run with --cleanup first", conformanceNS.Name) } } else { - return err + return fmt.Errorf("failed to create namespace: %w", err) } } else { log.Printf("Created namespace %s.", ns.Name) } - sa, err := r.clientset.CoreV1().ServiceAccounts(ns.Name).Create(ctx, &conformanceSA, metav1.CreateOptions{}) + sa, err := r.clientset.CoreV1().ServiceAccounts(r.config.Namespace).Create(ctx, &conformanceSA, metav1.CreateOptions{}) if err != nil { if errors.IsAlreadyExists(err) { //nolint:stylecheck // error message references a Kubernetes resource type. - err = fmt.Errorf("ServiceAccount %s already exist, please run --cleanup first", conformanceSA.Name) + return fmt.Errorf("ServiceAccount %s already exist, please run --cleanup first", conformanceSA.Name) } - return err + return fmt.Errorf("failed to create ServiceAccount: %w", err) } + log.Println("here it is") log.Printf("Created ServiceAccount %s.", sa.Name) clusterRole, err := r.clientset.RbacV1().ClusterRoles().Create(ctx, &conformanceClusterRole, metav1.CreateOptions{})