Merge pull request #113257 from claudiubelu/path-filepath-update-staging
Replaces path.Operation with filepath.Operation (staging) Kubernetes-commit: 80542ca2e318f6f82429822b267497570b7ecca5
This commit is contained in:
commit
389b2eeaf6
9
go.mod
9
go.mod
|
|
@ -30,10 +30,10 @@ require (
|
||||||
github.com/stretchr/testify v1.8.4
|
github.com/stretchr/testify v1.8.4
|
||||||
golang.org/x/sys v0.18.0
|
golang.org/x/sys v0.18.0
|
||||||
gopkg.in/yaml.v2 v2.4.0
|
gopkg.in/yaml.v2 v2.4.0
|
||||||
k8s.io/api v0.0.0-20240418093414-76b6c7ce02a4
|
k8s.io/api v0.0.0-20240418133400-98d0c7a1b77e
|
||||||
k8s.io/apimachinery v0.0.0-20240418133208-ea31e5150286
|
k8s.io/apimachinery v0.0.0-20240418133208-ea31e5150286
|
||||||
k8s.io/cli-runtime v0.0.0-20240404041703-9ad5569b61bc
|
k8s.io/cli-runtime v0.0.0-20240404041703-9ad5569b61bc
|
||||||
k8s.io/client-go v0.0.0-20240418093651-9990b0b122c9
|
k8s.io/client-go v0.0.0-20240418173638-506bc538e679
|
||||||
k8s.io/component-base v0.0.0-20240418094434-57ba0489bfa6
|
k8s.io/component-base v0.0.0-20240418094434-57ba0489bfa6
|
||||||
k8s.io/component-helpers v0.0.0-20240404040358-dc3c4990ec39
|
k8s.io/component-helpers v0.0.0-20240404040358-dc3c4990ec39
|
||||||
k8s.io/klog/v2 v2.120.1
|
k8s.io/klog/v2 v2.120.1
|
||||||
|
|
@ -95,4 +95,7 @@ require (
|
||||||
sigs.k8s.io/kustomize/api v0.13.5-0.20230601165947-6ce0bf390ce3 // indirect
|
sigs.k8s.io/kustomize/api v0.13.5-0.20230601165947-6ce0bf390ce3 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
replace k8s.io/code-generator => k8s.io/code-generator v0.0.0-20240418094311-d3d5e9c408c7
|
replace (
|
||||||
|
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20240418133208-0ee3e6150890
|
||||||
|
k8s.io/code-generator => k8s.io/code-generator v0.0.0-20240418134157-4c3e41ed1361
|
||||||
|
)
|
||||||
|
|
|
||||||
12
go.sum
12
go.sum
|
|
@ -276,14 +276,14 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||||
k8s.io/api v0.0.0-20240418093414-76b6c7ce02a4 h1:Aoz6y1eO+GKFC27cTyO+VJkbaEyQsGec2IhAYYaN7IU=
|
k8s.io/api v0.0.0-20240418133400-98d0c7a1b77e h1:aMC4qrBMfXPVWNvK5a9JWrPqAYF7IqaEil4veyTpq14=
|
||||||
k8s.io/api v0.0.0-20240418093414-76b6c7ce02a4/go.mod h1:sbi+6EMV/95qn9kNfIj4HSNs4jcBqkcBxEAD+AKHUHY=
|
k8s.io/api v0.0.0-20240418133400-98d0c7a1b77e/go.mod h1:aiyYpZwHjPqNTHVIbcUReEDsDv1bLzwNhSENZpETJiA=
|
||||||
k8s.io/apimachinery v0.0.0-20240418133208-ea31e5150286 h1:pGpFsAFMSxtFe98HpTcgDgblsARQhckNfASAgCmlXS4=
|
k8s.io/apimachinery v0.0.0-20240418133208-0ee3e6150890 h1:QnCWgLriYnSGYNYeDsMidsvvh4zidzUylhjQeKRajk4=
|
||||||
k8s.io/apimachinery v0.0.0-20240418133208-ea31e5150286/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc=
|
k8s.io/apimachinery v0.0.0-20240418133208-0ee3e6150890/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc=
|
||||||
k8s.io/cli-runtime v0.0.0-20240404041703-9ad5569b61bc h1:a12ozjrLRSgKfGuGr0tFr7Aw+jheNPDo6jh/Y1AOkhU=
|
k8s.io/cli-runtime v0.0.0-20240404041703-9ad5569b61bc h1:a12ozjrLRSgKfGuGr0tFr7Aw+jheNPDo6jh/Y1AOkhU=
|
||||||
k8s.io/cli-runtime v0.0.0-20240404041703-9ad5569b61bc/go.mod h1:XYjtKcGQuoX/UlaQtuRlfn9WIdSSrwDwKAkUx4OdbTk=
|
k8s.io/cli-runtime v0.0.0-20240404041703-9ad5569b61bc/go.mod h1:XYjtKcGQuoX/UlaQtuRlfn9WIdSSrwDwKAkUx4OdbTk=
|
||||||
k8s.io/client-go v0.0.0-20240418093651-9990b0b122c9 h1:eC8SD8kFISw8xhx2kTsXpIuB4qOGtCUdnK+ciXaJeEA=
|
k8s.io/client-go v0.0.0-20240418173638-506bc538e679 h1:x9oHiNTs/lrzJfkaybVyLxt1PFp12Gc40AwXvF1VNRs=
|
||||||
k8s.io/client-go v0.0.0-20240418093651-9990b0b122c9/go.mod h1:qmgPSZQ21ke/aLcgydRX8fK48pjHfF4anbvDcixuBqM=
|
k8s.io/client-go v0.0.0-20240418173638-506bc538e679/go.mod h1:d+DhvLYByKBJBwanqBYpznH6zR4aeyALOnos5TJnNQA=
|
||||||
k8s.io/component-base v0.0.0-20240418094434-57ba0489bfa6 h1:ZdeuYrtChorFLu6yEbUE48mY6xXc/gkTqd5BFenIAyk=
|
k8s.io/component-base v0.0.0-20240418094434-57ba0489bfa6 h1:ZdeuYrtChorFLu6yEbUE48mY6xXc/gkTqd5BFenIAyk=
|
||||||
k8s.io/component-base v0.0.0-20240418094434-57ba0489bfa6/go.mod h1:sJI0btwpLHRQW24fjrxPwCC8dPfDnLT5Zjjvo1E3BeA=
|
k8s.io/component-base v0.0.0-20240418094434-57ba0489bfa6/go.mod h1:sJI0btwpLHRQW24fjrxPwCC8dPfDnLT5Zjjvo1E3BeA=
|
||||||
k8s.io/component-helpers v0.0.0-20240404040358-dc3c4990ec39 h1:yFNJtVS8DolGRhcPad11SVhYrhkuZnvt/UH78jHUpjs=
|
k8s.io/component-helpers v0.0.0-20240404040358-dc3c4990ec39 h1:yFNJtVS8DolGRhcPad11SVhYrhkuZnvt/UH78jHUpjs=
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
"path/filepath"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
@ -118,8 +119,8 @@ func setupOutputWriter(dir string, defaultWriter io.Writer, filename string, fil
|
||||||
if len(dir) == 0 || dir == "-" {
|
if len(dir) == 0 || dir == "-" {
|
||||||
return defaultWriter
|
return defaultWriter
|
||||||
}
|
}
|
||||||
fullFile := path.Join(dir, filename) + fileExtension
|
fullFile := filepath.Join(dir, filename) + fileExtension
|
||||||
parent := path.Dir(fullFile)
|
parent := filepath.Dir(fullFile)
|
||||||
cmdutil.CheckErr(os.MkdirAll(parent, 0755))
|
cmdutil.CheckErr(os.MkdirAll(parent, 0755))
|
||||||
|
|
||||||
file, err := os.Create(fullFile)
|
file, err := os.Create(fullFile)
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ package clusterinfo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"k8s.io/cli-runtime/pkg/genericiooptions"
|
"k8s.io/cli-runtime/pkg/genericiooptions"
|
||||||
|
|
@ -60,7 +60,7 @@ func TestSetupOutputWriterFile(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("unexpected error: %v", err)
|
t.Errorf("unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
fullPath := path.Join(dir, file) + extension
|
fullPath := filepath.Join(dir, file) + extension
|
||||||
defer os.RemoveAll(dir)
|
defer os.RemoveAll(dir)
|
||||||
|
|
||||||
_, _, buf, _ := genericiooptions.NewTestIOStreams()
|
_, _, buf, _ := genericiooptions.NewTestIOStreams()
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ package config
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path/filepath"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
@ -415,7 +415,7 @@ func TestEmptyTokenAndCertAllowed(t *testing.T) {
|
||||||
defer utiltesting.CloseAndRemove(t, fakeCertFile)
|
defer utiltesting.CloseAndRemove(t, fakeCertFile)
|
||||||
expectedConfig := newRedFederalCowHammerConfig()
|
expectedConfig := newRedFederalCowHammerConfig()
|
||||||
authInfo := clientcmdapi.NewAuthInfo()
|
authInfo := clientcmdapi.NewAuthInfo()
|
||||||
authInfo.ClientCertificate = path.Base(fakeCertFile.Name())
|
authInfo.ClientCertificate = filepath.Base(fakeCertFile.Name())
|
||||||
expectedConfig.AuthInfos["another-user"] = authInfo
|
expectedConfig.AuthInfos["another-user"] = authInfo
|
||||||
|
|
||||||
test := configCommandTest{
|
test := configCommandTest{
|
||||||
|
|
@ -660,7 +660,7 @@ func TestCAClearsInsecure(t *testing.T) {
|
||||||
clusterInfoWithInsecure.InsecureSkipTLSVerify = true
|
clusterInfoWithInsecure.InsecureSkipTLSVerify = true
|
||||||
|
|
||||||
clusterInfoWithCA := clientcmdapi.NewCluster()
|
clusterInfoWithCA := clientcmdapi.NewCluster()
|
||||||
clusterInfoWithCA.CertificateAuthority = path.Base(fakeCAFile.Name())
|
clusterInfoWithCA.CertificateAuthority = filepath.Base(fakeCAFile.Name())
|
||||||
|
|
||||||
startingConfig := newRedFederalCowHammerConfig()
|
startingConfig := newRedFederalCowHammerConfig()
|
||||||
startingConfig.Clusters["another-cluster"] = clusterInfoWithInsecure
|
startingConfig.Clusters["another-cluster"] = clusterInfoWithInsecure
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
|
|
||||||
|
|
@ -320,7 +320,7 @@ func handleConfigMapFromFileSources(configMap *corev1.ConfigMap, fileSources []s
|
||||||
return fmt.Errorf("error listing files in %s: %v", filePath, err)
|
return fmt.Errorf("error listing files in %s: %v", filePath, err)
|
||||||
}
|
}
|
||||||
for _, item := range fileList {
|
for _, item := range fileList {
|
||||||
itemPath := path.Join(filePath, item.Name())
|
itemPath := filepath.Join(filePath, item.Name())
|
||||||
if item.Type().IsRegular() {
|
if item.Type().IsRegular() {
|
||||||
keyName = item.Name()
|
keyName = item.Name()
|
||||||
err = addKeyFromFileToConfigMap(configMap, keyName, itemPath)
|
err = addKeyFromFileToConfigMap(configMap, keyName, itemPath)
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
@ -349,7 +349,7 @@ func handleSecretFromFileSources(secret *corev1.Secret, fileSources []string) er
|
||||||
return fmt.Errorf("error listing files in %s: %v", filePath, err)
|
return fmt.Errorf("error listing files in %s: %v", filePath, err)
|
||||||
}
|
}
|
||||||
for _, item := range fileList {
|
for _, item := range fileList {
|
||||||
itemPath := path.Join(filePath, item.Name())
|
itemPath := filepath.Join(filePath, item.Name())
|
||||||
if item.Type().IsRegular() {
|
if item.Type().IsRegular() {
|
||||||
keyName = item.Name()
|
keyName = item.Name()
|
||||||
if err := addKeyFromFileToSecret(secret, keyName, itemPath); err != nil {
|
if err := addKeyFromFileToSecret(secret, keyName, itemPath); err != nil {
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ package create
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
|
|
@ -197,8 +197,8 @@ func write(path, contents string, t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func writeKeyPair(tmpDirPath, key, cert string, t *testing.T) (keyPath, certPath string) {
|
func writeKeyPair(tmpDirPath, key, cert string, t *testing.T) (keyPath, certPath string) {
|
||||||
keyPath = path.Join(tmpDirPath, "tls.key")
|
keyPath = filepath.Join(tmpDirPath, "tls.key")
|
||||||
certPath = path.Join(tmpDirPath, "tls.cert")
|
certPath = filepath.Join(tmpDirPath, "tls.cert")
|
||||||
write(keyPath, key, t)
|
write(keyPath, key, t)
|
||||||
write(certPath, cert, t)
|
write(certPath, cert, t)
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
@ -130,7 +129,7 @@ func TestDiffVersion(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
fcontent, err := os.ReadFile(path.Join(diff.Dir.Name, obj.Name()))
|
fcontent, err := os.ReadFile(filepath.Join(diff.Dir.Name, obj.Name()))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
@ -201,7 +200,7 @@ func TestDiffer(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
fcontent, err := os.ReadFile(path.Join(diff.From.Dir.Name, obj.Name()))
|
fcontent, err := os.ReadFile(filepath.Join(diff.From.Dir.Name, obj.Name()))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
@ -210,7 +209,7 @@ func TestDiffer(t *testing.T) {
|
||||||
t.Fatalf("File has %q, expected %q", string(fcontent), econtent)
|
t.Fatalf("File has %q, expected %q", string(fcontent), econtent)
|
||||||
}
|
}
|
||||||
|
|
||||||
fcontent, err = os.ReadFile(path.Join(diff.To.Dir.Name, obj.Name()))
|
fcontent, err = os.ReadFile(filepath.Join(diff.To.Dir.Name, obj.Name()))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
@ -286,12 +285,12 @@ metadata:
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
actualFromContent, _ := os.ReadFile(path.Join(diff.From.Dir.Name, obj.Name()))
|
actualFromContent, _ := os.ReadFile(filepath.Join(diff.From.Dir.Name, obj.Name()))
|
||||||
if string(actualFromContent) != tc.expectedFromContent {
|
if string(actualFromContent) != tc.expectedFromContent {
|
||||||
t.Fatalf("File has %q, expected %q", string(actualFromContent), tc.expectedFromContent)
|
t.Fatalf("File has %q, expected %q", string(actualFromContent), tc.expectedFromContent)
|
||||||
}
|
}
|
||||||
|
|
||||||
actualToContent, _ := os.ReadFile(path.Join(diff.To.Dir.Name, obj.Name()))
|
actualToContent, _ := os.ReadFile(filepath.Join(diff.To.Dir.Name, obj.Name()))
|
||||||
if string(actualToContent) != tc.expectedToContent {
|
if string(actualToContent) != tc.expectedToContent {
|
||||||
t.Fatalf("File has %q, expected %q", string(actualToContent), tc.expectedToContent)
|
t.Fatalf("File has %q, expected %q", string(actualToContent), tc.expectedToContent)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue