diff --git a/cmd/common.go b/cmd/common.go index 84d83a080..5f0174e0c 100644 --- a/cmd/common.go +++ b/cmd/common.go @@ -60,12 +60,15 @@ func startProxyReportErrorIfAny(kubernetesProvider *kubernetes.Provider, ctx con } func getKubernetesProviderForCli() (*kubernetes.Provider, error) { - kubernetesProvider, err := kubernetes.NewProvider(config.Config.KubeConfigPath(), config.Config.Kube.Context) + kubeConfigPath := config.Config.KubeConfigPath() + kubernetesProvider, err := kubernetes.NewProvider(kubeConfigPath, config.Config.Kube.Context) if err != nil { handleKubernetesProviderError(err) return nil, err } + log.Info().Str("path", kubeConfigPath).Msg("Using kubeconfig:") + if err := kubernetesProvider.ValidateNotProxy(); err != nil { handleKubernetesProviderError(err) return nil, err diff --git a/kubernetes/provider.go b/kubernetes/provider.go index a3037d0c2..9fe7c327e 100644 --- a/kubernetes/provider.go +++ b/kubernetes/provider.go @@ -1060,7 +1060,6 @@ func ValidateKubernetesVersion(serverVersionSemVer *semver.SemVersion) error { } func loadKubernetesConfiguration(kubeConfigPath string, context string) clientcmd.ClientConfig { - log.Info().Str("path", kubeConfigPath).Msg("Using kubeconfig:") configPathList := filepath.SplitList(kubeConfigPath) configLoadingRules := &clientcmd.ClientConfigLoadingRules{} if len(configPathList) <= 1 {