@@ -68,7 +68,7 @@ func SetUp(name, kVersion string, installServing, installEventing, installKindRe
6868 }
6969
7070 if err := createKindCluster (installKindRegistry , installKindExtraMountHostPath , installKindExtraMountContainerPath ); err != nil {
71- return fmt .Errorf ("creating cluster: %w" , err )
71+ return fmt .Errorf ("failed to create kind cluster: %w" , err )
7272 }
7373 if installKnative {
7474 if installServing {
@@ -80,18 +80,18 @@ func SetUp(name, kVersion string, installServing, installEventing, installKindRe
8080 registries = fmt .Sprintf ("localhost:%s" , container_reg_port )
8181 }
8282 if err := install .Serving (registries ); err != nil {
83- return fmt .Errorf ("install serving: %w" , err )
83+ return fmt .Errorf ("failed to install serving to kind cluster %s : %w" , clusterName , err )
8484 }
8585 if err := install .Kourier (); err != nil {
86- return fmt .Errorf ("install kourier: %w" , err )
86+ return fmt .Errorf ("failed to install kourier to kind cluster %s : %w" , clusterName , err )
8787 }
8888 if err := install .KourierKind (); err != nil {
89- return fmt .Errorf ("configure kourier: %w" , err )
89+ return fmt .Errorf ("failed while configuring kourier for kind cluster %s : %w" , clusterName , err )
9090 }
9191 }
9292 if installEventing {
9393 if err := install .Eventing (); err != nil {
94- return fmt .Errorf ("install eventing: %w" , err )
94+ return fmt .Errorf ("failed to install eventing to king cluster %s : %w" , clusterName , err )
9595 }
9696 }
9797 }
@@ -109,7 +109,7 @@ func createKindCluster(registry bool, extraMountHostPath string, extraMountConta
109109 }
110110 fmt .Println ("✅ Checking dependencies..." )
111111 if err := checkKindVersion (); err != nil {
112- return fmt .Errorf ("kind version: %w" , err )
112+ return fmt .Errorf ("unable to check kind version: %w" , err )
113113 }
114114 if registry {
115115 fmt .Println ("💽 Installing local registry..." )
@@ -127,7 +127,7 @@ func createKindCluster(registry bool, extraMountHostPath string, extraMountConta
127127 }
128128
129129 if err := checkForExistingCluster (registry , extraMountHostPath , extraMountContainerPath ); err != nil {
130- return fmt .Errorf ("existing cluster: %w" , err )
130+ return fmt .Errorf ("failed while handling or checking for existing kind cluster: %w" , err )
131131 }
132132
133133 return nil
@@ -237,13 +237,13 @@ func checkKindVersion() error {
237237 versionCheck := exec .Command ("kind" , "version" , "-q" )
238238 out , err := versionCheck .CombinedOutput ()
239239 if err != nil {
240- return fmt .Errorf ("kind version: %w" , err )
240+ return fmt .Errorf ("failed to get kind version: %w" , err )
241241 }
242242 fmt .Printf (" Kind version is: %s" , string (out ))
243243
244244 userKindVersion , err := parseKindVersion (string (out ))
245245 if err != nil {
246- return fmt .Errorf ("parsing kind version: %w" , err )
246+ return fmt .Errorf ("unable to parse kind version: %w" , err )
247247 }
248248 if userKindVersion < kindVersion {
249249 var resp string
@@ -267,7 +267,7 @@ func checkForExistingCluster(registry bool, extraMountHostPath string, extraMoun
267267 getClusters := exec .Command ("kind" , "get" , "clusters" , "-q" )
268268 out , err := getClusters .CombinedOutput ()
269269 if err != nil {
270- return fmt .Errorf ("check cluster : %w" , err )
270+ return fmt .Errorf ("unable to get kind clusters : %w" , err )
271271 }
272272 // TODO Add tests for regex
273273 r := regexp .MustCompile (fmt .Sprintf (`(?m)^%s\n` , clusterName ))
@@ -278,7 +278,7 @@ func checkForExistingCluster(registry bool, extraMountHostPath string, extraMoun
278278 fmt .Scanf ("%s" , & resp )
279279 if resp == "y" || resp == "Y" {
280280 if err := recreateCluster (registry , extraMountHostPath , extraMountContainerPath ); err != nil {
281- return fmt .Errorf ("new cluster: %w" , err )
281+ return fmt .Errorf ("failed while recreating kind cluster %s : %w" , clusterName , err )
282282 }
283283 } else {
284284 fmt .Println ("\n Installation skipped" )
@@ -287,14 +287,14 @@ func checkForExistingCluster(registry bool, extraMountHostPath string, extraMoun
287287 namespaces := string (output )
288288 if err != nil {
289289 fmt .Println (string (output ))
290- return fmt .Errorf ("check existing cluster: %w" , err )
290+ return fmt .Errorf ("unable to get kubernetes namspaces for kind cluster %s : %w" , clusterName , err )
291291 }
292292 if strings .Contains (namespaces , "knative" ) {
293293 fmt .Print ("Knative installation already exists.\n Delete and recreate the cluster [y/N]: " )
294294 fmt .Scanf ("%s" , & resp )
295295 if resp == "y" || resp == "Y" {
296296 if err := recreateCluster (registry , extraMountHostPath , extraMountContainerPath ); err != nil {
297- return fmt .Errorf ("new cluster: %w" , err )
297+ return fmt .Errorf ("failed to recreate kind cluster: %w" , err )
298298 }
299299 } else {
300300 fmt .Println ("Skipping installation" )
@@ -307,11 +307,11 @@ func checkForExistingCluster(registry bool, extraMountHostPath string, extraMoun
307307 } else {
308308 dcli , err := dclient .NewClientWithOpts (dclient .FromEnv , dclient .WithAPIVersionNegotiation ())
309309 if err != nil {
310- return fmt .Errorf ("new cluster : %w" , err )
310+ return fmt .Errorf ("failed to initialize new api client : %w" , err )
311311 }
312312
313313 if err := createNewCluster (extraMountHostPath , extraMountContainerPath ); err != nil {
314- return fmt .Errorf ("new cluster: %w" , err )
314+ return fmt .Errorf ("%w" , err )
315315 }
316316 if registry {
317317 if err := createLocalRegistry (dcli ); err != nil {
@@ -332,25 +332,25 @@ func recreateCluster(registry bool, extraMountHostPath string, extraMountContain
332332
333333 dcli , err := dclient .NewClientWithOpts (dclient .FromEnv , dclient .WithAPIVersionNegotiation ())
334334 if err != nil {
335- return fmt .Errorf ("delete cluster : %w" , err )
335+ return fmt .Errorf ("failed to initialize new api client : %w" , err )
336336 }
337337
338338 deleteCluster := exec .Command ("kind" , "delete" , "cluster" , "--name" , clusterName )
339339 if err := deleteCluster .Run (); err != nil {
340- return fmt .Errorf ("delete cluster: %w" , err )
340+ return fmt .Errorf ("failed to delete kind cluster %s : %w" , clusterName , err )
341341 }
342342 if err := deleteContainerRegistry (dcli ); err != nil {
343- return fmt .Errorf ("delete container registry: %w" , err )
343+ return fmt .Errorf ("failed to delete container registry: %w" , err )
344344 }
345345 if err := createNewCluster (extraMountHostPath , extraMountContainerPath ); err != nil {
346- return fmt .Errorf ("new cluster: %w" , err )
346+ return fmt .Errorf ("%w" , err )
347347 }
348348 if registry {
349349 if err := createLocalRegistry (dcli ); err != nil {
350350 return fmt .Errorf ("%w" , err )
351351 }
352352 if err := connectLocalRegistry (dcli ); err != nil {
353- return fmt .Errorf ("local-registry: %w" , err )
353+ return fmt .Errorf ("unable to connect local-registry: %w" , err )
354354 }
355355 }
356356 return nil
@@ -391,7 +391,7 @@ nodes:
391391 createCluster := exec .Command ("kind" , "create" , "cluster" , "--wait=120s" , "--config=-" )
392392 createCluster .Stdin = strings .NewReader (config )
393393 if err := runCommandWithOutput (createCluster ); err != nil {
394- return fmt .Errorf ("kind create: %w" , err )
394+ return fmt .Errorf ("failed to create kind cluster %s : %w" , clusterName , err )
395395 }
396396
397397 return nil
0 commit comments