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

http: support route mutability #15266

Merged
merged 86 commits into from Apr 9, 2021
Merged

Conversation

mengmichael1
Copy link
Contributor

@mengmichael1 mengmichael1 commented Mar 2, 2021

Commit Message: http: support route mutability

Additional Description: Implements #14904.

  • Adds a setRoute method into the Filter API, adding setRoute into HCM ActiveStream where it is implemented as a StreamFilterCallbacks for filters to call
  • Adds a DelegatingRoute / DelegatingRouteEntry mechanism to easily create a route that mutates specific properties of an existing route.

Risk Level: Low, implemented as new feature (no behavior changes)

Testing:

  • Unit tests in HttpConnectionManagerImplTest: testing (1) happy path case of setting the route to a DelegatingRoute that overrides clusterName, (2) setRoute(nullptr), (3) all routeEntry calls are delegated correctly and exhibit the same behavior as the base route's routeEntry
  • Integration test with (IntegrationTest, SetRouteToDelegatingRouteWithClusterOverride)

Docs Changes: "Life of a Request" docs, HTTP filters arch docs

Release Notes: Added to 1.18.0

http: added support for stream filters to mutate the cached route set by HCM route resolution. Useful for filters in a filter chain that want to override specific methods/properties of a route. See :ref:`http route mutation <arch_overview_http_filters_route_mutation>` docs for more information.

Platform Specific Features: n/a

[Optional API Considerations:] Should be noted that all changes (e.g. addition of a new virtual method) to the Route / RouteEntry API (in include/envoy/router) must also be changed in the DelegatingRoute / DelegatingRouteEntry API. Developers will see build errors if there are new virtual methods not implemented, which will act as a forcing function to maintain parity b/w the APIs.

Signed-off-by: Michael Meng <mmeng@lyft.com>
Signed-off-by: Michael Meng <mmeng@lyft.com>
Signed-off-by: Michael Meng <mmeng@lyft.com>
Signed-off-by: Michael Meng <mmeng@lyft.com>
Signed-off-by: Michael Meng <mmeng@lyft.com>
Signed-off-by: Michael Meng <mmeng@lyft.com>
Signed-off-by: Michael Meng <mmeng@lyft.com>
Signed-off-by: Michael Meng <mmeng@lyft.com>
Signed-off-by: Michael Meng <mmeng@lyft.com>
Signed-off-by: Michael Meng <mmeng@lyft.com>
Signed-off-by: Michael Meng <mmeng@lyft.com>
Signed-off-by: Michael Meng <mmeng@lyft.com>
Signed-off-by: Michael Meng <mmeng@lyft.com>
Signed-off-by: Michael Meng <mmeng@lyft.com>
Signed-off-by: Michael Meng <mmeng@lyft.com>
Signed-off-by: Michael Meng <mmeng@lyft.com>
Signed-off-by: Michael Meng <mmeng@lyft.com>
Signed-off-by: Michael Meng <mmeng@lyft.com>
Signed-off-by: Michael Meng <mmeng@lyft.com>
Signed-off-by: Michael Meng <mmeng@lyft.com>
Signed-off-by: Michael Meng <mmeng@lyft.com>
Signed-off-by: Michael Meng <mmeng@lyft.com>
Signed-off-by: Michael Meng <mmeng@lyft.com>
Signed-off-by: Michael Meng <mmeng@lyft.com>
Signed-off-by: Michael Meng <mmeng@lyft.com>
Signed-off-by: Michael Meng <mmeng@lyft.com>
Signed-off-by: Michael Meng <mmeng@lyft.com>
Signed-off-by: Michael Meng <mmeng@lyft.com>
Signed-off-by: Michael Meng <mmeng@lyft.com>
Signed-off-by: Michael Meng <mmeng@lyft.com>
@alyssawilk
Copy link
Contributor

I'm headed out (EoD EST) and out tomorrow but I'll check it out early Monday!

