Skip to content

Commit

Permalink
Use LoadFromFile method instead Load for k8s client object
Browse files Browse the repository at this point in the history
To use Load method, first the file needs to be read and passed the content
to Load method. LoadFromFile helper do it for us so no need to open the file ourself.
  • Loading branch information
praveenkumar committed Oct 7, 2020
1 parent 1a108ad commit 1ed70cf
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions pkg/crc/machine/kubeconfig.go
Expand Up @@ -6,7 +6,6 @@ import (
"crypto/x509"
goerrors "errors"
"fmt"
"io/ioutil"
"net"
"net/http"
"net/url"
Expand Down Expand Up @@ -95,11 +94,7 @@ func WriteKubeconfig(ip string, clusterConfig *ClusterConfig) error {
}

func certificateAuthority(kubeconfigFile string) ([]byte, error) {
bin, err := ioutil.ReadFile(kubeconfigFile)
if err != nil {
return nil, err
}
builtin, err := clientcmd.Load(bin)
builtin, err := clientcmd.LoadFromFile(kubeconfigFile)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 1ed70cf

Please sign in to comment.