Skip to content

Test TLS termination, SSL-redirect, Canary, and CORS#330

Merged
k8s-ci-robot merged 46 commits intokubernetes-sigs:mainfrom
Stevenjin8:tests/e2e-tls
Feb 13, 2026
Merged

Test TLS termination, SSL-redirect, Canary, and CORS#330
k8s-ci-robot merged 46 commits intokubernetes-sigs:mainfrom
Stevenjin8:tests/e2e-tls

Conversation

@Stevenjin8
Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind test

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #

Does this PR introduce a user-facing change?:

NONE

johananl and others added 29 commits January 21, 2026 18:50
Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>
Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>
Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>
Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>
Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>
We need a dummy workload so that ingresses and gateways have some
service to send test traffic to.

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>
Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>
Kong is both an ingress controller and a GWAPI implementation. Add
helpers for both.

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>
Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>
We use port forwarding to reach ingress controllers and gateways in an
infrastructure-agnostic way during testing.

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>
Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>
Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>
To be able to run multiple test cases concurrently on the same cluster,
some resources must be shared. For example, CRDs are cluster-level
rather than namespace-scoped. In addition, deploying multiple instances
of an ingress controller or GWAPI implementation wastes time and
resources even in cases where it's technically possible to do so.

To address these concerns, we add a resource manager. This construct
allows efficient and thread-safe sharing of resources. A shared resource
is created on first usage, returned on subsequent attempts to acquire
the resources and cleaned up when no users remain.

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>
Verifiers are used to ensure ingress and GWAPI resources process traffic
according to expectations.

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>
Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>
Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>
Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>
Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>
We can't use sudo on CI.

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>
This allows for more compact test case definitions and fewer indentation
levels.

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>
Rather than implementing bespoke retry logic across the code base,
implement generic retry helpers and reuse them.

This also extracts the retry logic out of verifiers for a better
separation of concerns.

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>
Call the binary instead of running Go code directly. This simulates
actual customer usage better and works around concurrency issues caused
by multiple test cases executing in parallel.

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

@Stevenjin8: The label(s) kind/test cannot be applied, because the repository doesn't have them.

Details

In response to this:

What type of PR is this?

/kind test

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #

Does this PR introduce a user-facing change?:

NONE

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Copy link
Copy Markdown
Member

@johananl johananl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for expanding the e2e framework! I like many of the changes.

Added some comments. Some trivial, some critical.

Comment thread e2e/crd.go
const (
gatewayAPIVersion = "v1.4.1"
gatewayAPIInstallURL = "https://github.com/kubernetes-sigs/gateway-api/releases/download/" + gatewayAPIVersion + "/standard-install.yaml"
// gatewayAPIVersion = "v1.4.1"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot to clean up?

Copy link
Copy Markdown
Contributor Author

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.

Comment thread e2e/ingress_nginx_canary_test.go Outdated
networkingv1 "k8s.io/api/networking/v1"
)

func TestCanary(t *testing.T) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we might want to include "nginx" in the function name. Right now we see the following when the tests are run:

TestCanary/to_Istio/base_canary

This doesn't tell us which provider gets tested.

My initial thought with the naming was to organize the hierarchy by "from", "to" and "test case". This way you get e.g. TestIngressNginx/to_Istio/with_host_field. It's clear what exactly is being tested.

We should also think about filtering tests when choosing the naming, e.g. maybe I want to do "run all tests to Istio" or "run basic conversions for all providers".

I'm happy to change the naming scheme but IMO we want to be deliberate about it.

WDYT?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1. I can either throw IngressNGINX into the test name, or I can make each of these functions called in scenarios_test.go. Up to you

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or I can make each of these functions called in scenarios_test.go

I don't understand this ☝️

I don't have a strong opinion on the naming, just wanted to make sure you're aware of my attempt to group things in a logical way.

Comment thread e2e/ingress_nginx_canary_test.go Outdated
Comment thread e2e/ingress_nginx_canary_test.go
Comment thread e2e/verifiers.go Outdated
Comment thread e2e/testutil.go

// A prefix for all namespaces used in the e2e tests.
const e2ePrefix = "i2gw"
const DummyAppName1 = "dummy-app1"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we assuming many test cases would need two dummy apps? I'm wondering if we need to define these consts and do so here rather than defining plain text directly in the test cases.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Most of what I'm doing is based on what istio does). I think its common enough to do it, but definitely worth thinking about if we are going to test timeouts or something

Comment thread e2e/testutil.go Outdated
Comment thread e2e/verifiers.go
networkingv1 "k8s.io/api/networking/v1"
)

// Validates that a service is accessible and working correctly. The addr parameter is a
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO we want some documentation here, especially if we have many types of verifiers (which we do).

Comment thread e2e/verifiers.go Outdated
Comment thread e2e/verifiers.go
return fmt.Errorf("constructing HTTP request: %w", err)
}

// If the Host field is specified in the test case, use that. Otherwise, default to deriving
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove this comment?

Copy link
Copy Markdown
Member

@johananl johananl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for following up. Looks better.

There is a new critical bug in gwapi.go and gwapi_kong.go. Also added some more non-critical comments.

Comment thread e2e/gwapi.go Outdated
Comment thread e2e/gwapi_kong.go Outdated
Comment thread e2e/ingress_nginx_canary_test.go Outdated
Comment thread e2e/ingress_nginx_cors_test.go Outdated
Comment thread e2e/ingress_nginx_cors_test.go Outdated
Comment thread e2e/scenarios_test.go
})
suffix, err := randString(6)
require.NoError(t, err)
host := "foo.example.com" + suffix
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if we should do it in this PR but IMO we want to remove scenarios_test.go and relocate any relevant tests to more specific _test.go files. This file contains some initial smoke tests I've included with the e2e framework. Since we moved to a multi-file setup this file is IMO obsolete.