Signed-off-by: Michael Meng <mmeng@lyft.com>
Copy link
Contributor

@alyssawilk alyssawilk left a comment

Choose a reason for hiding this comment

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

Looks great!
I'd encourage adding this into the release notes as a new feature as I think it's useful enough we should call it out :-)

source/common/router/delegating_route_impl.cc Show resolved Hide resolved
source/common/router/delegating_route_impl.h Show resolved Hide resolved
test/integration/set_delegating_route_test.cc Outdated Show resolved Hide resolved
test/integration/set_delegating_route_test.cc Outdated Show resolved Hide resolved
test/integration/set_delegating_route_test.cc Outdated Show resolved Hide resolved
test/integration/set_delegating_route_test.cc Outdated Show resolved Hide resolved
@alyssawilk alyssawilk self-assigned this Apr 5, 2021
@alyssawilk
Copy link
Contributor

Oh also looks like CI is wedged -a new push should sort that out.

Signed-off-by: Michael Meng <mmeng@lyft.com>
Signed-off-by: Michael Meng <mmeng@lyft.com>
…asString helper

Signed-off-by: Michael Meng <mmeng@lyft.com>
Signed-off-by: Michael Meng <mmeng@lyft.com>
Signed-off-by: Michael Meng <mmeng@lyft.com>
@mengmichael1
Copy link
Contributor Author

mengmichael1 commented Apr 7, 2021

Thanks for the review @alyssawilk! I think this is ready for another pass now.

You mentioned adding this to the release notes, how do I do that? Found it. Will add to https://github.com/envoyproxy/envoy/blob/main/docs/root/version_history/current.rst tomorrow!

On the topic of docs, I've added some notes about route mutation into the arch overview http filters docs. You think that's an appropriate place?

Evening update: I'm also noticing CI things are failing with windows, will dive into sometime tomorrow.

@mengmichael1 mengmichael1 changed the title filter: support route mutability http: support route mutability Apr 8, 2021
Signed-off-by: Michael Meng <mmeng@lyft.com>
Signed-off-by: Michael Meng <mmeng@lyft.com>
Copy link
Contributor

@alyssawilk alyssawilk left a comment

Choose a reason for hiding this comment

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

LGTM modulo ci being sorted out and release notes (glad you found the right file, and the other additions are fantastic!)

Also as I'm out tomorrow feel free to ping snow for merge once those two are addressed!

Signed-off-by: Michael Meng <mmeng@lyft.com>
Signed-off-by: Michael Meng <mmeng@lyft.com>
alyssawilk
alyssawilk previously approved these changes Apr 8, 2021
Copy link
Contributor

@alyssawilk alyssawilk left a comment

Choose a reason for hiding this comment

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

LGTM! Will defer merge to snow since I'm headed out for a long weekend shortly :-)

@snowp
Copy link
Contributor

snowp commented Apr 8, 2021

@envoyproxy/windows-dev There seems to be some Windows only (I think tsan is unrelated? but not 100% sure) on this PR, any chance anyone of you could help debugging? The error message is unfortunately not very helpful

@davinci26
Copy link
Member

I have some time now, I can take a look

Signed-off-by: Michael Meng <mmeng@lyft.com>
Signed-off-by: Michael Meng <mmeng@lyft.com>
Copy link
Contributor

@snowp snowp 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! Happy to see this land!

@snowp snowp merged commit ead18ed into envoyproxy:main Apr 9, 2021
Monkeyanator pushed a commit to Monkeyanator/envoy that referenced this pull request Apr 20, 2021
Adds a setRoute method into the Filter API, adding setRoute into HCM ActiveStream where
it is implemented as a StreamFilterCallbacks for filters to call

Adds a DelegatingRoute / DelegatingRouteEntry mechanism to easily create a route that
mutates specific properties of an existing route.

Signed-off-by: Michael Meng <mmeng@lyft.com>
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.

None yet

5 participants