Skip to content

filter: AWS Lambda filter (initial version) - #10260

Merged
mattklein123 merged 8 commits into
envoyproxy:masterfrom
marcomagdy:lambda-filter-passthrough
Mar 10, 2020
Merged

mattklein123 merged 8 commits into
envoyproxy:masterfrom
marcomagdy:lambda-filter-passthrough

Conversation

@marcomagdy

Copy link
Copy Markdown
Contributor

This filter transform HTTP requests to AWS Lambda invocations.

The filter supports pass-through only. Meaning, the request body
is passed to Lambda as is. Note: Lambda requires the request to be in
JSON format.

In a later iteration, we'll wrap the headers the body in a JSON string
before passing it to Lambda.

The filter requires the ARN of the Lambda function and supports
per-filter-config. When the per-filter configuration is used, the target
cluster must be tagged with specific metadata. This indicates to the
filter whether to process the request or to skip it.

Lambda supports two invocation modes:

  • Synchronous (Request-Response)
  • Asynchronous (Event)

This initial version of the filter supports the synchronous mode only.
In a later iteration I'll add support for the asynchronous (Event-based)
version.

Signed-off-by: Marco Magdy [email protected]

This filter transform HTTP requests to AWS Lambda invocations.

The filter supports pass-through only. Meaning, the request body
is passed to Lambda as is. Note: Lambda requires the request to be in
JSON format.

In a later iteration, we'll wrap the headers the body in a JSON string
before passing it to Lambda.

The filter requires the ARN of the Lambda function and supports
per-filter-config. When the per-filter configuration is used, the target
cluster must be tagged with specific metadata. This indicates to the
filter whether to process the request or to skip it.

Lambda supports two invocation modes:
- Synchronous (Request-Response)
- Asynchronous (Event)

This initial version of the filter supports the synchronous mode only.
In a later iteration I'll add support for the asynchronous (Event-based)
version.

Signed-off-by: Marco Magdy <[email protected]>
@marcomagdy
marcomagdy requested a review from mattklein123 as a code owner March 5, 2020 03:40
@repokitteh-read-only

Copy link
Copy Markdown

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to api/.

🐱

Caused by: #10260 was opened by marcomagdy.

see: more, trace.

@marcomagdy marcomagdy changed the title AWS Lambda filter (initial version) filter: AWS Lambda filter (initial version) Mar 5, 2020
Signed-off-by: Marco Magdy <[email protected]>
The patch is small (the actual code) so any line not covered results in
a big drop in coverage.

Signed-off-by: Marco Magdy <[email protected]>

@mattklein123 mattklein123 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks looks great overall. A few nits and questions. Can you also merge master which should fix coverage and then check the coverage report for the added code? I want to make sure there is full coverage for all the error paths. Thank you!

/wait

Comment thread test/extensions/common/aws/mocks.h Resolved
If ``payload_passthrough`` is set to ``true``, then the payload is sent to Lambda without any transformations.
*Note*: This means you lose access to all the HTTP headers in the Lambda function.

However, if ``payload_passthrough`` is set to ``false``, then the HTTP request is transformed to a JSON payload with the following

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is not implemented yet, right? I'm a little confused about what is implemented right now versus what is not. Should you just remove the docs from this PR until it's actually implemented?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I added it to get a review on the examples mainly. I can remove the parts of the documentation (and examples) that speak to features that are not implemented yet.

If you prefer to review documentation once at the end, that works too. LMK.

@marcomagdy

Copy link
Copy Markdown
Contributor Author

cc @mattklein123

@mattklein123 mattklein123 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@mattklein123
mattklein123 merged commit 8074010 into envoyproxy:master Mar 10, 2020
@marcomagdy
marcomagdy deleted the lambda-filter-passthrough branch March 10, 2020 19:29
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.

2 participants