mirror of
https://github.com/komodorio/helm-dashboard.git
synced 2026-03-24 03:38:04 +00:00
Improve console message in case no k8s connection possible
This commit is contained in:
9
main.go
9
main.go
@@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/joomcode/errorx"
|
||||
"os"
|
||||
"os/signal"
|
||||
"strings"
|
||||
@@ -73,7 +74,13 @@ func main() {
|
||||
|
||||
address, webServerDone, err := server.StartServer(ctx, cancel)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to start Helm Dashboard: %+v", err)
|
||||
if errorx.IsOfType(err, errorx.InitializationFailed) {
|
||||
log.Debugf("Full error: %+v", err)
|
||||
log.Errorf("No Kubernetes cluster connection possible. Make sure you have valid kubeconfig file or run dashboard from inside cluster. See https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/")
|
||||
os.Exit(1)
|
||||
} else {
|
||||
log.Fatalf("Failed to start Helm Dashboard: %+v", err)
|
||||
}
|
||||
}
|
||||
|
||||
if !opts.NoTracking {
|
||||
|
||||
@@ -46,7 +46,7 @@ func (s *Server) StartServer(ctx context.Context, cancel context.CancelFunc) (st
|
||||
|
||||
err = s.detectClusterMode(data)
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
return "", nil, errorx.Decorate(err, "Failed to detect cluster mode")
|
||||
}
|
||||
|
||||
go checkUpgrade(data.StatusInfo)
|
||||
@@ -80,7 +80,7 @@ func (s *Server) detectClusterMode(data *objects.DataLayer) error {
|
||||
}
|
||||
ns, err := app.K8s.GetNameSpaces()
|
||||
if err != nil { // no point in continuing without kubectl context and k8s connection
|
||||
return err
|
||||
return errorx.InitializationFailed.Wrap(err, "No k8s cluster connection")
|
||||
}
|
||||
log.Debugf("Got %d namespaces listed", len(ns.Items))
|
||||
data.StatusInfo.ClusterMode = true
|
||||
|
||||
Reference in New Issue
Block a user