Skip to content

feat: add internal redirect config in TrafficPolicy#14261

Merged
davidjumani merged 5 commits into
kgateway-dev:mainfrom
alexliu541:alexliu541/internal-redirect-policy
Jun 30, 2026
Merged

feat: add internal redirect config in TrafficPolicy#14261
davidjumani merged 5 commits into
kgateway-dev:mainfrom
alexliu541:alexliu541/internal-redirect-policy

Conversation

@alexliu541

Copy link
Copy Markdown
Contributor

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=16 for ResponseHeadersToCopy, 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

Add internal redirect feature in TrafficPolicy

Additional Notes

@alexliu541
alexliu541 requested a review from a team as a code owner June 16, 2026 09:14
Copilot AI review requested due to automatic review settings June 16, 2026 09:14
@gateway-bot gateway-bot added kind/feature Categorizes issue or PR as related to a new feature. release-note labels Jun 16, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 InternalRedirect API 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

Comment thread test/e2e/features/internalredirect/suite.go
Comment thread test/e2e/features/internalredirect/testdata/setup.yaml Outdated
Comment thread test/e2e/features/internalredirect/suite.go
Signed-off-by: Alexander Liu <[email protected]>
Signed-off-by: Alexander Liu <[email protected]>
@alexliu541
alexliu541 force-pushed the alexliu541/internal-redirect-policy branch from 640ff99 to a30e8ed Compare June 16, 2026 22:39
@davidjumani davidjumani added the work in progress Indicates that a PR should not merge because it is a work in progress label Jun 30, 2026
@davidjumani davidjumani removed the work in progress Indicates that a PR should not merge because it is a work in progress label Jun 30, 2026
Signed-off-by: Alexander Liu <[email protected]>
@davidjumani
davidjumani added this pull request to the merge queue Jun 30, 2026
Merged via the queue into kgateway-dev:main with commit 327d0c3 Jun 30, 2026
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/feature Categorizes issue or PR as related to a new feature. release-note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants