How to add clusters (envoy) in Istio for EnvoyFilter

Hi,

I am writing an EnvoyFilter to call an http service and there I have to specify a cluster which is my http service. How can I register my http service as a cluster in EnvoyFilter?

  local headers, body = request_handle:httpCall(
  "lua_cluster",
  {
    [":method"] = "POST",
    [":path"] = "/",
    [":authority"] = "lua_cluster"
  },
  "hello world",
  5000)

Thank you!
Pubudu.

Finally I managed to figure out how to specify clusters in httpCall. You can specify the cluster as below.

 local headers, body = request_handle:httpCall(
  "outbound|80||service-hello.default.svc.local",
  {
    [":method"] = "POST",
    [":path"] = "/",
    [":authority"] = "service-hello.default.svc.local"
  },
  "hello world",
  5000)

If you are having a service called service-hello.default.svc.local in k8s, the cluster name is “outbound|80||service-hello.default.svc.local”. Likewise, you can define the clusters.

2 Likes