Hi everyone.
I have an EnvoyFilter that is validating through a service if a token is valid.
It is currently working fine except when I call a particular service.
When calling the service, the pod automatically dies giving me an HTTP 503 error.
I have described the pod and it delivers the following error:
Readiness probe failed: HTTP probe failed with statuscode: 503
In Postman: upstream connect error or disconnect/reset before headers. reset reason: connection failure
If I delete the EnvoyFilter this does not happen and it works correctly.
Why this error?
I attach the EnvoyFilter…
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: envoy-filter
namespace: istio-system
spec:
filters:
- filterConfig:
inlineCode: |
function envoy_on_request(request_handle)
local path= request_handle:headers():get(":path");
local host= request_handle:headers():get(":authority");
request_handle:logWarn("Path Obtenido en la url " .. path);
local metodo= request_handle:headers():get(":method");
request_handle:logWarn("Metodo Utilizado " .. metodo);
if string.match(metodo, "GET") or string.match(metodo, "POST") then
if string.match(path, "path-service") then
request_handle:logWarn("Dentro de la funcion llamada al servicio");
request_handle:logWarn("Obteniendo el Host");
request_handle:logWarn(host);
request_handle:logWarn("Obteniendo el path");
request_handle:logWarn(path);
local auth_host = "validate-service.namespace.svc.cluster.local"
local cluster = "outbound|80||validate-service.namespace.svc.cluster.local"
local auth = request_handle:headers():get("authorization") #get token
local request_headers = {
[":method"] = "GET",
[":path"] = "/path-for-validate",
[":authority"] = auth_host,
["authorization"] = auth
}
local request_body = ""
local timeout = 5000 --ms
local response_headers, response_body = request_handle:httpCall(
cluster,
request_headers,
request_body,
timeout
)
if tonumber(response_headers[":status"]) ~= 200 then
request_handle:logWarn("Se produjo un error en la llamada");
request_handle:respond({[":status"] = response_headers[":status"]}, response_body)
else
request_handle:logWarn("Respuesta 200");
end
else
request_handle:logWarn("no encontró el path definido " .. path);
end
end
end
filterName: envoy.lua
filterType: HTTP
insertPosition:
index: FIRST
listenerMatch:
listenerType: GATEWAY
portNumber: 443
workloadLabels:
app: istio-ingressgateway