mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #121997 from dongjiang1989/admission-ioutil
chores: Replace deprecation ioutil fucntions
This commit is contained in:
commit
5fdab96c6c
@ -19,7 +19,6 @@ package eventratelimit
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
@ -50,7 +49,7 @@ func LoadConfiguration(config io.Reader) (*eventratelimitapi.Configuration, erro
|
||||
return internalConfig, nil
|
||||
}
|
||||
// we have a config so parse it.
|
||||
data, err := ioutil.ReadAll(config)
|
||||
data, err := io.ReadAll(config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -19,7 +19,6 @@ package podtolerationrestriction
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
@ -51,7 +50,7 @@ func loadConfiguration(config io.Reader) (*internalapi.Configuration, error) {
|
||||
return internalConfig, nil
|
||||
}
|
||||
// we have a config so parse it.
|
||||
data, err := ioutil.ReadAll(config)
|
||||
data, err := io.ReadAll(config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ package podsecurity
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
@ -116,7 +116,7 @@ func BenchmarkVerifyPod(b *testing.B) {
|
||||
|
||||
corePod := &core.Pod{}
|
||||
v1Pod := &corev1.Pod{}
|
||||
data, err := ioutil.ReadFile("testdata/pod_restricted.yaml")
|
||||
data, err := os.ReadFile("testdata/pod_restricted.yaml")
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
@ -205,7 +205,7 @@ func BenchmarkVerifyNamespace(b *testing.B) {
|
||||
}
|
||||
|
||||
v1Pod := &corev1.Pod{}
|
||||
data, err := ioutil.ReadFile("testdata/pod_baseline.yaml")
|
||||
data, err := os.ReadFile("testdata/pod_baseline.yaml")
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user