1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Update kubernetes client to connect to various kubernetes providers

* Import k8s.io/client-go/plugin/pkg/client/auth to include
authentication libraries
* Update calls to panic to include the error message
This commit is contained in:
Ian Baum
2019-09-06 11:00:44 -05:00
parent 921d5d1753
commit 6662c7f18e
3 changed files with 8 additions and 4 deletions

View File

@@ -4,6 +4,8 @@ import (
"sync"
"k8s.io/client-go/kubernetes"
// Includes authentication modules for various Kubernetes providers
_ "k8s.io/client-go/plugin/pkg/client/auth"
"k8s.io/client-go/tools/clientcmd"
)
@@ -30,11 +32,11 @@ func (widget *Widget) getInstance() *clientInstance {
func (widget *Widget) getKubeClient() kubernetes.Interface {
config, err := clientcmd.BuildConfigFromFlags("", widget.kubeconfig)
if err != nil {
panic(err.Error)
panic(err)
}
clientset, err := kubernetes.NewForConfig(config)
if err != nil {
panic(err.Error)
panic(err)
}
return clientset
}