envoyproxy / envoyproxy/gateway
EnvoyPatchPolicy with targetRef
- Dominant language
- Go
- Stars
- 3k
- Forks
- 864
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 140
Description
1. should we allow to use targetRefs like EnvoyExtensionPolicy?
2. TargetRef to Gateway in MergeGateways mode not working
```yaml
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: EnvoyPatchPolicy
metadata:
name: patch-gateway-class
namespace: default
spec:
targetRef:
group: gateway.networking.k8s.io
kind: GatewayClass
name: eg-merge-demo
type: JSONPatch
jsonPatches:
- name: "default/gateway-v1/http-v1"
type: type.googleapis.com/envoy.config.listener.v3.Listener
operation:
op: add
path: /default_filter_chain/filters/0/typed_config/http_filters/0
value:
name: "envoy.lua"
typedConfig:
"@type": type.googleapis.com/udpa.type.v1.TypedStruct
typeUrl: type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua
value:
inline_code: |
function envoy_on_request(request_handle)
-- Make an HTTP call to an upstream host with the following headers, body, and timeout.
val = request_handle:headers():get("x-envoy-peer-metadata-id")
request_handle:logWarn("get result: " .. val)
end
---
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: EnvoyPatchPolicy
metadata:
name: patch-gateway
namespace: default
spec:
targetRef:
group: gateway.networking.k8s.io
kind: Gateway
name: gateway-v2
type: JSONPatch
jsonPatches:
- name: "default/gateway-v2/http-v2"
type: type.googleapis.com/envoy.config.listener.v3.Listener
operation:
op: add
path: /default_filter_chain/filters/0/typed_config/http_filters/0
value:
name: "envoy.lua"
typedConfig:
"@type": type.googleapis.com/udpa.type.v1.TypedStruct
typeUrl: type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua
value:
inline_code: |
function envoy_on_request(request_handle)
-- Make an HTTP call to an upstream host with the following headers, body, and timeout.
val = request_handle:headers():get("x-envoy-peer-metadata-id")
request_handle:logWarn("get result: " .. val)
end
```
```console
NAME ACCEPTED PROGRAMMED AGE
patch-gateway 7m5s
patch-gateway-class True True 7m5s
```
`patch-gateway` was ignored without any information, here are some thinkings:
1. Should EG allow to patch gateway in merge gateways mode?
2. Should EG allow to patch GatewayClass(attached to all the gateways within the GatewayClass) in default mode?
More thinking about this:
> The EnvoyExtensionPolicy "lua-extension-policy" is invalid: spec: Invalid value: "object": this policy can only have a targetRefs[*].kind of Gateway/HTTPRoute/GRPCRoute/TCPRoute/UDPRoute/TLSRoute
Should we allow EnvoyExtensionPolicy target to a GatewayClass?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.