Skip to content

Conversation

@ghost
Copy link

@ghost ghost commented Aug 11, 2025

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 exportedPorts

What does this PR do / Why do we need it:
This PR fixes a bug in the ServiceExport target group creation logic where the K8SProtocolVersion field 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 K8SProtocolVersion remains 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:

  1. Create a ServiceExport with exportedPorts specifying RouteType: "HTTP"
  2. Create an HTTPRoute that references a ServiceImport backed by the ServiceExport
  3. Observe multiple target groups being created continuously in AWS VPC Lattice console
  4. Check controller logs for repeated target group creation events

The issue occurs because the target group spec hash changes between reconciliations due to inconsistent K8SProtocolVersion values, causing the controller to think it needs to create new target groups.

Testing done on this change:

  • Added integration test httproute_serviceexport_test.go that mirrors the existing gRPC equivalent
  • Verified that only one target group is created for HTTP routes with ServiceExport using exportedPorts
  • Confirmed that target group lookup by tags works correctly with consistent protocol version
  • Tested that the fix doesn't affect existing functionality for legacy ServiceExport behavior

Automation added to e2e:
Yes - Added test/suites/integration/httproute_serviceexport_test.go which 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.

Fixed issue where HTTPRoute with ServiceExport using exportedPorts would create multiple target groups continuously

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.

@ghost ghost self-assigned this Aug 11, 2025
@ghost ghost added the bug Something isn't working label Aug 11, 2025
@ghost ghost requested a review from mikestvz August 11, 2025 20:59
@ghost ghost enabled auto-merge August 11, 2025 21:00
Copy link
Contributor

@mikestvz mikestvz left a comment

Choose a reason for hiding this comment

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

LGTM

@ghost ghost added this pull request to the merge queue Aug 12, 2025
Merged via the queue into aws:main with commit f9979cd Aug 12, 2025
2 checks passed
This was referenced Aug 14, 2025
@ghost ghost deleted the fix-grpc-target-group-loop branch August 19, 2025 22:36
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant