Hi, I am using istio 1.5.4 and trying to connect to external service (cloud function on GCP) using envoy filter. Here is the configuration, I am using -
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: telementry-lua
namespace: helloistio
spec:
workloadSelector:
labels:
app: helloworld
configPatches:
# The first patch adds the lua filter to the listener/http connection manager
- applyTo: HTTP_FILTER
match:
context: SIDECAR_INBOUND
listener:
filterChain:
filter:
name: "envoy.http_connection_manager"
subFilter:
name: "envoy.router"
patch:
operation: INSERT_BEFORE
value: # lua filter specification
name: envoy.lua
typed_config:
"@type": "type.googleapis.com/envoy.config.filter.http.lua.v2.Lua"
inlineCode: |
function envoy_on_request(request_handle)
-- Make an HTTP call to an upstream host with the following headers, body, and timeout.
request_handle:logWarn("telementry starts.")
local headers, body = request_handle:httpCall(
"lua_cluster",
{
[":method"] = "POST",
[":path"] = "/telemetry-via-istio",
[":authority"] = "europe-west1-dave-225414.cloudfunctions.net"
},
"{}",
5000)
request_handle:logWarn("telementry ends: ")
end
# The second patch adds the cluster that is referenced by the lua code
# cds match is omitted as a new cluster is being added
- applyTo: CLUSTER
match:
context: SIDECAR_OUTBOUND
patch:
operation: ADD
value: # cluster specification
name: "lua_cluster"
type: STRICT_DNS
connect_timeout: 0.5s
lb_policy: ROUND_ROBIN
hosts:
- socket_address:
protocol: TCP
address: "europe-west1-dave-225414.cloudfunctions.net"
port_value: 443
The cloud function, I am trying to hit is https://europe-west1-dave-225414.cloudfunctions.net/ss-test-telemetry. I am able to hit it using curl command -
curl -XPOST https://europe-west1-dave-225414.cloudfunctions.net/ss-test-telemetry
But while trying to hit it using envoy filter, I am getting connection failure error.
Please help.