Hello Istio,
I am trying to implement envoy filters in our environment to handle header manipulation for various microservices but we are not able to use “workloadLabels” to make that application(service) specific. I am applying it at gateway level due to which even a small load is breaking the call flow.
Here is the config I am using:
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: envoy-filter-relqa
namespace: mui-relqa
spec:
filters:
- listenerMatch:
portNumber: 443
listenerType: GATEWAY
filterName: envoy.lua
filterType: HTTP
insertPosition:
index: FIRST
filterConfig:
inlineCode: |
function envoy_on_request(request_handle)
local path= request_handle:headers():get(":path");
if path~="/health" then
local cookie= request_handle:headers():get("cookie")
local token= request_handle:headers():get("access_token");
local user= request_handle:headers():get("user-agent");
if string.match(path,"/api/checkout") then
request_handle:logWarn("inside checkout service")
if token then
if token~="true" then
request_handle:logWarn("Access token in the header")
request_handle:logWarn(request_handle:headers():get("access_token"))
request_handle:headers():replace("access_token",token)
end
end
if cookie then
request_handle:logWarn("Access token in the Cookie")
request_handle:logWarn(cookie)
cookietoken(cookie,";",request_handle,"=");
end
end
We have multiple such “if” conditions mentioned above (actually one “if” condition for each microservice in single EnvoyFilter)
Please let me know if you have any suggestions to optimize this to make istio scan the filter faster, which I guess it does for each an every call.