Hi All,
Does anyone know of an example how to make httpCall out to external service, especially adding the envoy custom cluster (the first argument of the httpCall) within the ServiceDefaults resource?
Example:
apiVersion: consul.hashicorp.com/v1alpha1
kind: ServiceDefaults
metadata:
name: my-service
spec:
protocol: http
envoyExtensions:
- name: "builtin/lua"
required: true
arguments:
proxyType: "connect-proxy"
listener: "outbound"
script: |-
function envoy_on_request(request_handle)
-- Make an HTTP call.
headers, body = request_handle:httpCall(
"custom-cluster",
{
[":method"] = "GET",
[":path"] = "/api/abc/v1/session",
[":authority"] = "abc",
["authorization"] = abc
},
"test",
5000)
local headers = request_handle:headers()
for key, value in pairs(headers) do
request_handle:headers():add(key, value)
end
end
Thanks!
~K