feat: add internal redirect config in TrafficPolicy#14261
Merged
davidjumani merged 5 commits intoJun 30, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds support for internalRedirect TrafficPolicy and validates it across translation/unit tests and end-to-end coverage.
Changes:
- Introduces
InternalRedirectAPI type + CRD schema and wires it into TrafficPolicy construction/merge/apply logic. - Adds translator golden tests (route-attached + gateway-attached with per-route override).
- Adds an e2e feature suite and includes it in the e2e workflow run set.
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| test/e2e/tests/kgateway_tests.go | Registers the new InternalRedirect e2e suite in the main e2e runner. |
| test/e2e/features/internalredirect/types.go | Defines the e2e suite setup manifest test case. |
| test/e2e/features/internalredirect/testdata/setup.yaml | Provides e2e manifests (httpbin + routes + TrafficPolicy) to exercise internal redirects. |
| test/e2e/features/internalredirect/suite.go | Adds e2e tests for internal redirect follow vs pass-through behavior. |
| pkg/kgateway/translator/gateway/testutils/outputs/traffic-policy/internal-redirect-route.yaml | Adds expected translated output for route-attached internal redirect policy. |
| pkg/kgateway/translator/gateway/testutils/outputs/traffic-policy/internal-redirect-gateway.yaml | Adds expected translated output for gateway-attached internal redirect policy with override. |
| pkg/kgateway/translator/gateway/testutils/inputs/traffic-policy/internal-redirect-route.yaml | Adds translator test input resources for route-attached internal redirect policy. |
| pkg/kgateway/translator/gateway/testutils/inputs/traffic-policy/internal-redirect-gateway.yaml | Adds translator test input resources for gateway-attached policy + route override. |
| pkg/kgateway/translator/gateway/gateway_translator_test.go | Adds translator test cases to validate internal redirect translation. |
| pkg/kgateway/extensions2/plugins/trafficpolicy/traffic_policy_plugin.go | Adds internalRedirect to IR, equality, validation, and per-route application. |
| pkg/kgateway/extensions2/plugins/trafficpolicy/merge.go | Adds merge behavior for internalRedirect in TrafficPolicy merges. |
| pkg/kgateway/extensions2/plugins/trafficpolicy/internal_redirect_test.go | Adds unit tests for IR construction/equality and route application behavior. |
| pkg/kgateway/extensions2/plugins/trafficpolicy/internal_redirect.go | Implements internal redirect IR, validation, and spec-to-Envoy conversion. |
| pkg/kgateway/extensions2/plugins/trafficpolicy/constructor.go | Wires internal redirect construction into the TrafficPolicy IR constructor. |
| install/helm/kgateway-crds/templates/gateway.kgateway.dev_trafficpolicies.yaml | Updates CRD schema to expose internalRedirect fields and validations. |
| api/v1alpha1/kgateway/traffic_policy_types.go | Adds InternalRedirect field to TrafficPolicySpec. |
| api/v1alpha1/kgateway/internal_redirect_types.go | Introduces the InternalRedirect API type and response code enum validation. |
| .github/workflows/e2e.yaml | Adds the InternalRedirect suite to the e2e workflow run regex. |
Files not reviewed (1)
- api/v1alpha1/kgateway/zz_generated.deepcopy.go: Generated file
Signed-off-by: Alexander Liu <[email protected]>
Signed-off-by: Alexander Liu <[email protected]>
Signed-off-by: Alexander Liu <[email protected]>
alexliu541
force-pushed
the
alexliu541/internal-redirect-policy
branch
from
June 16, 2026 22:39
640ff99 to
a30e8ed
Compare
davidjumani
approved these changes
Jun 30, 2026
Signed-off-by: Alexander Liu <[email protected]>
davidjumani
approved these changes
Jun 30, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Adds an internalRedirect field to TrafficPolicySpec that configures Envoy's RouteAction.internal_redirect_policy, allowing the gateway to follow upstream 3xx redirects internally and return only the final response to the client. Most validations are envoy requirements including uniquenesses, with the exception of
MaxItems=16forResponseHeadersToCopy, which is common limit used for kgateway list config fields.Include unit test, translator golden file test and e2e test.
Change Type
/kind feature
Changelog
Additional Notes