Comment thread e2e/ingress_nginx_tls_test.go Outdated
Comment thread e2e/verifiers.go Outdated
Comment on lines +102 to +105
if m.negate {
return !match
}
return match
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: This is logical XOR. We can simplify. But maybe clear is better than clever.

Suggested change
if m.negate {
return !match
}
return match
return m.pattern.MatchString(s) != m.negate

Comment thread e2e/util.go Outdated
Copy link
Copy Markdown
Member

@johananl johananl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last tiny comment.

Comment thread e2e/gwapi.go Outdated
Comment thread e2e/scenarios_test.go
})
suffix, err := randString(6)
require.NoError(t, err)
host := "foo.example.com" + suffix
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. I don't understand why multiple implementations but let's discuss in the other PR.

@johananl
Copy link
Copy Markdown
Member

Thanks!
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 13, 2026
@k8s-ci-robot k8s-ci-robot merged commit b5c9d05 into kubernetes-sigs:main Feb 13, 2026
5 checks passed
chakravardhan pushed a commit to chakravardhan/ingress2gateway that referenced this pull request Feb 19, 2026
…#330)

* Add k8s clients

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Add logger interface

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Add CRD helpers

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Add Helm helpers

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Add namespace helpers

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Add dummy app helpers

We need a dummy workload so that ingresses and gateways have some
service to send test traffic to.

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Add helper for installing Istio

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Add helpers for Kong

Kong is both an ingress controller and a GWAPI implementation. Add
helpers for both.

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Add GWAPI helpers

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Add port forwarding helpers

We use port forwarding to reach ingress controllers and gateways in an
infrastructure-agnostic way during testing.

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Add ingress-nginx helpers

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Add helper for creating ingresses

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Add resource manager

To be able to run multiple test cases concurrently on the same cluster,
some resources must be shared. For example, CRDs are cluster-level
rather than namespace-scoped. In addition, deploying multiple instances
of an ingress controller or GWAPI implementation wastes time and
resources even in cases where it's technically possible to do so.

To address these concerns, we add a resource manager. This construct
allows efficient and thread-safe sharing of resources. A shared resource
is created on first usage, returned on subsequent attempts to acquire
the resources and cleaned up when no users remain.

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Add verifier interface and httpGetVerifier implementation

Verifiers are used to ensure ingress and GWAPI resources process traffic
according to expectations.

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Add main test logic

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Add some initial test cases

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Add Make targets for e2e

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Add README for e2e tests

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Install kind to ./bin

We can't use sudo on CI.

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Use builder pattern for ingresses in test cases

This allows for more compact test case definitions and fewer indentation
levels.

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Centralize retry logic

Rather than implementing bespoke retry logic across the code base,
implement generic retry helpers and reuse them.

This also extracts the retry logic out of verifiers for a better
separation of concerns.

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Use ingress2gateway binary

Call the binary instead of running Go code directly. This simulates
actual customer usage better and works around concurrency issues caused
by multiple test cases executing in parallel.

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Canary tests

* Path rewrite

* Verify TLS Ingresses and TLS redirects

* touchup

* touchup

* lint

* lint

* use regex body verifier

* random canary host

* CORS tests

* move to module

* Use monthly CRD and move packages

* Review

* lints

* review

* lint

* remove unecessary host

* comments

---------

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>
Co-authored-by: Johanan Liebermann <jliebermann@microsoft.com>
rajashish pushed a commit to rajashish/ingress2gateway1 that referenced this pull request Feb 21, 2026
…#330)

* Add k8s clients

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Add logger interface

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Add CRD helpers

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Add Helm helpers

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Add namespace helpers

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Add dummy app helpers

We need a dummy workload so that ingresses and gateways have some
service to send test traffic to.

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Add helper for installing Istio

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Add helpers for Kong

Kong is both an ingress controller and a GWAPI implementation. Add
helpers for both.

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Add GWAPI helpers

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Add port forwarding helpers

We use port forwarding to reach ingress controllers and gateways in an
infrastructure-agnostic way during testing.

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Add ingress-nginx helpers

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Add helper for creating ingresses

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Add resource manager

To be able to run multiple test cases concurrently on the same cluster,
some resources must be shared. For example, CRDs are cluster-level
rather than namespace-scoped. In addition, deploying multiple instances
of an ingress controller or GWAPI implementation wastes time and
resources even in cases where it's technically possible to do so.

To address these concerns, we add a resource manager. This construct
allows efficient and thread-safe sharing of resources. A shared resource
is created on first usage, returned on subsequent attempts to acquire
the resources and cleaned up when no users remain.

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Add verifier interface and httpGetVerifier implementation

Verifiers are used to ensure ingress and GWAPI resources process traffic
according to expectations.

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Add main test logic

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Add some initial test cases

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Add Make targets for e2e

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Add README for e2e tests

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Install kind to ./bin

We can't use sudo on CI.

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Use builder pattern for ingresses in test cases

This allows for more compact test case definitions and fewer indentation
levels.

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Centralize retry logic

Rather than implementing bespoke retry logic across the code base,
implement generic retry helpers and reuse them.

This also extracts the retry logic out of verifiers for a better
separation of concerns.

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Use ingress2gateway binary

Call the binary instead of running Go code directly. This simulates
actual customer usage better and works around concurrency issues caused
by multiple test cases executing in parallel.

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>

* Canary tests

* Path rewrite

* Verify TLS Ingresses and TLS redirects

* touchup

* touchup

* lint

* lint

* use regex body verifier

* random canary host

* CORS tests

* move to module

* Use monthly CRD and move packages

* Review

* lints

* review

* lint

* remove unecessary host

* comments

---------

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>
Co-authored-by: Johanan Liebermann <jliebermann@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants