Update dependency go modules for k8s v1.26.0-rc.0

This commit is contained in:
Sunny Song
2022-11-23 00:44:15 +00:00
parent 1097a9601b
commit f095f3155b
373 changed files with 45668 additions and 4985 deletions

View File

@@ -20,7 +20,6 @@ import (
"context"
"errors"
"fmt"
"io/ioutil"
"net"
"net/http"
"net/url"
@@ -519,7 +518,7 @@ func InClusterConfig() (*Config, error) {
return nil, ErrNotInCluster
}
token, err := ioutil.ReadFile(tokenFile)
token, err := os.ReadFile(tokenFile)
if err != nil {
return nil, err
}
@@ -572,10 +571,7 @@ func LoadTLSFiles(c *Config) error {
}
c.KeyData, err = dataFromSliceOrFile(c.KeyData, c.KeyFile)
if err != nil {
return err
}
return nil
return err
}
// dataFromSliceOrFile returns data from the slice (if non-empty), or from the file,
@@ -585,7 +581,7 @@ func dataFromSliceOrFile(data []byte, file string) ([]byte, error) {
return data, nil
}
if len(file) > 0 {
fileData, err := ioutil.ReadFile(file)
fileData, err := os.ReadFile(file)
if err != nil {
return []byte{}, err
}

View File

@@ -55,6 +55,7 @@ func ConfigToExecCluster(config *Config) (*clientauthenticationapi.Cluster, erro
InsecureSkipTLSVerify: config.Insecure,
CertificateAuthorityData: caData,
ProxyURL: proxyURL,
DisableCompression: config.DisableCompression,
Config: config.ExecProvider.Config,
}, nil
}
@@ -79,6 +80,7 @@ func ExecClusterToConfig(cluster *clientauthenticationapi.Cluster) (*Config, err
ServerName: cluster.TLSServerName,
CAData: cluster.CertificateAuthorityData,
},
Proxy: proxy,
Proxy: proxy,
DisableCompression: cluster.DisableCompression,
}, nil
}

View File

@@ -22,10 +22,10 @@ import (
"encoding/hex"
"fmt"
"io"
"io/ioutil"
"mime"
"net/http"
"net/url"
"os"
"path"
"reflect"
"strconv"
@@ -437,7 +437,7 @@ func (r *Request) Body(obj interface{}) *Request {
}
switch t := obj.(type) {
case string:
data, err := ioutil.ReadFile(t)
data, err := os.ReadFile(t)
if err != nil {
r.err = err
return r
@@ -826,7 +826,7 @@ func (r *Request) Stream(ctx context.Context) (io.ReadCloser, error) {
return nil, err
}
if r.body != nil {
req.Body = ioutil.NopCloser(r.body)
req.Body = io.NopCloser(r.body)
}
resp, err := client.Do(req)
updateURLMetrics(ctx, r, resp, err)
@@ -1018,7 +1018,7 @@ func (r *Request) Do(ctx context.Context) Result {
func (r *Request) DoRaw(ctx context.Context) ([]byte, error) {
var result Result
err := r.request(ctx, func(req *http.Request, resp *http.Response) {
result.body, result.err = ioutil.ReadAll(resp.Body)
result.body, result.err = io.ReadAll(resp.Body)
glogBody("Response Body", result.body)
if resp.StatusCode < http.StatusOK || resp.StatusCode > http.StatusPartialContent {
result.err = r.transformUnstructuredResponseError(resp, req, result.body)
@@ -1037,7 +1037,7 @@ func (r *Request) DoRaw(ctx context.Context) ([]byte, error) {
func (r *Request) transformResponse(resp *http.Response, req *http.Request) Result {
var body []byte
if resp.Body != nil {
data, err := ioutil.ReadAll(resp.Body)
data, err := io.ReadAll(resp.Body)
switch err.(type) {
case nil:
body = data
@@ -1179,7 +1179,7 @@ const maxUnstructuredResponseTextBytes = 2048
// TODO: introduce transformation of generic http.Client.Do() errors that separates 4.
func (r *Request) transformUnstructuredResponseError(resp *http.Response, req *http.Request, body []byte) error {
if body == nil && resp.Body != nil {
if data, err := ioutil.ReadAll(&io.LimitedReader{R: resp.Body, N: maxUnstructuredResponseTextBytes}); err == nil {
if data, err := io.ReadAll(&io.LimitedReader{R: resp.Body, N: maxUnstructuredResponseTextBytes}); err == nil {
body = data
}
}
@@ -1288,6 +1288,14 @@ func (r Result) StatusCode(statusCode *int) Result {
return r
}
// ContentType returns the "Content-Type" response header into the passed
// string, returning the Result for possible chaining. (Only valid if no
// error code was returned.)
func (r Result) ContentType(contentType *string) Result {
*contentType = r.contentType
return r
}
// Into stores the result into obj, if possible. If obj is nil it is ignored.
// If the returned object is of type Status and has .Status != StatusSuccess, the
// additional information in Status will be used to enrich the error.

View File

@@ -108,10 +108,13 @@ func (c *Config) TransportConfig() (*transport.Config, error) {
Groups: c.Impersonate.Groups,
Extra: c.Impersonate.Extra,
},
Dial: c.Dial,
Proxy: c.Proxy,
}
if c.Dial != nil {
conf.DialHolder = &transport.DialHolder{Dial: c.Dial}
}
if c.ExecProvider != nil && c.AuthProvider != nil {
return nil, errors.New("execProvider and authProvider cannot be used in combination")
}

View File

@@ -20,7 +20,6 @@ import (
"context"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"time"
@@ -345,7 +344,7 @@ func readAndCloseResponseBody(resp *http.Response) {
defer resp.Body.Close()
if resp.ContentLength <= maxBodySlurpSize {
io.Copy(ioutil.Discard, &io.LimitedReader{R: resp.Body, N: maxBodySlurpSize})
io.Copy(io.Discard, &io.LimitedReader{R: resp.Body, N: maxBodySlurpSize})
}
}