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
1afc25d5
Commit
1afc25d5
authored
Mar 02, 2019
by
Mehdy Bohlool
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change e2e test to use custom ports
parent
8702550b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
10 deletions
+36
-10
aggregator.go
test/e2e/apimachinery/aggregator.go
+7
-1
crd_conversion_webhook.go
test/e2e/apimachinery/crd_conversion_webhook.go
+7
-3
webhook.go
test/e2e/apimachinery/webhook.go
+22
-6
No files found.
test/e2e/apimachinery/aggregator.go
View file @
1afc25d5
...
...
@@ -42,12 +42,17 @@ import (
"k8s.io/kubernetes/test/e2e/framework"
imageutils
"k8s.io/kubernetes/test/utils/image"
samplev1alpha1
"k8s.io/sample-apiserver/pkg/apis/wardle/v1alpha1"
"k8s.io/utils/pointer"
.
"github.com/onsi/ginkgo"
)
var
serverAggregatorVersion
=
utilversion
.
MustParseSemantic
(
"v1.10.0"
)
const
(
aggregatorServicePort
=
7443
)
var
_
=
SIGDescribe
(
"Aggregator"
,
func
()
{
var
ns
string
var
c
clientset
.
Interface
...
...
@@ -266,7 +271,7 @@ func TestSampleAPIServer(f *framework.Framework, image string) {
Ports
:
[]
v1
.
ServicePort
{
{
Protocol
:
"TCP"
,
Port
:
443
,
Port
:
aggregatorServicePort
,
TargetPort
:
intstr
.
FromInt
(
443
),
},
},
...
...
@@ -317,6 +322,7 @@ func TestSampleAPIServer(f *framework.Framework, image string) {
Service
:
&
apiregistrationv1beta1
.
ServiceReference
{
Namespace
:
namespace
,
Name
:
"sample-api"
,
Port
:
pointer
.
Int32Ptr
(
aggregatorServicePort
),
},
Group
:
"wardle.k8s.io"
,
Version
:
"v1alpha1"
,
...
...
test/e2e/apimachinery/crd_conversion_webhook.go
View file @
1afc25d5
...
...
@@ -34,6 +34,7 @@ import (
"k8s.io/kubernetes/test/e2e/framework"
"k8s.io/kubernetes/test/utils/crd"
imageutils
"k8s.io/kubernetes/test/utils/image"
"k8s.io/utils/pointer"
.
"github.com/onsi/ginkgo"
.
"github.com/onsi/gomega"
...
...
@@ -44,6 +45,7 @@ const (
secretCRDName
=
"sample-custom-resource-conversion-webhook-secret"
deploymentCRDName
=
"sample-crd-conversion-webhook-deployment"
serviceCRDName
=
"e2e-test-crd-conversion-webhook"
serviceCRDPort
=
9443
roleBindingCRDName
=
"crd-conversion-webhook-auth-reader"
)
...
...
@@ -107,7 +109,8 @@ var _ = SIGDescribe("CustomResourceConversionWebhook [Feature:CustomResourceWebh
Service
:
&
v1beta1
.
ServiceReference
{
Namespace
:
f
.
Namespace
.
Name
,
Name
:
serviceCRDName
,
Path
:
strPtr
(
"/crdconvert"
),
Path
:
pointer
.
StringPtr
(
"/crdconvert"
),
Port
:
pointer
.
Int32Ptr
(
serviceCRDPort
),
}})
if
err
!=
nil
{
return
...
...
@@ -123,7 +126,8 @@ var _ = SIGDescribe("CustomResourceConversionWebhook [Feature:CustomResourceWebh
Service
:
&
v1beta1
.
ServiceReference
{
Namespace
:
f
.
Namespace
.
Name
,
Name
:
serviceCRDName
,
Path
:
strPtr
(
"/crdconvert"
),
Path
:
pointer
.
StringPtr
(
"/crdconvert"
),
Port
:
pointer
.
Int32Ptr
(
serviceCRDPort
),
}})
if
err
!=
nil
{
return
...
...
@@ -268,7 +272,7 @@ func deployCustomResourceWebhookAndService(f *framework.Framework, image string,
Ports
:
[]
v1
.
ServicePort
{
{
Protocol
:
"TCP"
,
Port
:
443
,
Port
:
serviceCRDPort
,
TargetPort
:
intstr
.
FromInt
(
443
),
},
},
...
...
test/e2e/apimachinery/webhook.go
View file @
1afc25d5
...
...
@@ -40,6 +40,7 @@ import (
"k8s.io/kubernetes/test/e2e/framework"
"k8s.io/kubernetes/test/utils/crd"
imageutils
"k8s.io/kubernetes/test/utils/image"
"k8s.io/utils/pointer"
.
"github.com/onsi/ginkgo"
.
"github.com/onsi/gomega"
...
...
@@ -50,6 +51,7 @@ const (
secretName
=
"sample-webhook-secret"
deploymentName
=
"sample-webhook-deployment"
serviceName
=
"e2e-test-webhook"
servicePort
=
8443
roleBindingName
=
"webhook-auth-reader"
// The webhook configuration names should not be reused between test instances.
...
...
@@ -208,17 +210,17 @@ var _ = SIGDescribe("AdmissionWebhook", func() {
policyIgnore
:=
v1beta1
.
Ignore
By
(
"Setting timeout (1s) shorter than webhook latency (5s)"
)
slowWebhookCleanup
:=
registerSlowWebhook
(
f
,
context
,
&
policyFail
,
i
nt32Ptr
(
1
))
slowWebhookCleanup
:=
registerSlowWebhook
(
f
,
context
,
&
policyFail
,
pointer
.
I
nt32Ptr
(
1
))
testSlowWebhookTimeoutFailEarly
(
f
)
slowWebhookCleanup
()
By
(
"Having no error when timeout is shorter than webhook latency and failure policy is ignore"
)
slowWebhookCleanup
=
registerSlowWebhook
(
f
,
context
,
&
policyIgnore
,
i
nt32Ptr
(
1
))
slowWebhookCleanup
=
registerSlowWebhook
(
f
,
context
,
&
policyIgnore
,
pointer
.
I
nt32Ptr
(
1
))
testSlowWebhookTimeoutNoError
(
f
)
slowWebhookCleanup
()
By
(
"Having no error when timeout is longer than webhook latency"
)
slowWebhookCleanup
=
registerSlowWebhook
(
f
,
context
,
&
policyFail
,
i
nt32Ptr
(
10
))
slowWebhookCleanup
=
registerSlowWebhook
(
f
,
context
,
&
policyFail
,
pointer
.
I
nt32Ptr
(
10
))
testSlowWebhookTimeoutNoError
(
f
)
slowWebhookCleanup
()
...
...
@@ -368,7 +370,7 @@ func deployWebhookAndService(f *framework.Framework, image string, context *cert
Ports
:
[]
v1
.
ServicePort
{
{
Protocol
:
"TCP"
,
Port
:
443
,
Port
:
servicePort
,
TargetPort
:
intstr
.
FromInt
(
443
),
},
},
...
...
@@ -384,8 +386,6 @@ func deployWebhookAndService(f *framework.Framework, image string, context *cert
func
strPtr
(
s
string
)
*
string
{
return
&
s
}
func
int32Ptr
(
i
int32
)
*
int32
{
return
&
i
}
func
registerWebhook
(
f
*
framework
.
Framework
,
context
*
certContext
)
func
()
{
client
:=
f
.
ClientSet
By
(
"Registering the webhook via the AdmissionRegistration API"
)
...
...
@@ -417,6 +417,7 @@ func registerWebhook(f *framework.Framework, context *certContext) func() {
Namespace
:
namespace
,
Name
:
serviceName
,
Path
:
strPtr
(
"/pods"
),
Port
:
pointer
.
Int32Ptr
(
servicePort
),
},
CABundle
:
context
.
signingCert
,
},
...
...
@@ -446,6 +447,7 @@ func registerWebhook(f *framework.Framework, context *certContext) func() {
Namespace
:
namespace
,
Name
:
serviceName
,
Path
:
strPtr
(
"/configmaps"
),
Port
:
pointer
.
Int32Ptr
(
servicePort
),
},
CABundle
:
context
.
signingCert
,
},
...
...
@@ -496,6 +498,7 @@ func registerWebhookForAttachingPod(f *framework.Framework, context *certContext
Namespace
:
namespace
,
Name
:
serviceName
,
Path
:
strPtr
(
"/pods/attach"
),
Port
:
pointer
.
Int32Ptr
(
servicePort
),
},
CABundle
:
context
.
signingCert
,
},
...
...
@@ -539,6 +542,7 @@ func registerMutatingWebhookForConfigMap(f *framework.Framework, context *certCo
Namespace
:
namespace
,
Name
:
serviceName
,
Path
:
strPtr
(
"/mutating-configmaps"
),
Port
:
pointer
.
Int32Ptr
(
servicePort
),
},
CABundle
:
context
.
signingCert
,
},
...
...
@@ -558,6 +562,7 @@ func registerMutatingWebhookForConfigMap(f *framework.Framework, context *certCo
Namespace
:
namespace
,
Name
:
serviceName
,
Path
:
strPtr
(
"/mutating-configmaps"
),
Port
:
pointer
.
Int32Ptr
(
servicePort
),
},
CABundle
:
context
.
signingCert
,
},
...
...
@@ -614,6 +619,7 @@ func registerMutatingWebhookForPod(f *framework.Framework, context *certContext)
Namespace
:
namespace
,
Name
:
serviceName
,
Path
:
strPtr
(
"/mutating-pods"
),
Port
:
pointer
.
Int32Ptr
(
servicePort
),
},
CABundle
:
context
.
signingCert
,
},
...
...
@@ -786,6 +792,7 @@ func failingWebhook(namespace, name string) v1beta1.Webhook {
Namespace
:
namespace
,
Name
:
serviceName
,
Path
:
strPtr
(
"/configmaps"
),
Port
:
pointer
.
Int32Ptr
(
servicePort
),
},
// Without CA bundle, the call to webhook always fails
CABundle
:
nil
,
...
...
@@ -892,6 +899,7 @@ func registerValidatingWebhookForWebhookConfigurations(f *framework.Framework, c
Namespace
:
namespace
,
Name
:
serviceName
,
Path
:
strPtr
(
"/always-deny"
),
Port
:
pointer
.
Int32Ptr
(
servicePort
),
},
CABundle
:
context
.
signingCert
,
},
...
...
@@ -944,6 +952,7 @@ func registerMutatingWebhookForWebhookConfigurations(f *framework.Framework, con
Namespace
:
namespace
,
Name
:
serviceName
,
Path
:
strPtr
(
"/add-label"
),
Port
:
pointer
.
Int32Ptr
(
servicePort
),
},
CABundle
:
context
.
signingCert
,
},
...
...
@@ -997,6 +1006,7 @@ func testWebhooksForWebhookConfigurations(f *framework.Framework) {
// but because the failure policy is ignore, it will
// have no effect on admission requests.
Path
:
strPtr
(
""
),
Port
:
pointer
.
Int32Ptr
(
servicePort
),
},
CABundle
:
nil
,
},
...
...
@@ -1044,6 +1054,7 @@ func testWebhooksForWebhookConfigurations(f *framework.Framework) {
// but because the failure policy is ignore, it will
// have no effect on admission requests.
Path
:
strPtr
(
""
),
Port
:
pointer
.
Int32Ptr
(
servicePort
),
},
CABundle
:
nil
,
},
...
...
@@ -1213,6 +1224,7 @@ func registerWebhookForCustomResource(f *framework.Framework, context *certConte
Namespace
:
namespace
,
Name
:
serviceName
,
Path
:
strPtr
(
"/custom-resource"
),
Port
:
pointer
.
Int32Ptr
(
servicePort
),
},
CABundle
:
context
.
signingCert
,
},
...
...
@@ -1254,6 +1266,7 @@ func registerMutatingWebhookForCustomResource(f *framework.Framework, context *c
Namespace
:
namespace
,
Name
:
serviceName
,
Path
:
strPtr
(
"/mutating-custom-resource"
),
Port
:
pointer
.
Int32Ptr
(
servicePort
),
},
CABundle
:
context
.
signingCert
,
},
...
...
@@ -1273,6 +1286,7 @@ func registerMutatingWebhookForCustomResource(f *framework.Framework, context *c
Namespace
:
namespace
,
Name
:
serviceName
,
Path
:
strPtr
(
"/mutating-custom-resource"
),
Port
:
pointer
.
Int32Ptr
(
servicePort
),
},
CABundle
:
context
.
signingCert
,
},
...
...
@@ -1401,6 +1415,7 @@ func registerValidatingWebhookForCRD(f *framework.Framework, context *certContex
Namespace
:
namespace
,
Name
:
serviceName
,
Path
:
strPtr
(
"/crd"
),
Port
:
pointer
.
Int32Ptr
(
servicePort
),
},
CABundle
:
context
.
signingCert
,
},
...
...
@@ -1512,6 +1527,7 @@ func registerSlowWebhook(f *framework.Framework, context *certContext, policy *v
Namespace
:
namespace
,
Name
:
serviceName
,
Path
:
strPtr
(
"/always-allow-delay-5s"
),
Port
:
pointer
.
Int32Ptr
(
servicePort
),
},
CABundle
:
context
.
signingCert
,
},
...
...
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