Skip to content

Commit

Permalink
added panic statement
Browse files Browse the repository at this point in the history
  • Loading branch information
pghildiyal committed Sep 28, 2021
1 parent abafac9 commit 42bc1f9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkg/Cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ func NewCluster(kubeconfig string, kubecontext string) *Cluster {
pathOptions.GlobalFile = kubeconfig
}
config, err := pathOptions.GetStartingConfig()
if err != nil {
panic(err)
}

configOverrides := clientcmd.ConfigOverrides{}
if kubecontext != "" {
Expand All @@ -41,16 +44,16 @@ func NewCluster(kubeconfig string, kubecontext string) *Cluster {
clientConfig := clientcmd.NewDefaultClientConfig(*config, &configOverrides)
cluster.restConfig, err = clientConfig.ClientConfig()
if err != nil {
return nil
panic(err)
}

if cluster.disco, err = discovery.NewDiscoveryClientForConfig(cluster.restConfig); err != nil {
return nil
panic(err)
}

cluster.clientset, err = dynamic.NewForConfig(cluster.restConfig)
if err != nil {
return nil
panic(err)
}

return &cluster
Expand Down

0 comments on commit 42bc1f9

Please sign in to comment.