Skip to content
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

Refactor and fix early return: HTTP Listener XDS translator #2981

Merged

Conversation

zhaohuabing
Copy link
Member

@zhaohuabing zhaohuabing commented Mar 20, 2024

This PR:

  • Add a few comments to processHTTPListenerXdsTranslation and extract an addRouteToRouteConfig sub-method to make the HTTPListener construction a bit easier to understand and maintain.
  • Instead of returning early, making sure all the listeners are processed, and collecting all the errors during translation, return them at the end.
  • Rename addXdsHTTPFilterChain to addHCMToXDSListener to better reflect what this method does.

@zhaohuabing zhaohuabing requested a review from a team as a code owner March 20, 2024 00:12
@zhaohuabing zhaohuabing marked this pull request as draft March 20, 2024 00:12
Copy link

codecov bot commented Mar 20, 2024

Codecov Report

Attention: Patch coverage is 87.19512% with 21 lines in your changes are missing coverage. Please review.

Project coverage is 58.94%. Comparing base (29946b0) to head (fb95a54).
Report is 28 commits behind head on main.

❗ Current head fb95a54 differs from pull request most recent head 72eb355. Consider uploading reports for the commit 72eb355 to get more accurate results

Files Patch % Lines
internal/xds/translator/translator.go 87.19% 10 Missing and 11 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2981      +/-   ##
==========================================
- Coverage   66.51%   58.94%   -7.57%     
==========================================
  Files         161      162       +1     
  Lines       22673    27125    +4452     
==========================================
+ Hits        15080    15990     +910     
- Misses       6720    10182    +3462     
- Partials      873      953      +80     

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

@zhaohuabing zhaohuabing changed the title Refactor and fix return early: HTTP Listener XDS translator Refactor and fix early return: HTTP Listener XDS translator Mar 20, 2024
@zhaohuabing zhaohuabing self-assigned this Mar 21, 2024
Signed-off-by: huabing zhao <[email protected]>
@zhaohuabing zhaohuabing force-pushed the fix-http-listener-missing-filters-refactor branch from 53acda0 to 0688a1a Compare March 28, 2024 01:47
@zhaohuabing zhaohuabing marked this pull request as ready for review March 28, 2024 01:48
@zhaohuabing zhaohuabing requested a review from arkodg March 28, 2024 01:50
@zhaohuabing zhaohuabing force-pushed the fix-http-listener-missing-filters-refactor branch from ba79a3e to 7fa68a2 Compare March 29, 2024 01:32
@zirain
Copy link
Member

zirain commented Apr 10, 2024

any test for this?

@@ -194,7 +194,17 @@ func buildXdsQuicListener(name, address string, port uint32, accesslog *ir.Acces
return xdsListener
}

func (t *Translator) addXdsHTTPFilterChain(xdsListener *listenerv3.Listener, irListener *ir.HTTPListener,
// addHCMToXDSListener adds a HCM filter to the listener's filter chain, and adds
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️

Copy link
Contributor

@arkodg arkodg left a comment

Choose a reason for hiding this comment

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

LGTM thanks for this refactor ! much easier to read now
hope we didn't miss any lines while moving the function into other methods

@arkodg arkodg requested review from a team April 10, 2024 09:43
@zirain zirain merged commit a24263c into envoyproxy:main Apr 11, 2024
17 checks passed
@zhaohuabing zhaohuabing deleted the fix-http-listener-missing-filters-refactor branch April 11, 2024 00:59
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.

3 participants