Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
2052a7e2
Commit
2052a7e2
authored
Nov 17, 2017
by
Chao Xu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename the testdata package to testcerts.
`godep save` somehow fails if there is a testdata go package. See
https://github.com/kubernetes/kubernetes/pull/54892#issuecomment-345035489
parent
6193360e
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
25 additions
and
24 deletions
+25
-24
.golint_failures
hack/.golint_failures
+1
-0
BUILD
staging/src/k8s.io/apiserver/pkg/admission/BUILD
+1
-1
BUILD
....io/apiserver/pkg/admission/plugin/webhook/mutating/BUILD
+1
-1
admission_test.go
...r/pkg/admission/plugin/webhook/mutating/admission_test.go
+8
-8
BUILD
...io/apiserver/pkg/admission/plugin/webhook/testcerts/BUILD
+1
-1
certs.go
...apiserver/pkg/admission/plugin/webhook/testcerts/certs.go
+1
-1
doc.go
...o/apiserver/pkg/admission/plugin/webhook/testcerts/doc.go
+2
-2
gencerts.sh
...server/pkg/admission/plugin/webhook/testcerts/gencerts.sh
+1
-1
BUILD
...o/apiserver/pkg/admission/plugin/webhook/validating/BUILD
+1
-1
admission_test.go
...pkg/admission/plugin/webhook/validating/admission_test.go
+8
-8
No files found.
hack/.golint_failures
View file @
2052a7e2
...
@@ -544,6 +544,7 @@ staging/src/k8s.io/apiserver/pkg/admission/plugin/initialization
...
@@ -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/namespace/lifecycle
staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/config
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/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/admission/plugin/webhook/validating
staging/src/k8s.io/apiserver/pkg/apis/apiserver
staging/src/k8s.io/apiserver/pkg/apis/apiserver
staging/src/k8s.io/apiserver/pkg/apis/apiserver/v1alpha1
staging/src/k8s.io/apiserver/pkg/apis/apiserver/v1alpha1
...
...
staging/src/k8s.io/apiserver/pkg/admission/BUILD
View file @
2052a7e2
...
@@ -84,7 +84,7 @@ filegroup(
...
@@ -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/namespace:all-srcs",
"//staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/request: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/rules:all-srcs",
"//staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/test
data
:all-srcs",
"//staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/test
certs
:all-srcs",
"//staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/validating: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",
"//staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/versioned:all-srcs",
],
],
...
...
staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/mutating/BUILD
View file @
2052a7e2
...
@@ -49,7 +49,7 @@ go_test(
...
@@ -49,7 +49,7 @@ go_test(
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apiserver/pkg/admission: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/config:go_default_library",
"//vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/test
data
:go_default_library",
"//vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/test
certs
:go_default_library",
"//vendor/k8s.io/apiserver/pkg/authentication/user:go_default_library",
"//vendor/k8s.io/apiserver/pkg/authentication/user:go_default_library",
"//vendor/k8s.io/client-go/rest:go_default_library",
"//vendor/k8s.io/client-go/rest:go_default_library",
],
],
...
...
staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/mutating/admission_test.go
View file @
2052a7e2
...
@@ -38,7 +38,7 @@ import (
...
@@ -38,7 +38,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apiserver/pkg/admission"
"k8s.io/apiserver/pkg/admission"
"k8s.io/apiserver/pkg/admission/plugin/webhook/config"
"k8s.io/apiserver/pkg/admission/plugin/webhook/config"
"k8s.io/apiserver/pkg/admission/plugin/webhook/test
data
"
"k8s.io/apiserver/pkg/admission/plugin/webhook/test
certs
"
"k8s.io/apiserver/pkg/authentication/user"
"k8s.io/apiserver/pkg/authentication/user"
"k8s.io/client-go/rest"
"k8s.io/client-go/rest"
)
)
...
@@ -97,7 +97,7 @@ func ccfgSVC(urlPath string) registrationv1alpha1.WebhookClientConfig {
...
@@ -97,7 +97,7 @@ func ccfgSVC(urlPath string) registrationv1alpha1.WebhookClientConfig {
Namespace
:
"default"
,
Namespace
:
"default"
,
Path
:
&
urlPath
,
Path
:
&
urlPath
,
},
},
CABundle
:
test
data
.
CACert
,
CABundle
:
test
certs
.
CACert
,
}
}
}
}
...
@@ -112,7 +112,7 @@ func (c urlConfigGenerator) ccfgURL(urlPath string) registrationv1alpha1.Webhook
...
@@ -112,7 +112,7 @@ func (c urlConfigGenerator) ccfgURL(urlPath string) registrationv1alpha1.Webhook
urlString
:=
u2
.
String
()
urlString
:=
u2
.
String
()
return
registrationv1alpha1
.
WebhookClientConfig
{
return
registrationv1alpha1
.
WebhookClientConfig
{
URL
:
&
urlString
,
URL
:
&
urlString
,
CABundle
:
test
data
.
CACert
,
CABundle
:
test
certs
.
CACert
,
}
}
}
}
...
@@ -557,12 +557,12 @@ func TestAdmitCachedClient(t *testing.T) {
...
@@ -557,12 +557,12 @@ func TestAdmitCachedClient(t *testing.T) {
func
newTestServer
(
t
*
testing
.
T
)
*
httptest
.
Server
{
func
newTestServer
(
t
*
testing
.
T
)
*
httptest
.
Server
{
// Create the test webhook server
// Create the test webhook server
sCert
,
err
:=
tls
.
X509KeyPair
(
test
data
.
ServerCert
,
testdata
.
ServerKey
)
sCert
,
err
:=
tls
.
X509KeyPair
(
test
certs
.
ServerCert
,
testcerts
.
ServerKey
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
rootCAs
:=
x509
.
NewCertPool
()
rootCAs
:=
x509
.
NewCertPool
()
rootCAs
.
AppendCertsFromPEM
(
test
data
.
CACert
)
rootCAs
.
AppendCertsFromPEM
(
test
certs
.
CACert
)
testServer
:=
httptest
.
NewUnstartedServer
(
http
.
HandlerFunc
(
webhookHandler
))
testServer
:=
httptest
.
NewUnstartedServer
(
http
.
HandlerFunc
(
webhookHandler
))
testServer
.
TLS
=
&
tls
.
Config
{
testServer
.
TLS
=
&
tls
.
Config
{
Certificates
:
[]
tls
.
Certificate
{
sCert
},
Certificates
:
[]
tls
.
Certificate
{
sCert
},
...
@@ -618,9 +618,9 @@ func newFakeAuthenticationInfoResolver(count *int32) *fakeAuthenticationInfoReso
...
@@ -618,9 +618,9 @@ func newFakeAuthenticationInfoResolver(count *int32) *fakeAuthenticationInfoReso
return
&
fakeAuthenticationInfoResolver
{
return
&
fakeAuthenticationInfoResolver
{
restConfig
:
&
rest
.
Config
{
restConfig
:
&
rest
.
Config
{
TLSClientConfig
:
rest
.
TLSClientConfig
{
TLSClientConfig
:
rest
.
TLSClientConfig
{
CAData
:
test
data
.
CACert
,
CAData
:
test
certs
.
CACert
,
CertData
:
test
data
.
ClientCert
,
CertData
:
test
certs
.
ClientCert
,
KeyData
:
test
data
.
ClientKey
,
KeyData
:
test
certs
.
ClientKey
,
},
},
},
},
cachedCount
:
count
,
cachedCount
:
count
,
...
...
staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/test
data
/BUILD
→
staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/test
certs
/BUILD
View file @
2052a7e2
...
@@ -6,7 +6,7 @@ go_library(
...
@@ -6,7 +6,7 @@ go_library(
"certs.go",
"certs.go",
"doc.go",
"doc.go",
],
],
importpath = "k8s.io/apiserver/pkg/admission/plugin/webhook/test
data
",
importpath = "k8s.io/apiserver/pkg/admission/plugin/webhook/test
certs
",
visibility = ["//visibility:public"],
visibility = ["//visibility:public"],
)
)
...
...
staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/test
data
/certs.go
→
staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/test
certs
/certs.go
View file @
2052a7e2
...
@@ -17,7 +17,7 @@ limitations under the License.
...
@@ -17,7 +17,7 @@ limitations under the License.
// This file was generated using openssl by the gencerts.sh script
// This file was generated using openssl by the gencerts.sh script
// and holds raw certificates for the webhook tests.
// and holds raw certificates for the webhook tests.
package
test
data
package
test
certs
var
CAKey
=
[]
byte
(
`-----BEGIN RSA PRIVATE KEY-----
var
CAKey
=
[]
byte
(
`-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEArqnW4K+UsmPzbSB7JYhN0HNsJNItjw/87SJxIjGqUttC+2ts
MIIEogIBAAKCAQEArqnW4K+UsmPzbSB7JYhN0HNsJNItjw/87SJxIjGqUttC+2ts
...
...
staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/test
data
/doc.go
→
staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/test
certs
/doc.go
View file @
2052a7e2
...
@@ -14,6 +14,6 @@ See the License for the specific language governing permissions and
...
@@ -14,6 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
*/
*/
// Package test
data
contains generated key pairs used by the unit tests of
// Package test
certs
contains generated key pairs used by the unit tests of
// mutating and validating webhooks. They are for testing only.
// mutating and validating webhooks. They are for testing only.
package
test
data
// import "k8s.io/apiserver/pkg/admission/plugin/webhook/testdata
"
package
test
certs
// import "k8s.io/apiserver/pkg/admission/plugin/webhook/testcerts
"
staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/test
data
/gencerts.sh
→
staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/test
certs
/gencerts.sh
View file @
2052a7e2
...
@@ -95,7 +95,7 @@ EOF
...
@@ -95,7 +95,7 @@ EOF
echo
"// This file was generated using openssl by the gencerts.sh script"
>>
$outfile
echo
"// This file was generated using openssl by the gencerts.sh script"
>>
$outfile
echo
"// and holds raw certificates for the webhook tests."
>>
$outfile
echo
"// and holds raw certificates for the webhook tests."
>>
$outfile
echo
""
>>
$outfile
echo
""
>>
$outfile
echo
"package test
data
"
>>
$outfile
echo
"package test
certs
"
>>
$outfile
for
file
in
CAKey CACert BadCAKey BadCACert ServerKey ServerCert ClientKey ClientCert
;
do
for
file
in
CAKey CACert BadCAKey BadCACert ServerKey ServerCert ClientKey ClientCert
;
do
data
=
$(
cat
${
file
}
.pem
)
data
=
$(
cat
${
file
}
.pem
)
echo
""
>>
$outfile
echo
""
>>
$outfile
...
...
staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/validating/BUILD
View file @
2052a7e2
...
@@ -47,7 +47,7 @@ go_test(
...
@@ -47,7 +47,7 @@ go_test(
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apiserver/pkg/admission: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/config:go_default_library",
"//vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/test
data
:go_default_library",
"//vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/test
certs
:go_default_library",
"//vendor/k8s.io/apiserver/pkg/authentication/user:go_default_library",
"//vendor/k8s.io/apiserver/pkg/authentication/user:go_default_library",
"//vendor/k8s.io/client-go/rest:go_default_library",
"//vendor/k8s.io/client-go/rest:go_default_library",
],
],
...
...
staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/validating/admission_test.go
View file @
2052a7e2
...
@@ -38,7 +38,7 @@ import (
...
@@ -38,7 +38,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apiserver/pkg/admission"
"k8s.io/apiserver/pkg/admission"
"k8s.io/apiserver/pkg/admission/plugin/webhook/config"
"k8s.io/apiserver/pkg/admission/plugin/webhook/config"
"k8s.io/apiserver/pkg/admission/plugin/webhook/test
data
"
"k8s.io/apiserver/pkg/admission/plugin/webhook/test
certs
"
"k8s.io/apiserver/pkg/authentication/user"
"k8s.io/apiserver/pkg/authentication/user"
"k8s.io/client-go/rest"
"k8s.io/client-go/rest"
)
)
...
@@ -97,7 +97,7 @@ func ccfgSVC(urlPath string) registrationv1alpha1.WebhookClientConfig {
...
@@ -97,7 +97,7 @@ func ccfgSVC(urlPath string) registrationv1alpha1.WebhookClientConfig {
Namespace
:
"default"
,
Namespace
:
"default"
,
Path
:
&
urlPath
,
Path
:
&
urlPath
,
},
},
CABundle
:
test
data
.
CACert
,
CABundle
:
test
certs
.
CACert
,
}
}
}
}
...
@@ -112,7 +112,7 @@ func (c urlConfigGenerator) ccfgURL(urlPath string) registrationv1alpha1.Webhook
...
@@ -112,7 +112,7 @@ func (c urlConfigGenerator) ccfgURL(urlPath string) registrationv1alpha1.Webhook
urlString
:=
u2
.
String
()
urlString
:=
u2
.
String
()
return
registrationv1alpha1
.
WebhookClientConfig
{
return
registrationv1alpha1
.
WebhookClientConfig
{
URL
:
&
urlString
,
URL
:
&
urlString
,
CABundle
:
test
data
.
CACert
,
CABundle
:
test
certs
.
CACert
,
}
}
}
}
...
@@ -579,12 +579,12 @@ func TestAdmitCachedClient(t *testing.T) {
...
@@ -579,12 +579,12 @@ func TestAdmitCachedClient(t *testing.T) {
func
newTestServer
(
t
*
testing
.
T
)
*
httptest
.
Server
{
func
newTestServer
(
t
*
testing
.
T
)
*
httptest
.
Server
{
// Create the test webhook server
// Create the test webhook server
sCert
,
err
:=
tls
.
X509KeyPair
(
test
data
.
ServerCert
,
testdata
.
ServerKey
)
sCert
,
err
:=
tls
.
X509KeyPair
(
test
certs
.
ServerCert
,
testcerts
.
ServerKey
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
rootCAs
:=
x509
.
NewCertPool
()
rootCAs
:=
x509
.
NewCertPool
()
rootCAs
.
AppendCertsFromPEM
(
test
data
.
CACert
)
rootCAs
.
AppendCertsFromPEM
(
test
certs
.
CACert
)
testServer
:=
httptest
.
NewUnstartedServer
(
http
.
HandlerFunc
(
webhookHandler
))
testServer
:=
httptest
.
NewUnstartedServer
(
http
.
HandlerFunc
(
webhookHandler
))
testServer
.
TLS
=
&
tls
.
Config
{
testServer
.
TLS
=
&
tls
.
Config
{
Certificates
:
[]
tls
.
Certificate
{
sCert
},
Certificates
:
[]
tls
.
Certificate
{
sCert
},
...
@@ -643,9 +643,9 @@ func newFakeAuthenticationInfoResolver(count *int32) *fakeAuthenticationInfoReso
...
@@ -643,9 +643,9 @@ func newFakeAuthenticationInfoResolver(count *int32) *fakeAuthenticationInfoReso
return
&
fakeAuthenticationInfoResolver
{
return
&
fakeAuthenticationInfoResolver
{
restConfig
:
&
rest
.
Config
{
restConfig
:
&
rest
.
Config
{
TLSClientConfig
:
rest
.
TLSClientConfig
{
TLSClientConfig
:
rest
.
TLSClientConfig
{
CAData
:
test
data
.
CACert
,
CAData
:
test
certs
.
CACert
,
CertData
:
test
data
.
ClientCert
,
CertData
:
test
certs
.
ClientCert
,
KeyData
:
test
data
.
ClientKey
,
KeyData
:
test
certs
.
ClientKey
,
},
},
},
},
cachedCount
:
count
,
cachedCount
:
count
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment