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

Adding HTTP service support for Envoy external processing #35488

Open
yanjunxiang-google opened this issue Jul 30, 2024 · 3 comments
Open

Adding HTTP service support for Envoy external processing #35488

yanjunxiang-google opened this issue Jul 30, 2024 · 3 comments
Labels
enhancement Feature requests. Not bugs or questions.

Comments

@yanjunxiang-google
Copy link
Contributor

yanjunxiang-google commented Jul 30, 2024

Title: Adding HTTP service support for Envoy external processing

Description:
Currently Envoy ext_proc filter can only talk to a gRPC service to do external processing. There is a need for ext_proc filter to be able to talk to a raw HTTP service to do the external processing.
This issue tracks the work needed to send HTTP messages to carry headers(request/response) to the side stream server.
Sending body or trailers using HTTP message will be tracked by a separate effort.

@yanjunxiang-google yanjunxiang-google added enhancement Feature requests. Not bugs or questions. triage Issue requires triage labels Jul 30, 2024
@yanjunxiang-google
Copy link
Contributor Author

yanjunxiang-google commented Jul 30, 2024

It is planned to have multiple incremental PRs to support this feature:

  1. API to add the API service

  2. Adding ext_proc HTTP client

  3. Refactor the ext_proc filter code to be able to support either gRPC client or HTTP client based on filter configuration.

  4. Adding ext_proc HTTP service testing framework.

  5. Adding integration test to test ext_proc filter <----> HTTP service end-to-end.

  6. Update the API to describe how the HTTP messages will be constructed.

  7. Adding HTTP request-ID and session affinity as in this comment:

#35740 (comment)

x) TBD:

x.1)
Do we need to support per-route override of http_service config, like here?

config.core.v3.GrpcService grpc_service = 5;

This won't be considered in the MVP of ext_proc HTTP support.

x.2) Logging the HTTP ext_proc call, something like gRPC stream logging here:

void Filter::logGrpcStreamInfo() {

x.3) Adding test for having the side stream server using HTTP1 protocol.

x.4) Refactoring the code to move the stream_ variable out from Filter class, and put it into ExternalProcessorClientImpl class. So, the Filter::sendRequest() can directly call: client_->sendRequest() for better abstraction.

x.5) change client_impl.[h|cc] into grpc_client_impl.[h|cc] to distinguish it from http client files.

x.6) do we need something for HTTP for logging/monitoring purpose, something like: void Filter::logGrpcStreamInfo().

x.7: do we need to set call_backs_ to nullptr at http_client->cancel() (not necessary, need to revisit)

x.8) Explore the option to refactor client_->start() to not have dynamic_cast there.

x.9) Explore the option to refactore stream_->sendRequest() to avoid dynamic_cast there.

x.10) session affinity support

@soulxu
Copy link
Member

soulxu commented Jul 30, 2024

@soulxu soulxu removed the triage Issue requires triage label Jul 30, 2024
yanavlasov pushed a commit that referenced this issue Aug 1, 2024
This is to address the 1st step, i.e, the API change needed for
#35488.

---------

Signed-off-by: Yanjun Xiang <yanjunxiang@google.com>
update-envoy bot added a commit to envoyproxy/data-plane-api that referenced this issue Aug 1, 2024
This is to address the 1st step, i.e, the API change needed for
envoyproxy/envoy#35488.

---------

Signed-off-by: Yanjun Xiang <yanjunxiang@google.com>

Mirrored from https://github.com/envoyproxy/envoy @ ff94c296f27be2f4a6cd71a2d6b0898cec6c2100
martinduke pushed a commit to martinduke/envoy that referenced this issue Aug 8, 2024
…#35489)

This is to address the 1st step, i.e, the API change needed for
envoyproxy#35488.

---------

Signed-off-by: Yanjun Xiang <yanjunxiang@google.com>
Signed-off-by: Martin Duke <martin.h.duke@gmail.com>
tyxia pushed a commit that referenced this issue Aug 17, 2024
Risk Level: low
Testing: n/a
Docs Changes: n/a
Release Notes: inline
Fixes:

Description:
This is to address the 2st step of
#35488, i.e, the ext_proc HTTP
client framework.

---------

Signed-off-by: Yanjun Xiang <yanjunxiang@google.com>
asingh-g pushed a commit to asingh-g/envoy that referenced this issue Aug 20, 2024
…#35489)

This is to address the 1st step, i.e, the API change needed for
envoyproxy#35488.

---------

Signed-off-by: Yanjun Xiang <yanjunxiang@google.com>
Signed-off-by: asingh-g <abhisinghx@google.com>
@yanjunxiang-google
Copy link
Contributor Author

The processing flow works this way:

When Envoy needs to send call out messages to the side stream server, either header, body , or trailer, Envoy construct a ProcessingRequest proto message.
This ProcessingRequest message is transcoded into a JSON text. This JSON text is then added as a body to a HTTP "POST" message. This HTTP message is sent to the side stream HTTP server.
The HTTP server receives the "POST" message. Transcoding the body, i.e, a JSON text, into a ProcessingRequest message.
The HTTP server then performs normal header/body/trailer mutation as existing, and put them into a ProcessingResponse proto message.
The HTTP server then transcode the ProcessingResponse into JSON text, and sends back a 200 response with this JSON text as body.
After receives the 200 response, Envoy then convert the body from JSON text back to a ProcessingResponse proto message. Then continue processing this ProcessingResponse.
Overall, the ext_proc gRPC and HTTP share identical state machine. The only difference is that in the transport layer, one using gRPC, and the ProcessingRequest/ProcessingResponse messages are sent as proto messages. The other sends messages using HTTP, with the ProcessingRequest/ProcessingResponse proto messages are transcoded into JSON text, and encoded as the body in the HTTP messages.

yanavlasov pushed a commit that referenced this issue Sep 25, 2024
…36228)

This PR is part of the required refactoring needed to support HTTP
client in ext_proc: #35488

It is also to address a comment of
#35740 (comment)

---------

Signed-off-by: Yanjun Xiang <yanjunxiang@google.com>
yanavlasov pushed a commit that referenced this issue Sep 30, 2024
Risk Level: low
Testing: n/a
Docs Changes: n/a
Release Notes: inline
Fixes:

Description:
This is to address the issue:
#35488, i.e, integrate the
ext_proc HTTP client to ext_proc filter. With this PR, the basic
functionalities to have Envoy ext_proc filter talk to a HTTP server
using HTTP messages are accomplished.

This is the follow up of PR:
#35676

---------

Signed-off-by: Yanjun Xiang <yanjunxiang@google.com>
update-envoy bot added a commit to envoyproxy/data-plane-api that referenced this issue Sep 30, 2024
Risk Level: low
Testing: n/a
Docs Changes: n/a
Release Notes: inline
Fixes:

Description:
This is to address the issue:
envoyproxy/envoy#35488, i.e, integrate the
ext_proc HTTP client to ext_proc filter. With this PR, the basic
functionalities to have Envoy ext_proc filter talk to a HTTP server
using HTTP messages are accomplished.

This is the follow up of PR:
envoyproxy/envoy#35676

---------

Signed-off-by: Yanjun Xiang <yanjunxiang@google.com>

Mirrored from https://github.com/envoyproxy/envoy @ a3e32c92c5ae699a4daad094c6a87b58e1e84ec2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests. Not bugs or questions.
Projects
None yet
Development

No branches or pull requests

2 participants