Skip to content

Commit

Permalink
handle when gateway cluster URL is bad
Browse files Browse the repository at this point in the history
  • Loading branch information
devorbitus committed Jun 10, 2023
1 parent e544d6d commit 240dad5
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,8 @@ func lookupK8sAuthConfigs(cluster akeyless.GwClusterIdentity) KubeAuthConfigs {
// Call the `Do` method, which has a similar interface to the `http.Do` method
res, err := httpRequestClient.Do(req)
if err != nil {
panic(err)
fmt.Println("Unable to get k8s auth configs:", cluster.GetClusterUrl(), err)
return generateEmptyK8sAuthConfigs()
}

body, err := ioutil.ReadAll(res.Body)
Expand All @@ -303,14 +304,18 @@ func lookupK8sAuthConfigs(cluster akeyless.GwClusterIdentity) KubeAuthConfigs {
return k8sAuthConfigs
} else {
if options.Verbose {
fmt.Println("Cluster URL is not set")
fmt.Println("Cluster URL is not set for ")
}

k8sAuthConfigs := KubeAuthConfigs{
K8SAuths: []KubeAuthConfig{},
}
return k8sAuthConfigs
return generateEmptyK8sAuthConfigs()
}
}

func generateEmptyK8sAuthConfigs() KubeAuthConfigs {
k8sAuthConfigs := KubeAuthConfigs{
K8SAuths: []KubeAuthConfig{},
}
return k8sAuthConfigs
}

func lookupAllK8sAuthConfigsFromRunningGateways(listRunningGateways []akeyless.GwClusterIdentity) {
Expand Down

0 comments on commit 240dad5

Please sign in to comment.