replace deprecated package io/ioutil with packages io and os
Signed-off-by: guoyao <1015105054@qq.com>
This commit is contained in:
parent
cceed5c9f8
commit
ab3f176163
|
@ -3,7 +3,7 @@ package clusterapi
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
|
@ -200,7 +200,7 @@ func (d *ClusterDetector) unJoinClusterAPICluster(clusterName string) error {
|
|||
|
||||
func generateKubeconfigFile(clusterName string, kubeconfigData []byte) (string, error) {
|
||||
kubeconfigPath := fmt.Sprintf("/etc/%s.kubeconfig", clusterName)
|
||||
err := ioutil.WriteFile(kubeconfigPath, kubeconfigData, 0600)
|
||||
err := os.WriteFile(kubeconfigPath, kubeconfigData, 0600)
|
||||
if err != nil {
|
||||
klog.Errorf("Failed to write File %s: %v", kubeconfigPath, err)
|
||||
return "", err
|
||||
|
|
|
@ -3,7 +3,7 @@ package e2e
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
|
@ -373,7 +373,7 @@ func podLogs(ctx context.Context, k8s kubernetes.Interface, namespace, name stri
|
|||
return "", err
|
||||
}
|
||||
defer logs.Close()
|
||||
data, err := ioutil.ReadAll(logs)
|
||||
data, err := io.ReadAll(logs)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue