diff --git a/hack/.golint_failures b/hack/.golint_failures index 87f9d612b8e..a95f99df3b6 100644 --- a/hack/.golint_failures +++ b/hack/.golint_failures @@ -544,6 +544,7 @@ staging/src/k8s.io/apiserver/pkg/admission/plugin/initialization staging/src/k8s.io/apiserver/pkg/admission/plugin/namespace/lifecycle staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/config staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/mutating +staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/testcerts staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/validating staging/src/k8s.io/apiserver/pkg/apis/apiserver staging/src/k8s.io/apiserver/pkg/apis/apiserver/v1alpha1 diff --git a/staging/src/k8s.io/apiserver/pkg/admission/BUILD b/staging/src/k8s.io/apiserver/pkg/admission/BUILD index 9885a1ffe7d..90b3fd250ed 100644 --- a/staging/src/k8s.io/apiserver/pkg/admission/BUILD +++ b/staging/src/k8s.io/apiserver/pkg/admission/BUILD @@ -84,7 +84,7 @@ filegroup( "//staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/namespace:all-srcs", "//staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/request:all-srcs", "//staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/rules:all-srcs", - "//staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/testdata:all-srcs", + "//staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/testcerts:all-srcs", "//staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/validating:all-srcs", "//staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/versioned:all-srcs", ], diff --git a/staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/mutating/BUILD b/staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/mutating/BUILD index 00857d1d358..d31e6511525 100644 --- a/staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/mutating/BUILD +++ b/staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/mutating/BUILD @@ -49,7 +49,7 @@ go_test( "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", "//vendor/k8s.io/apiserver/pkg/admission:go_default_library", "//vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config:go_default_library", - "//vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/testdata:go_default_library", + "//vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/testcerts:go_default_library", "//vendor/k8s.io/apiserver/pkg/authentication/user:go_default_library", "//vendor/k8s.io/client-go/rest:go_default_library", ], diff --git a/staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/mutating/admission_test.go b/staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/mutating/admission_test.go index 8f3ec6b1e13..ae31acc2722 100644 --- a/staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/mutating/admission_test.go +++ b/staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/mutating/admission_test.go @@ -38,7 +38,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apiserver/pkg/admission" "k8s.io/apiserver/pkg/admission/plugin/webhook/config" - "k8s.io/apiserver/pkg/admission/plugin/webhook/testdata" + "k8s.io/apiserver/pkg/admission/plugin/webhook/testcerts" "k8s.io/apiserver/pkg/authentication/user" "k8s.io/client-go/rest" ) @@ -97,7 +97,7 @@ func ccfgSVC(urlPath string) registrationv1alpha1.WebhookClientConfig { Namespace: "default", Path: &urlPath, }, - CABundle: testdata.CACert, + CABundle: testcerts.CACert, } } @@ -112,7 +112,7 @@ func (c urlConfigGenerator) ccfgURL(urlPath string) registrationv1alpha1.Webhook urlString := u2.String() return registrationv1alpha1.WebhookClientConfig{ URL: &urlString, - CABundle: testdata.CACert, + CABundle: testcerts.CACert, } } @@ -557,12 +557,12 @@ func TestAdmitCachedClient(t *testing.T) { func newTestServer(t *testing.T) *httptest.Server { // Create the test webhook server - sCert, err := tls.X509KeyPair(testdata.ServerCert, testdata.ServerKey) + sCert, err := tls.X509KeyPair(testcerts.ServerCert, testcerts.ServerKey) if err != nil { t.Fatal(err) } rootCAs := x509.NewCertPool() - rootCAs.AppendCertsFromPEM(testdata.CACert) + rootCAs.AppendCertsFromPEM(testcerts.CACert) testServer := httptest.NewUnstartedServer(http.HandlerFunc(webhookHandler)) testServer.TLS = &tls.Config{ Certificates: []tls.Certificate{sCert}, @@ -618,9 +618,9 @@ func newFakeAuthenticationInfoResolver(count *int32) *fakeAuthenticationInfoReso return &fakeAuthenticationInfoResolver{ restConfig: &rest.Config{ TLSClientConfig: rest.TLSClientConfig{ - CAData: testdata.CACert, - CertData: testdata.ClientCert, - KeyData: testdata.ClientKey, + CAData: testcerts.CACert, + CertData: testcerts.ClientCert, + KeyData: testcerts.ClientKey, }, }, cachedCount: count, diff --git a/staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/testdata/BUILD b/staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/testcerts/BUILD similarity index 97% rename from staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/testdata/BUILD rename to staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/testcerts/BUILD index 53eead67d33..392232d3354 100644 --- a/staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/testdata/BUILD +++ b/staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/testcerts/BUILD @@ -6,7 +6,7 @@ go_library( "certs.go", "doc.go", ], - importpath = "k8s.io/apiserver/pkg/admission/plugin/webhook/testdata", + importpath = "k8s.io/apiserver/pkg/admission/plugin/webhook/testcerts", visibility = ["//visibility:public"], ) diff --git a/staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/testdata/certs.go b/staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/testcerts/certs.go similarity index 99% rename from staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/testdata/certs.go rename to staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/testcerts/certs.go index 8e5d2d13f34..bb7b81f6ae7 100644 --- a/staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/testdata/certs.go +++ b/staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/testcerts/certs.go @@ -17,7 +17,7 @@ limitations under the License. // This file was generated using openssl by the gencerts.sh script // and holds raw certificates for the webhook tests. -package testdata +package testcerts var CAKey = []byte(`-----BEGIN RSA PRIVATE KEY----- MIIEogIBAAKCAQEArqnW4K+UsmPzbSB7JYhN0HNsJNItjw/87SJxIjGqUttC+2ts diff --git a/staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/testdata/doc.go b/staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/testcerts/doc.go similarity index 79% rename from staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/testdata/doc.go rename to staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/testcerts/doc.go index 0f11ec834e3..a06fe3a6f8f 100644 --- a/staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/testdata/doc.go +++ b/staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/testcerts/doc.go @@ -14,6 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Package testdata contains generated key pairs used by the unit tests of +// Package testcerts contains generated key pairs used by the unit tests of // mutating and validating webhooks. They are for testing only. -package testdata // import "k8s.io/apiserver/pkg/admission/plugin/webhook/testdata" +package testcerts // import "k8s.io/apiserver/pkg/admission/plugin/webhook/testcerts" diff --git a/staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/testdata/gencerts.sh b/staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/testcerts/gencerts.sh similarity index 98% rename from staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/testdata/gencerts.sh rename to staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/testcerts/gencerts.sh index 1df97774aae..d4145c606ac 100755 --- a/staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/testdata/gencerts.sh +++ b/staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/testcerts/gencerts.sh @@ -95,7 +95,7 @@ EOF echo "// This file was generated using openssl by the gencerts.sh script" >> $outfile echo "// and holds raw certificates for the webhook tests." >> $outfile echo "" >> $outfile -echo "package testdata" >> $outfile +echo "package testcerts" >> $outfile for file in CAKey CACert BadCAKey BadCACert ServerKey ServerCert ClientKey ClientCert; do data=$(cat ${file}.pem) echo "" >> $outfile diff --git a/staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/validating/BUILD b/staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/validating/BUILD index 059463c04ab..111242176a3 100644 --- a/staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/validating/BUILD +++ b/staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/validating/BUILD @@ -47,7 +47,7 @@ go_test( "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", "//vendor/k8s.io/apiserver/pkg/admission:go_default_library", "//vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config:go_default_library", - "//vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/testdata:go_default_library", + "//vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/testcerts:go_default_library", "//vendor/k8s.io/apiserver/pkg/authentication/user:go_default_library", "//vendor/k8s.io/client-go/rest:go_default_library", ], diff --git a/staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/validating/admission_test.go b/staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/validating/admission_test.go index da7b5105347..1e4602b0e0f 100644 --- a/staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/validating/admission_test.go +++ b/staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/validating/admission_test.go @@ -38,7 +38,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apiserver/pkg/admission" "k8s.io/apiserver/pkg/admission/plugin/webhook/config" - "k8s.io/apiserver/pkg/admission/plugin/webhook/testdata" + "k8s.io/apiserver/pkg/admission/plugin/webhook/testcerts" "k8s.io/apiserver/pkg/authentication/user" "k8s.io/client-go/rest" ) @@ -97,7 +97,7 @@ func ccfgSVC(urlPath string) registrationv1alpha1.WebhookClientConfig { Namespace: "default", Path: &urlPath, }, - CABundle: testdata.CACert, + CABundle: testcerts.CACert, } } @@ -112,7 +112,7 @@ func (c urlConfigGenerator) ccfgURL(urlPath string) registrationv1alpha1.Webhook urlString := u2.String() return registrationv1alpha1.WebhookClientConfig{ URL: &urlString, - CABundle: testdata.CACert, + CABundle: testcerts.CACert, } } @@ -579,12 +579,12 @@ func TestAdmitCachedClient(t *testing.T) { func newTestServer(t *testing.T) *httptest.Server { // Create the test webhook server - sCert, err := tls.X509KeyPair(testdata.ServerCert, testdata.ServerKey) + sCert, err := tls.X509KeyPair(testcerts.ServerCert, testcerts.ServerKey) if err != nil { t.Fatal(err) } rootCAs := x509.NewCertPool() - rootCAs.AppendCertsFromPEM(testdata.CACert) + rootCAs.AppendCertsFromPEM(testcerts.CACert) testServer := httptest.NewUnstartedServer(http.HandlerFunc(webhookHandler)) testServer.TLS = &tls.Config{ Certificates: []tls.Certificate{sCert}, @@ -643,9 +643,9 @@ func newFakeAuthenticationInfoResolver(count *int32) *fakeAuthenticationInfoReso return &fakeAuthenticationInfoResolver{ restConfig: &rest.Config{ TLSClientConfig: rest.TLSClientConfig{ - CAData: testdata.CACert, - CertData: testdata.ClientCert, - KeyData: testdata.ClientKey, + CAData: testcerts.CACert, + CertData: testcerts.ClientCert, + KeyData: testcerts.ClientKey, }, }, cachedCount: count,