Skip to content

Commit

Permalink
[bug] Fix #2463
Browse files Browse the repository at this point in the history
  • Loading branch information
derailed committed Jan 10, 2024
1 parent 39742c4 commit 05a190d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ func loadConfiguration() (*config.Config, error) {
k8sCfg := client.NewConfig(k8sFlags)
k9sCfg := config.NewConfig(k8sCfg)
if err := k9sCfg.Load(config.AppConfigFile); err != nil {
return nil, err
return k9sCfg, err
}
k9sCfg.K9s.Override(k9sFlags)
if err := k9sCfg.Refine(k8sFlags, k9sFlags, k8sCfg); err != nil {
log.Error().Err(err).Msgf("config refine failed")
return nil, err
return k9sCfg, err
}
conn, err := client.InitConnection(k8sCfg)
k9sCfg.SetConnection(conn)
Expand All @@ -129,16 +129,16 @@ func loadConfiguration() (*config.Config, error) {
}
// Try to access server version if that fail. Connectivity issue?
if !conn.CheckConnectivity() {
return nil, fmt.Errorf("cannot connect to context: %s", k9sCfg.K9s.ActiveContextName())
return k9sCfg, fmt.Errorf("cannot connect to context: %s", k9sCfg.K9s.ActiveContextName())
}
if !conn.ConnectionOK() {
return nil, fmt.Errorf("k8s connection failed for context: %s", k9sCfg.K9s.ActiveContextName())
return k9sCfg, fmt.Errorf("k8s connection failed for context: %s", k9sCfg.K9s.ActiveContextName())
}

log.Info().Msg("✅ Kubernetes connectivity")
if err := k9sCfg.Save(); err != nil {
log.Error().Err(err).Msg("Config save")
return nil, err
return k9sCfg, err
}

return k9sCfg, nil
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ require (
github.com/adrg/xdg v0.4.0
github.com/anchore/clio v0.0.0-20231016125544-c98a83e1c7fc
github.com/anchore/grype v0.74.0
github.com/anchore/syft v0.100.0
github.com/atotto/clipboard v0.1.4
github.com/cenkalti/backoff/v4 v4.2.1
github.com/derailed/popeye v0.11.2
Expand Down Expand Up @@ -71,7 +72,6 @@ require (
github.com/anchore/go-version v1.2.2-0.20210903204242-51efa5b487c4 // indirect
github.com/anchore/packageurl-go v0.1.1-0.20230104203445-02e0a6721501 // indirect
github.com/anchore/stereoscope v0.0.0-20231220161148-590920dabc54 // indirect
github.com/anchore/syft v0.100.0 // indirect
github.com/andybalholm/brotli v1.0.4 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/aquasecurity/go-pep440-version v0.0.0-20210121094942-22b2f8951d46 // indirect
Expand Down

0 comments on commit 05a190d

Please sign in to comment.