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

Support Lua Filters in EnvoyExtensionPolicy #4627

Open
arkodg opened this issue Nov 4, 2024 · 2 comments
Open

Support Lua Filters in EnvoyExtensionPolicy #4627

arkodg opened this issue Nov 4, 2024 · 2 comments
Labels
area/api API-related issues help wanted Extra attention is needed
Milestone

Comments

@arkodg
Copy link
Contributor

arkodg commented Nov 4, 2024

Description:

Describe the desired behavior, what scenario it enables and how it
would be used.

Allow users to configure Lua filters using the EnvoyExtensionPolicy https://gateway.envoyproxy.io/docs/api/extension_types/#envoyextensionpolicyspec

relates to #2025

[optional Relevant Links:]

Any extra documentation required to understand the issue.

@arkodg arkodg added triage help wanted Extra attention is needed area/api API-related issues labels Nov 4, 2024
@arkodg arkodg modified the milestones: v1.2.0, Backlog Nov 4, 2024
@arkodg arkodg added kind/decision A record of a decision made by the community. and removed triage help wanted Extra attention is needed labels Nov 4, 2024
@zhaohuabing
Copy link
Member

zhaohuabing commented Nov 5, 2024

+1 Lua support is essential for users migrating from the Nginx ecosystem.

@arkodg
Copy link
Contributor Author

arkodg commented Nov 5, 2024

Here's a workaround until this is implemented using EnvoyPatchPolicy which needs to be enabled https://gateway.envoyproxy.io/docs/tasks/extensibility/envoy-patch-policy/

This patch assumes the Gateway installed is the same as the one from the Quickstart https://gateway.envoyproxy.io/docs/tasks/quickstart/

apiVersion: gateway.envoyproxy.io/v1alpha1
kind: EnvoyPatchPolicy
metadata:
  name: lua-header-patch-policy 
  namespace: default 
spec:
  targetRef:
    group: gateway.networking.k8s.io
    kind: Gateway
    name: eg
  type: JSONPatch
  jsonPatches:
    - type: "type.googleapis.com/envoy.config.listener.v3.Listener"
      # The listener name is of the form <GatewayNamespace>/<GatewayName>/<GatewayListenerName>
      name: default/eg/http
      operation:
        op: add
        path: "/default_filter_chain/filters/0/typed_config/http_filters/0"
        value:
          name: "envoy.filters.http.lua"
          typed_config:
            "@type": type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua
            inline_code: |
              function envoy_on_request(request_handle)
                print("Hello World")
              end

You will need to also enable info logging in the proxy if testing this example

apiVersion: gateway.envoyproxy.io/v1alpha1
kind: EnvoyProxy
metadata:
  name: envoyproxy-logging-config
spec:
  logging:
    level:
      default: info

Note if linking this to a HTTPS listener, the path prefix will need to be updated to /filter_chains/0 instead of default_filter_chain

@arkodg arkodg added help wanted Extra attention is needed and removed kind/decision A record of a decision made by the community. labels Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/api API-related issues help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants