mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 02:41:25 +00:00
Merge pull request #111569 from inosato/remove-ioutil-from-controller-manager
Remove ioutil from controller-manager
This commit is contained in:
commit
fd331bcdd4
@ -18,7 +18,7 @@ package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
@ -59,7 +59,7 @@ func init() {
|
||||
// The parsed LeaderMigrationConfiguration may be invalid.
|
||||
// It returns an error if the file did not exist.
|
||||
func ReadLeaderMigrationConfiguration(configFilePath string) (*internal.LeaderMigrationConfiguration, error) {
|
||||
data, err := ioutil.ReadFile(configFilePath)
|
||||
data, err := os.ReadFile(configFilePath)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to read leader migration configuration from %q: %w", configFilePath, err)
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ limitations under the License.
|
||||
package config
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"reflect"
|
||||
"testing"
|
||||
@ -114,12 +113,12 @@ controllerLeaders:
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
configFile, err := ioutil.TempFile("", tc.name)
|
||||
configFile, err := os.CreateTemp("", tc.name)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer os.Remove(configFile.Name())
|
||||
err = ioutil.WriteFile(configFile.Name(), []byte(tc.content), os.FileMode(0755))
|
||||
err = os.WriteFile(configFile.Name(), []byte(tc.content), os.FileMode(0755))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ limitations under the License.
|
||||
package options
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"reflect"
|
||||
"testing"
|
||||
@ -185,12 +184,12 @@ controllerLeaders:
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
flags := tc.flags
|
||||
if tc.configContent != "" {
|
||||
configFile, err := ioutil.TempFile("", tc.name)
|
||||
configFile, err := os.CreateTemp("", tc.name)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer os.Remove(configFile.Name())
|
||||
err = ioutil.WriteFile(configFile.Name(), []byte(tc.configContent), os.FileMode(0755))
|
||||
err = os.WriteFile(configFile.Name(), []byte(tc.configContent), os.FileMode(0755))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user