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

add extension service example project #2931

Closed
wants to merge 2 commits into from

Conversation

Alice-Lilith
Copy link
Member

This adds a demo project for an extension under the examples section. It's setup as a fully fledged project that can be used as a base or an example for creating an Envoy Gateway extension. The README.md file contains a walkthrough to deploy a pre-built image of the demo, and instructions for how you can build and modify it to suit your needs.

The example adds a custom resource GlobalLuaScript. The extension has a controller to watch these resources, and when it gets xDS modification hook requests from Envoy Gateway, it will inject HTTP filters for the lua script resources so that they run against all requests.

Example logs:

k logs eg-example-extension-6db8f55c44-d8cg4

4:15AM INF starting example Envoy Gateway extension service version: 0.6.0-dev built for linux/amd64...
4:15AM INF starting xds hooks server address=0.0.0.0:9000
4:15AM INF Reconciling GlobalLuaScript={"name":"example","namespace":"default"} controller=globalluascript controllerGroup=exampleorg.io controllerKind=GlobalLuaScript name=example namespace=default reconcileID=5fb7baf7-0825-4535-a8d2-368908025073
4:15AM INF reconcile triggered by GlobalLuaScript name=example namespace=default
4:15AM INF Reconcile successful GlobalLuaScript={"name":"example","namespace":"default"} controller=globalluascript controllerGroup=exampleorg.io controllerKind=GlobalLuaScript name=example namespace=default reconcileID=5fb7baf7-0825-4535-a8d2-368908025073
4:16AM INF handling xDS HTTP Listener modification request from Envoy Gateway
4:16AM INF injecting http lua filter for exampleorg.io.GlobalLuaFilter-default.example
4:16AM INF filters to be set for listener: {"number": 2} {"content": [name:"exampleorg.io.GlobalLuaFilter-default.example"  typed_config:{[type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua]:{inline_code:"function envoy_on_response(response_handle)\n  response_handle:headers():add(\"Lua-Script-Enabled\", \"Processed\")\nend\n"}} name:"envoy.filters.http.router"  typed_config:{type_url:"type.googleapis.com/envoy.extensions.filters.http.router.v3.Router"  value:" \x01"}]}

The README.md file shows how to setup the extension, configure Envoy Gateway to use it, and create an instance of a GlobalLuaScript that adds lua-script-enabled: Processed as a response header to all requests.

Copy link

codecov bot commented Mar 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 64.59%. Comparing base (23fa358) to head (5d38821).
Report is 363 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2931      +/-   ##
==========================================
+ Coverage   64.57%   64.59%   +0.01%     
==========================================
  Files         122      122              
  Lines       21115    21115              
==========================================
+ Hits        13636    13639       +3     
+ Misses       6632     6630       -2     
+ Partials      847      846       -1     

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

@Alice-Lilith Alice-Lilith force-pushed the alicewasko/extension-example branch from c915afa to db31e8d Compare March 15, 2024 06:00
@arkodg
Copy link
Contributor

arkodg commented Mar 15, 2024

thanks for adding this @AliceProxy ! the community seems very interested into a strongly typed and programmatic way
to program xds directly, and these docs should make it much easier to get them started
@guydc @liorokman can you help with a review

@Alice-Lilith
Copy link
Member Author

Alice-Lilith commented Mar 15, 2024

thanks for adding this @AliceProxy ! the community seems very interested into a strongly typed and programmatic way to program xds directly, and these docs should make it much easier to get them started @guydc @liorokman can you help with a review

Right now this doesn't add any new docs to gateway.envoyproxy.io but if it gets to a point where we are happy with this and want to merge it then that write-up can be a follow-up task.

CI with the license check is failing and I'm not sure if we want to add the copyright comment to the go files within this example project or not since it's meant as a reference that community members can use as-is and modify, but I can add those in if we like.

The gen-check seems to be complaining about the go mod and go generation stuff used in here I haven't looked into that one much yet but it might make sense to try and have it ignore this directory.

Alice Wasko added 2 commits March 15, 2024 11:35
@Alice-Lilith Alice-Lilith force-pushed the alicewasko/extension-example branch from db31e8d to 5d38821 Compare March 15, 2024 18:35
Copy link
Contributor

@liorokman liorokman left a comment

Choose a reason for hiding this comment

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

LGTM

@kflynn
Copy link
Contributor

kflynn commented Apr 4, 2024

FTR I'd vote for adding copyright -- Envoy Gateway is already Apache-2 licensed, which is pretty permissive.

Copy link

github-actions bot commented May 4, 2024

This pull request has been automatically marked as stale because it has not had activity in the last 30 days. Please feel free to give a status update now, ping for review, when it's ready. Thank you for your contributions!

Copy link

github-actions bot commented Jun 4, 2024

This pull request has been automatically marked as stale because it has not had activity in the last 30 days. Please feel free to give a status update now, ping for review, when it's ready. Thank you for your contributions!

@Alice-Lilith
Copy link
Member Author

Alice-Lilith commented Jul 11, 2024

superseded by #3788

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.

4 participants