-
Notifications
You must be signed in to change notification settings - Fork 143
Test TLS termination, SSL-redirect, Canary, and CORS #330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
65fb552
Add k8s clients
johananl 7098cb9
Add logger interface
johananl ae94714
Add CRD helpers
johananl 7e76c00
Add Helm helpers
johananl 0385bd2
Add namespace helpers
johananl f4cfe5f
Add dummy app helpers
johananl b5b6838
Add helper for installing Istio
johananl a7ad561
Add helpers for Kong
johananl 6740ba4
Add GWAPI helpers
johananl 2d48d39
Add port forwarding helpers
johananl 126c0a6
Add ingress-nginx helpers
johananl 665eaa9
Add helper for creating ingresses
johananl 395fded
Add resource manager
johananl 9f95c22
Add verifier interface and httpGetVerifier implementation
johananl 4f693fa
Add main test logic
johananl f63093e
Add some initial test cases
johananl 88ed612
Add Make targets for e2e
johananl d5c28ed
Add README for e2e tests
johananl 7aa6b5f
Install kind to ./bin
johananl ad1c425
Use builder pattern for ingresses in test cases
johananl 04b9b26
Centralize retry logic
johananl 3221ffb
Use ingress2gateway binary
johananl c3e0aa8
Canary tests
Stevenjin8 6df4abc
Merge remote-tracking branch 'up/main' into test/canary
Stevenjin8 72043b7
Path rewrite
Stevenjin8 ae822a8
Verify TLS Ingresses and TLS redirects
Stevenjin8 5b2790c
Merge remote-tracking branch 'up/main' into test/canary
Stevenjin8 04180bf
Merge branch 'test/canary' into tests/e2e-tls
Stevenjin8 8a6932c
touchup
Stevenjin8 1d9549c
touchup
Stevenjin8 28f32fa
lint
Stevenjin8 90526b1
lint
Stevenjin8 9cf777d
use regex body verifier
Stevenjin8 c01ca8a
Merge branch 'test/canary' into tests/e2e-tls
Stevenjin8 4bc978e
random canary host
Stevenjin8 cd108f1
Merge remote-tracking branch 'up/main' into tests/e2e-tls
Stevenjin8 1727e84
CORS tests
Stevenjin8 3c23866
move to module
Stevenjin8 24e310f
Merge branch 'main' into tests/e2e-tls
Stevenjin8 aec685e
Use monthly CRD and move packages
Stevenjin8 0ff86f7
Review
Stevenjin8 c2a2d25
lints
Stevenjin8 47ddeee
review
Stevenjin8 7a82725
lint
Stevenjin8 6bb967b
remove unecessary host
Stevenjin8 4f1c9cf
comments
Stevenjin8 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| /* | ||
| Copyright 2026 The Kubernetes Authors. | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| package e2e | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "regexp" | ||
| "testing" | ||
|
|
||
| "github.com/kubernetes-sigs/ingress2gateway/pkg/i2gw/providers/ingressnginx" | ||
| "github.com/kubernetes-sigs/ingress2gateway/pkg/i2gw/providers/istio" | ||
| "github.com/stretchr/testify/require" | ||
| networkingv1 "k8s.io/api/networking/v1" | ||
| ) | ||
|
|
||
| func TestIngressNGINXCanary(t *testing.T) { | ||
| t.Parallel() | ||
| t.Run("to Istio", func(t *testing.T) { | ||
| t.Parallel() | ||
| t.Run("base canary", func(t *testing.T) { | ||
| suffix, err := randString() | ||
| require.NoError(t, err) | ||
| host := fmt.Sprintf("canary-%s.com", suffix) | ||
|
Stevenjin8 marked this conversation as resolved.
|
||
| runTestCase(t, &testCase{ | ||
| gatewayImplementation: istio.ProviderName, | ||
| providers: []string{ingressnginx.Name}, | ||
| providerFlags: map[string]map[string]string{ | ||
| ingressnginx.Name: { | ||
| ingressnginx.NginxIngressClassFlag: ingressnginx.NginxIngressClass, | ||
| }, | ||
| }, | ||
| ingresses: []*networkingv1.Ingress{ | ||
| basicIngress(). | ||
| withName("foo1"). | ||
| withHost(host). | ||
| withIngressClass(ingressnginx.NginxIngressClass). | ||
| build(), | ||
| basicIngress(). | ||
| withName("foo2"). | ||
| withHost(host). | ||
| withIngressClass(ingressnginx.NginxIngressClass). | ||
| withAnnotation("nginx.ingress.kubernetes.io/canary", "true"). | ||
| withAnnotation("nginx.ingress.kubernetes.io/canary-weight", "20"). | ||
| withBackend(DummyAppName2). | ||
| build(), | ||
| }, | ||
| verifiers: map[string][]verifier{ | ||
| "foo1": { | ||
| &canaryVerifier{ | ||
| verifier: &httpRequestVerifier{ | ||
| host: host, | ||
| path: "/hostname", | ||
| bodyRegex: regexp.MustCompile("^dummy-app2"), | ||
| }, | ||
| runs: 200, | ||
| minSuccesses: 0.1, | ||
| maxSuccesses: 0.3, | ||
| }, | ||
| }, | ||
| }, | ||
| }) | ||
| }) | ||
| }) | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot to clean up?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not really. I think we want to target gwapi 1.5, which isn't released yet (rc coming this week) because we really want support for status code 308 in ReqestRedirects. Since 308 isn't available in 1.4, but is in 1.5, I figured I'd use a monthly release and just update it to 1.5/1.5-rc whenever that comes out.