@ -13,7 +13,6 @@ import (
"hash"
"hash"
"hash/fnv"
"hash/fnv"
"io"
"io"
"io/ioutil"
"net"
"net"
"net/http"
"net/http"
"os"
"os"
@ -132,7 +131,7 @@ func checkHTTPErr(r *http.Response, validStatusCodes ...int) error {
}
}
}
}
body , err := ioutil . ReadAll ( io . LimitReader ( r . Body , 2 << 15 ) ) // 64 KiB
body , err := io . ReadAll ( io . LimitReader ( r . Body , 2 << 15 ) ) // 64 KiB
if err != nil {
if err != nil {
return fmt . Errorf ( "read response body: %v" , err )
return fmt . Errorf ( "read response body: %v" , err )
}
}
@ -156,7 +155,7 @@ func checkHTTPErr(r *http.Response, validStatusCodes ...int) error {
// Close the response body. The initial request is drained so the connection can
// Close the response body. The initial request is drained so the connection can
// be reused.
// be reused.
func closeResp ( r * http . Response ) {
func closeResp ( r * http . Response ) {
io . Copy ( ioutil . Discard , r . Body )
io . Copy ( io . Discard , r . Body )
r . Body . Close ( )
r . Body . Close ( )
}
}
@ -312,7 +311,7 @@ func newClient(cluster k8sapi.Cluster, user k8sapi.AuthInfo, namespace string, l
if file == "" {
if file == "" {
return nil , nil
return nil , nil
}
}
return ioutil . ReadFile ( file )
return os . ReadFile ( file )
}
}
if caData , err := data ( cluster . CertificateAuthorityData , cluster . CertificateAuthority ) ; err != nil {
if caData , err := data ( cluster . CertificateAuthorityData , cluster . CertificateAuthority ) ; err != nil {
@ -379,7 +378,7 @@ func newClient(cluster k8sapi.Cluster, user k8sapi.AuthInfo, namespace string, l
}
}
func loadKubeConfig ( kubeConfigPath string ) ( cluster k8sapi . Cluster , user k8sapi . AuthInfo , namespace string , err error ) {
func loadKubeConfig ( kubeConfigPath string ) ( cluster k8sapi . Cluster , user k8sapi . AuthInfo , namespace string , err error ) {
data , err := ioutil . ReadFile ( kubeConfigPath )
data , err := os . ReadFile ( kubeConfigPath )
if err != nil {
if err != nil {
err = fmt . Errorf ( "read %s: %v" , kubeConfigPath , err )
err = fmt . Errorf ( "read %s: %v" , kubeConfigPath , err )
return
return
@ -425,7 +424,7 @@ func namespaceFromServiceAccountJWT(s string) (string, error) {
}
}
func namespaceFromFile ( path string ) ( string , error ) {
func namespaceFromFile ( path string ) ( string , error ) {
data , err := ioutil . ReadFile ( path )
data , err := os . ReadFile ( path )
if err != nil {
if err != nil {
return "" , err
return "" , err
}
}
@ -481,7 +480,7 @@ func inClusterConfig() (k8sapi.Cluster, k8sapi.AuthInfo, string, error) {
CertificateAuthority : serviceAccountCAPath ,
CertificateAuthority : serviceAccountCAPath ,
}
}
token , err := ioutil . ReadFile ( serviceAccountTokenPath )
token , err := os . ReadFile ( serviceAccountTokenPath )
if err != nil {
if err != nil {
return cluster , k8sapi . AuthInfo { } , "" , err
return cluster , k8sapi . AuthInfo { } , "" , err
}
}