Skip to content

Ext proc http functionality support - #35740

Merged
yanavlasov merged 65 commits into
envoyproxy:mainfrom
yanjunxiang-google:ext_proc_http_integration
Sep 30, 2024
Merged

yanavlasov merged 65 commits into
envoyproxy:mainfrom
yanjunxiang-google:ext_proc_http_integration

Conversation

@yanjunxiang-google

@yanjunxiang-google yanjunxiang-google commented Aug 18, 2024 •

Copy link
Copy Markdown
Contributor

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 <[email protected]>
Signed-off-by: Yanjun Xiang <[email protected]>
Signed-off-by: Yanjun Xiang <[email protected]>
Signed-off-by: Yanjun Xiang <[email protected]>
Signed-off-by: Yanjun Xiang <[email protected]>
Signed-off-by: Yanjun Xiang <[email protected]>
Signed-off-by: Yanjun Xiang <[email protected]>
Signed-off-by: Yanjun Xiang <[email protected]>
@yanjunxiang-google

yanjunxiang-google commented Aug 22, 2024 •

Copy link
Copy Markdown
Contributor Author

This PR adds the support of sending ext_proc call out messages to the HTTP side stream server. The proto messages: ProcessingRequest/ProcessingResponse are transcoded into JSON text and encoded in the body of a HTTP message.

The processing flow works this way:

  1. When Envoy needs to send call out messages to the side stream server, either header, body , or trailer, Envoy construct a ProcessingRequest proto message.
  2. 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.
  3. The HTTP server receives the "POST" message. Transcoding the body, i.e, a JSON text, into a ProcessingRequest message.
  4. The HTTP server then performs normal header/body/trailer mutation as existing, and put them into a ProcessingResponse proto message.
  5. The HTTP server then transcode the ProcessingResponse into JSON text, and sends back a 200 response with this JSON text as body.
  6. 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 and logic. The only difference is in the message sending mechanism. 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.

Signed-off-by: Yanjun Xiang <[email protected]>
@yanjunxiang-google

Copy link
Copy Markdown
Contributor Author

/retest

@yanjunxiang-google

Copy link
Copy Markdown
Contributor Author

/docs

@repokitteh-read-only

Copy link
Copy Markdown

Docs for this Pull Request will be rendered here:

https://storage.googleapis.com/envoy-pr/35740/docs/index.html

The docs are (re-)rendered each time the CI envoy-presubmit (precheck docs) job completes.

🐱

Caused by: a #35740 (comment) was created by @yanjunxiang-google.

see: more, trace.

Signed-off-by: Yanjun Xiang <[email protected]>
@yanjunxiang-google

Copy link
Copy Markdown
Contributor Author

@envoyproxy/api-shepherds PTAL and approve

@adisuissa adisuissa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks!
Let's make this unimplemented-hide and make it under work-in-progress so this can be tested properly and finalized later.

@adisuissa adisuissa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/lgtm api

@yanjunxiang-google

Copy link
Copy Markdown
Contributor Author

/retest

@yanjunxiang-google

Copy link
Copy Markdown
Contributor Author

Kind Ping!

@yanavlasov yanavlasov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/wait

@yanavlasov
yanavlasov merged commit a3e32c9 into envoyproxy:main Sep 30, 2024
@yanjunxiang-google
yanjunxiang-google deleted the ext_proc_http_integration branch October 2, 2024 21:03
yanavlasov pushed a commit that referenced this pull request Dec 6, 2024
This is a follow up PR of:
#35740.

This PR added the bytes tracking support for ext_proc http service,
which basically is counting how many bytes are sent to and received from
ext_proc HTTP service.

It takes the stream_info from the active HTTP request, and saved in the
ext_proc filter. When the external processing completes, the bytes
counters from the stream_info are retrieved and stored into the filter
state.

The existing logging test filter is leveraged to test the byte counters
in the filter state are correctly updated.

---------

Signed-off-by: Yanjun Xiang <[email protected]>
phlax pushed a commit to phlax/envoy-openssl that referenced this pull request Mar 7, 2025
This is a follow up PR of:
envoyproxy/envoy#35740.

This PR added the bytes tracking support for ext_proc http service,
which basically is counting how many bytes are sent to and received from
ext_proc HTTP service.

It takes the stream_info from the active HTTP request, and saved in the
ext_proc filter. When the external processing completes, the bytes
counters from the stream_info are retrieved and stored into the filter
state.

The existing logging test filter is leveraged to test the byte counters
in the filter state are correctly updated.

---------

Signed-off-by: Yanjun Xiang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants