Skip to content

Commit

Permalink
fix: kubecontext
Browse files Browse the repository at this point in the history
  • Loading branch information
devthejo committed May 23, 2023
1 parent 6d41fb8 commit b5166b4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
)

func main() {
Expand Down Expand Up @@ -74,11 +73,11 @@ func makeClientset(kubeconfigPath string, kubecontext string) *kubernetes.Client
if kubeconfigPath != "" {
config, err = clientcmd.NewNonInteractiveDeferredLoadingClientConfig(
&clientcmd.ClientConfigLoadingRules{ExplicitPath: kubeconfigPath},
&clientcmd.ConfigOverrides{Context: clientcmdapi.Context{Cluster: kubecontext}}).ClientConfig()
&clientcmd.ConfigOverrides{CurrentContext: kubecontext}).ClientConfig()
} else {
config, err = clientcmd.NewNonInteractiveDeferredLoadingClientConfig(
clientcmd.NewDefaultClientConfigLoadingRules(),
&clientcmd.ConfigOverrides{Context: clientcmdapi.Context{Cluster: kubecontext}}).ClientConfig()
&clientcmd.ConfigOverrides{CurrentContext: kubecontext}).ClientConfig()
}

if err != nil {
Expand Down

0 comments on commit b5166b4

Please sign in to comment.