From 6475cb7adfa50af77a9ff9940c3a2efdeaae685d Mon Sep 17 00:00:00 2001 From: Brandon Palm Date: Mon, 15 Jun 2026 12:31:41 -0500 Subject: [PATCH] Migrate away from deprecated ioutil --- pkg/controller/servingcert/starter/starter.go | 3 +-- test/util/rotate.go | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/pkg/controller/servingcert/starter/starter.go b/pkg/controller/servingcert/starter/starter.go index 7f40f81b1..6235e94c7 100644 --- a/pkg/controller/servingcert/starter/starter.go +++ b/pkg/controller/servingcert/starter/starter.go @@ -4,7 +4,6 @@ import ( "context" "crypto/x509" "fmt" - "io/ioutil" "os" "time" @@ -117,7 +116,7 @@ func StartServiceServingCertSigner(ctx context.Context, controllerContext *contr // bridge trust between the current and previous CA, but a new cluster // will not have a previous CA. func readIntermediateCACert(filename string) (*x509.Certificate, error) { - certsPEMBlock, err := ioutil.ReadFile(filename) + certsPEMBlock, err := os.ReadFile(filename) if os.IsNotExist(err) { klog.V(4).Infof("%q does not exist which indicates that an intermediate certificate was not specified", filename) return nil, nil diff --git a/test/util/rotate.go b/test/util/rotate.go index 333c0c192..931b1e1db 100644 --- a/test/util/rotate.go +++ b/test/util/rotate.go @@ -7,7 +7,6 @@ import ( "crypto/x509" "encoding/base64" "fmt" - "io/ioutil" "net" "net/http" "os" @@ -57,7 +56,7 @@ func CheckRotation(t testing.TB, dnsName string, oldCertPEM, oldKeyPEM, oldBundl func checkClientTrust(t testing.TB, testName, dnsName string, certPEM, keyPEM, bundlePEM []byte) { // Emulate how a service will consume the serving cert by writing // the cert and key to disk. - certFile, err := ioutil.TempFile("", v1.TLSCertKey) + certFile, err := os.CreateTemp("", v1.TLSCertKey) if err != nil { t.Fatalf("error creating tmpfile for cert: %v", err) @@ -73,7 +72,7 @@ func checkClientTrust(t testing.TB, testName, dnsName string, certPEM, keyPEM, b t.Fatalf("Error writing cert to disk: %v", err) } - keyFile, err := ioutil.TempFile("", v1.TLSPrivateKeyKey) + keyFile, err := os.CreateTemp("", v1.TLSPrivateKeyKey) if err != nil { t.Fatalf("error creating tmpfile for key: %v", err)