-
Notifications
You must be signed in to change notification settings - Fork 1.6k
fix(gateway): skip target group creation for HTTPRoute redirect-only rules #4498
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
base: main
Are you sure you want to change the base?
fix(gateway): skip target group creation for HTTPRoute redirect-only rules #4498
Conversation
|
Hi @starlightromero. Thanks for your PR. I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: starlightromero The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
…rules HTTPRoute rules with only RequestRedirect filters and no BackendRefs were incorrectly creating target groups, consuming AWS resources unnecessarily and causing deployment failures. This change implements redirect-only rule detection to skip target group creation for rules that don't route to backends, while maintaining redirect action creation for proper ALB configuration. Key changes: - Add IsRedirectOnlyRule() function to detect redirect-only rules - Modify buildListenerRules() to skip target group creation for redirect-only rules - Add comprehensive resource management and cleanup logic - Include extensive property-based testing with 8 correctness properties The fix ensures redirect-only rules don't consume AWS target group quotas while maintaining full functionality for redirect actions and preserving backward compatibility with Gateway API v1 specifications. Fixes kubernetes-sigs#4497
3a79dea to
8bf06c3
Compare
✅ Commit Message Format FixedI've updated the commit message to follow the conventional commit format with proper scope: Before: After: The commit message now follows the Updated Commit Details:
The commit message now complies with the project's commit message conventions. 🎯 |
|
Keywords which can automatically close issues and at(@) or hashtag(#) mentions are not allowed in commit messages. The list of commits with invalid commit messages:
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. I understand the commands that are listed here. |
Description
This PR fixes issue #4497 by implementing the preferred solution: HTTPRoute redirect-only rules (with no
backendRefs, onlyrequestRedirectfilter) no longer create target groups since they don't route to backends.Problem
When using Gateway API with HTTPRoutes that include HTTP redirect-only routes, the AWS Load Balancer Controller incorrectly creates target groups even when rules have no backend references. This causes several issues:
appProtocol: kubernetes.io/h2cbecause ALB doesn't support HTTP/2 on HTTP listenersInvalidLoadBalancerActionerrorsSolution
Core Changes
Redirect-Only Rule Detection (
pkg/gateway/routeutils/redirect_utils.go)IsRedirectOnlyRule()function to identify rules with only RequestRedirect filters and no BackendRefsHasRequestRedirectFilter()helper function for redirect detectionTarget Group Creation Optimization (
pkg/gateway/model/model_build_listener.go)buildListenerRules()to skip target group creation for redirect-only rulesResource Management (
pkg/gateway/routeutils/resource_accounting.go)Cleanup Safety (
pkg/gateway/routeutils/cleanup.go)Validation Framework (
pkg/gateway/routeutils/validation.go)Key Benefits
Testing
Comprehensive Test Coverage
Property-Based Tests - 8 correctness properties implemented:
Unit Tests - Comprehensive coverage including:
Integration Tests - End-to-end validation:
Test Results
Performance Impact
Example Usage
Before (Fails)
After (Works)
Files Changed
New Files
pkg/gateway/routeutils/redirect_utils.go- Core redirect detection logicpkg/gateway/routeutils/cleanup.go- Cleanup managementpkg/gateway/routeutils/resource_accounting.go- Resource trackingpkg/gateway/routeutils/validation.go- Validation frameworkModified Files
pkg/gateway/model/model_build_listener.go- Integrated redirect-only logicBreaking Changes
None. This change is fully backward compatible and only optimizes resource usage for redirect-only rules.
Related Issues
Fixes #4497
Checklist