Open arkodg opened 4 days ago
+1 Lua support is essential for users migrating from the Nginx ecosystem.
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
Description:
Allow users to configure Lua filters using the EnvoyExtensionPolicy https://gateway.envoyproxy.io/docs/api/extension_types/#envoyextensionpolicyspec
relates to https://github.com/envoyproxy/gateway/issues/2025
[optional Relevant Links:]