Correct additional target group creation when using the exportedPorts with HTTPRoute #790
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.
What type of PR is this?
Bug
Which issue does this PR fix:
Fixes issue where multiple target groups are continually created for HTTPRoute with ServiceExport using
exportedPortsWhat does this PR do / Why do we need it:
This PR fixes a bug in the ServiceExport target group creation logic where the
K8SProtocolVersionfield was being inconsistently overwritten with the route type string (e.g., "HTTP") instead of maintaining the actual protocol version (e.g., "HTTP1"). This inconsistency caused target group lookups by tags to fail during reconciliation, leading to duplicate target groups being created instead of reusing existing ones.The fix ensures that
K8SProtocolVersionremains consistent with the actual VPC Lattice protocol version, which is used for target group identification and lookup via AWS resource tags.If an issue # is not available please add repro steps and logs from aws-gateway-controller showing the issue:
Repro steps:
The issue occurs because the target group spec hash changes between reconciliations due to inconsistent
K8SProtocolVersionvalues, causing the controller to think it needs to create new target groups.Testing done on this change:
httproute_serviceexport_test.gothat mirrors the existing gRPC equivalentAutomation added to e2e:
Yes - Added
test/suites/integration/httproute_serviceexport_test.gowhich tests HTTPRoute with ServiceExport using exportedPorts, mirroring the existing gRPC test pattern.Will this PR introduce any new dependencies?:
No
Will this break upgrades or downgrades. Has updating a running cluster been tested?:
No breaking changes. This fix only affects the internal target group spec generation and doesn't change any external APIs or behavior. Existing target groups will continue to work, and the fix prevents creation of duplicate target groups going forward.
Does this PR introduce any user-facing change?:
No user-facing changes. This is an internal bug fix that resolves duplicate target group creation.
Do all end-to-end tests successfully pass when running make e2e-test?:
Yes, all tests pass including the new HTTPRoute ServiceExport integration test.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.