Skip to content

Commit

Permalink
fix: add k8s client auth plugins
Browse files Browse the repository at this point in the history
Fix and prevent errors like: Error: no Auth Provider found for name "oidc"
  • Loading branch information
idebeijer committed Aug 16, 2024
1 parent d4dfe84 commit 92f8d12
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/idebeijer/kubert/internal/config"
"github.com/spf13/cobra"
"github.com/spf13/viper"
_ "k8s.io/client-go/plugin/pkg/client/auth"
)

const (
Expand Down Expand Up @@ -62,10 +63,6 @@ func (c *RootCmd) addCommands() {

func (c *RootCmd) initConfig() {
var level slog.Level
if viper.GetBool("debug") {
level = slog.LevelDebug
}
slog.SetLogLoggerLevel(level)

if c.cfgFile != "" {
// Use config file from the flag.
Expand All @@ -81,6 +78,7 @@ func (c *RootCmd) initConfig() {
viper.SetConfigName(".kubert.yaml")
}

viper.SetEnvPrefix("kubert")
viper.AutomaticEnv()

// If a config file is found, read it in.
Expand All @@ -89,4 +87,9 @@ func (c *RootCmd) initConfig() {
}
_ = viper.ReadInConfig()
_ = viper.Unmarshal(&config.Cfg)

if viper.GetBool("debug") {
level = slog.LevelDebug
}
slog.SetLogLoggerLevel(level)
}

0 comments on commit 92f8d12

Please sign in to comment.