mirror of https://github.com/kubernetes/kops.git
chore: remove refs to deprecated io/ioutil
This commit is contained in:
parent
36334f41ba
commit
da8c0ca830
|
@ -20,7 +20,7 @@ import (
|
|||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
|
@ -101,7 +101,7 @@ func buildJSONResponse(statusCode int, obj interface{}) (*http.Response, error)
|
|||
r.Header = make(http.Header)
|
||||
r.Header.Add("Content-Type", "application/json; charset=UTF-8")
|
||||
|
||||
r.Body = ioutil.NopCloser(bytes.NewReader(b))
|
||||
r.Body = io.NopCloser(bytes.NewReader(b))
|
||||
|
||||
return r, nil
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ package mockkubeapiserver
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
|
@ -43,7 +43,7 @@ func (req *patchResource) Run(s *MockKubeAPIServer) error {
|
|||
existing = objects.Objects[id]
|
||||
}
|
||||
|
||||
bodyBytes, err := ioutil.ReadAll(req.r.Body)
|
||||
bodyBytes, err := io.ReadAll(req.r.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ package mockkubeapiserver
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
|
@ -48,7 +48,7 @@ func (req *putResource) Run(s *MockKubeAPIServer) error {
|
|||
return req.writeErrorResponse(http.StatusNotFound)
|
||||
}
|
||||
|
||||
bodyBytes, err := ioutil.ReadAll(req.r.Body)
|
||||
bodyBytes, err := io.ReadAll(req.r.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
|
@ -86,7 +85,7 @@ func newMetadataService(serviceURL string, configDrivePath string, mounter *moun
|
|||
|
||||
// GetLocalMetadata returns a local metadata for the server
|
||||
func GetLocalMetadata() (*InstanceMetadata, error) {
|
||||
mountTarget, err := ioutil.TempDir("", "configdrive")
|
||||
mountTarget, err := os.MkdirTemp("", "configdrive")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -153,7 +152,7 @@ func (mds MetadataService) getFromMetadataService() (*InstanceMetadata, error) {
|
|||
func (mds MetadataService) parseMetadata(r io.Reader) (*InstanceMetadata, error) {
|
||||
var meta InstanceMetadata
|
||||
|
||||
data, err := ioutil.ReadAll(r)
|
||||
data, err := io.ReadAll(r)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import (
|
|||
"encoding/base64"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
|
@ -420,7 +419,7 @@ type terraformGSObjectAccessControl struct {
|
|||
}
|
||||
|
||||
func (p *GSPath) RenderTerraform(w *terraformWriter.TerraformWriter, name string, data io.Reader, acl ACL) error {
|
||||
bytes, err := ioutil.ReadAll(data)
|
||||
bytes, err := io.ReadAll(data)
|
||||
if err != nil {
|
||||
return fmt.Errorf("reading data: %v", err)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue