Skip to content

fix(tcp): avoid duplicate EmptyCluster routes for listeners without routes#7912

Open
Aditya7880900936 wants to merge 6 commits intoenvoyproxy:mainfrom
Aditya7880900936:fix/tcp-emptycluster-duplicate
Open

fix(tcp): avoid duplicate EmptyCluster routes for listeners without routes#7912
Aditya7880900936 wants to merge 6 commits intoenvoyproxy:mainfrom
Aditya7880900936:fix/tcp-emptycluster-duplicate

Conversation

@Aditya7880900936
Copy link
Contributor

This PR fixes an issue where Envoy Gateway generated invalid Envoy configuration
when multiple TCP/TLS passthrough listeners had no attached routes.

In such cases, the translator was creating identical dummy EmptyCluster routes
per listener, which resulted in duplicate routes and Envoy rejecting the config.

What this PR does

  • Ensures the dummy EmptyCluster TCPRoute is shared instead of recreated per listener
  • Prevents duplicate EmptyCluster routes in the generated Envoy config
  • Keeps existing behavior unchanged for single-listener cases

Tests

  • Added a standalone regression test to verify Envoy Gateway starts successfully
    with multiple TCP/TLS passthrough listeners that have no attached routes

Why this is needed

This scenario is valid per Gateway API, but previously caused Envoy startup
failures due to duplicate dummy routes.

Fixes #7866

@Aditya7880900936 Aditya7880900936 requested a review from a team as a code owner January 10, 2026 12:30
@netlify
Copy link

netlify bot commented Jan 10, 2026

Deploy Preview for cerulean-figolla-1f9435 ready!

Name Link
🔨 Latest commit 807f03f
🔍 Latest deploy log https://app.netlify.com/projects/cerulean-figolla-1f9435/deploys/6994bac958dc7b0008ea7093
😎 Deploy Preview https://deploy-preview-7912--cerulean-figolla-1f9435.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov
Copy link

codecov bot commented Jan 10, 2026

Codecov Report

❌ Patch coverage is 81.25000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.59%. Comparing base (2d5eced) to head (807f03f).
⚠️ Report is 238 commits behind head on main.

Files with missing lines Patch % Lines
internal/xds/translator/translator.go 81.25% 4 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7912      +/-   ##
==========================================
+ Coverage   72.36%   73.59%   +1.22%     
==========================================
  Files         234      242       +8     
  Lines       34566    37023    +2457     
==========================================
+ Hits        25014    27247    +2233     
- Misses       7761     7855      +94     
- Partials     1791     1921     +130     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@arkodg
Copy link
Contributor

arkodg commented Jan 10, 2026

thanks @Aditya7880900936 , instead of the standalone test, can you rm that and add a test case in https://github.com/envoyproxy/gateway/tree/main/internal/xds/translator/testdata that mimics the issue

@Aditya7880900936
Copy link
Contributor Author

Thanks for the suggestion @arkodg ,
I’ve removed the standalone test and added a translator test case under internal/xds/translator/testdata that reproduces the issue with multiple TCP listeners without routes and validates that only a single EmptyCluster is generated.
All translator tests are passing now — please let me know if you’d like any adjustments.

@arkodg
Copy link
Contributor

arkodg commented Jan 14, 2026

can you revert the standalone test file and leave it as is

@Aditya7880900936
Copy link
Contributor Author

Hi @arkodg ,
Got it, thanks for clarifying!
I’ve reverted the standalone test back to its original state and left it unchanged, and the translator regression test remains in place.
Please let me know if this looks good now.

@arkodg
Copy link
Contributor

arkodg commented Jan 14, 2026

The new diff still doesn’t implement the requested changes and introduces the same issues as before.

We’ve already provided detailed guidance, so further updates need to be reviewed carefully before being pushed. Please do not submit another diff until you have verified that it actually addresses each review comment.

@Aditya7880900936 Aditya7880900936 force-pushed the fix/tcp-emptycluster-duplicate branch 3 times, most recently from aeed89b to 407f10a Compare January 15, 2026 06:37
@Aditya7880900936
Copy link
Contributor Author

Hi @arkodg,

Thanks for the feedback. I’ve cleaned up the diff and removed the unrelated dependabot change.
The PR now only includes the translator fix and a regression test under
internal/xds/translator/testdata that reproduces the issue.

I’ve re-verified the behavior locally and all translator tests are passing.
Please let me know if this now aligns with the requested changes.

@Aditya7880900936 Aditya7880900936 force-pushed the fix/tcp-emptycluster-duplicate branch 2 times, most recently from d6a9025 to 378b464 Compare January 19, 2026 15:32
@Aditya7880900936
Copy link
Contributor Author

Hi @arkodg,

I fixed the test compilation issue and re-ran the translator tests locally.
TestTranslateXds is now passing, and the change only affects the translator
logic and its regression test.

I’ve force-pushed the updated commit — please let me know if anything else
needs adjustment.

…outes

Signed-off-by: Aditya7880900936 <adityasanskarsrivastav788@gmail.com>
@Aditya7880900936 Aditya7880900936 force-pushed the fix/tcp-emptycluster-duplicate branch from 378b464 to 5b04f76 Compare January 20, 2026 08:09
…n no routes exist

Signed-off-by: Aditya7880900936 <adityasanskarsrivastav788@gmail.com>
@Aditya7880900936
Copy link
Contributor Author

Hi @arkodg @sudiptob2 , I have updated the code , have a look and feel free to have any suggestions

@Aditya7880900936
Copy link
Contributor Author

Hi @arkodg @zirain ,Please have a look on this PR feel free to suggest any changes

@sudiptob2
Copy link
Member

Please fix the lint issues first.

Signed-off-by: Aditya7880900936 <adityasanskarsrivastav788@gmail.com>
Signed-off-by: Aditya7880900936 <adityasanskarsrivastav788@gmail.com>
…ners

Signed-off-by: Aditya7880900936 <adityasanskarsrivastav788@gmail.com>
Signed-off-by: Aditya7880900936 <adityasanskarsrivastav788@gmail.com>
@Aditya7880900936
Copy link
Contributor Author

Hi @sudiptob2 , i implemented the changes you suggested earlier , gen check and lints are passed successfully , feel free to have a review on this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gateway generates invalid Envoy config with multiple EmptyCluster Routes

3 participants