From 031e81b48ed3d485e3115db0872920c3caf151cc Mon Sep 17 00:00:00 2001 From: cmoulliard Date: Fri, 22 Nov 2024 12:34:32 +0100 Subject: [PATCH] We continue even if the idpbuilder cluster is not found part of the kubeconfig file BUT we log a message Signed-off-by: cmoulliard --- pkg/cmd/get/clusters.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pkg/cmd/get/clusters.go b/pkg/cmd/get/clusters.go index f77119c1..5e52cc4a 100644 --- a/pkg/cmd/get/clusters.go +++ b/pkg/cmd/get/clusters.go @@ -125,7 +125,7 @@ func populateClusterList() ([]Cluster, error) { c, found := findClusterByName(config, "kind-"+cluster) if !found { //logger.Error(nil, fmt.Sprintf("Cluster not found: %s within kube config file\n", cluster)) - return nil, err + logger.Info(fmt.Sprintf("Cluster not found: %s within kube config file\n", cluster)) } else { cli, err := GetClientForCluster(manager, cluster) if err != nil { @@ -361,14 +361,12 @@ func CreateKubeClientForEachIDPCluster(config *api.Config, clusterList []string) if slices.Contains(clusterList, contextName[5:]) { cfg, err := clientcmd.NewNonInteractiveClientConfig(*config, contextName, &clientcmd.ConfigOverrides{}, nil).ClientConfig() if err != nil { - fmt.Errorf("Failed to build client for context %s.", contextName) - continue + return nil, fmt.Errorf("Failed to build client for context %s.", contextName) } cl, err := client.New(cfg, client.Options{}) if err != nil { - fmt.Errorf("Failed to create client for context %s", contextName) - continue + return nil, fmt.Errorf("failed to create client for context %s", contextName) } manager.clients[contextName] = cl