Skip to content

Commit 5fdab96

Browse files
authored
Merge pull request kubernetes#121997 from dongjiang1989/admission-ioutil
chores: Replace deprecation ioutil fucntions
2 parents b2799bb + b213a69 commit 5fdab96

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

plugin/pkg/admission/eventratelimit/config.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package eventratelimit
1919
import (
2020
"fmt"
2121
"io"
22-
"io/ioutil"
2322

2423
"k8s.io/apimachinery/pkg/runtime"
2524
"k8s.io/apimachinery/pkg/runtime/serializer"
@@ -50,7 +49,7 @@ func LoadConfiguration(config io.Reader) (*eventratelimitapi.Configuration, erro
5049
return internalConfig, nil
5150
}
5251
// we have a config so parse it.
53-
data, err := ioutil.ReadAll(config)
52+
data, err := io.ReadAll(config)
5453
if err != nil {
5554
return nil, err
5655
}

plugin/pkg/admission/podtolerationrestriction/config.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package podtolerationrestriction
1919
import (
2020
"fmt"
2121
"io"
22-
"io/ioutil"
2322

2423
"k8s.io/apimachinery/pkg/runtime"
2524
"k8s.io/apimachinery/pkg/runtime/serializer"
@@ -51,7 +50,7 @@ func loadConfiguration(config io.Reader) (*internalapi.Configuration, error) {
5150
return internalConfig, nil
5251
}
5352
// we have a config so parse it.
54-
data, err := ioutil.ReadAll(config)
53+
data, err := io.ReadAll(config)
5554
if err != nil {
5655
return nil, err
5756
}

plugin/pkg/admission/security/podsecurity/admission_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package podsecurity
1919
import (
2020
"context"
2121
"fmt"
22-
"io/ioutil"
22+
"os"
2323
"strings"
2424
"testing"
2525

@@ -116,7 +116,7 @@ func BenchmarkVerifyPod(b *testing.B) {
116116

117117
corePod := &core.Pod{}
118118
v1Pod := &corev1.Pod{}
119-
data, err := ioutil.ReadFile("testdata/pod_restricted.yaml")
119+
data, err := os.ReadFile("testdata/pod_restricted.yaml")
120120
if err != nil {
121121
b.Fatal(err)
122122
}
@@ -205,7 +205,7 @@ func BenchmarkVerifyNamespace(b *testing.B) {
205205
}
206206

207207
v1Pod := &corev1.Pod{}
208-
data, err := ioutil.ReadFile("testdata/pod_baseline.yaml")
208+
data, err := os.ReadFile("testdata/pod_baseline.yaml")
209209
if err != nil {
210210
b.Fatal(err)
211211
}

0 commit comments

Comments
 (0)