Skip to content

Commit

Permalink
fix: return proper error from getHostInstance
Browse files Browse the repository at this point in the history
  • Loading branch information
Clement Liaw committed Jan 2, 2025
1 parent 3f06d3e commit c62c317
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,16 @@ func getHostInstance(ctx context.Context) (*crusoeapi.InstanceV1Alpha5, error) {
var ok bool
kubeClientConfig, configErr := rest.InClusterConfig()
if configErr != nil {
return nil, fmt.Errorf("could not get kube client config: %w", err)
return nil, fmt.Errorf("could not get kube client config: %w", configErr)
}

kubeClient, clientErr := kubernetes.NewForConfig(kubeClientConfig)
if clientErr != nil {
return nil, fmt.Errorf("could not get kube client: %w", err)
return nil, fmt.Errorf("could not get kube client: %w", clientErr)
}
hostNode, nodeFetchErr := kubeClient.CoreV1().Nodes().Get(ctx, viper.GetString(NodeNameFlag), metav1.GetOptions{})
if nodeFetchErr != nil {
return nil, fmt.Errorf("could not fetch current node with kube client: %w", err)
return nil, fmt.Errorf("could not fetch current node with kube client: %w", nodeFetchErr)
}

projectID, ok = hostNode.Labels[projectIDLabelKey]
Expand Down

0 comments on commit c62c317

Please sign in to comment.