envoy icon indicating copy to clipboard operation
envoy copied to clipboard

Retries for httpCall from EnvoyFilter

Open sumitaneja opened this issue 2 years ago • 3 comments

Deployment: OKE+istio-proxy enabled for pods..

We have EnvoyFilter defined in Istio, From this filter, Http call is made µService deployed in OKE container, Query 1: how can i configure retries here. I observed virtual service retry not kicking if call is from Envoyfilter http client. As part of envoyfilter definition a cluster was defined to create route to µService deployment within OKE from Envoy

Query 2: If I configure programmatic retry in while loop, Envoy retries on same replica of target service. We want retries to happen on different replica if available. Any configuration changes shall impact this particluar client only and should not impact current behavior for other deployments in cluster. (oke services, istio-proxy vitrtual services etc.)

As part of envoyfilter definition a cluster was defined to create route to µService deployment within OKE from Envoy

- 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
          load_assignment:
            cluster_name: lua_cluster
            endpoints:
              - lb_endpoints:
                  - endpoint:
                      address:
                        socket_address:
                          protocol: TCP
                          address: "xxx.svc.cluster.local"
                          port_value: 8080
`
``

sumitaneja avatar Jul 11 '22 03:07 sumitaneja

Hi, not sure I fully grok your questions but I'll try to answer:

  1. Retry configurations are typically done for a route, so you should be able to set the policy for the route to your lua_cluster cluster.

  2. IIUC your programmatic retry is defined in a filter, but I'm missing what you are actually doing. If you want to programmatically change things, you can probably add a header that causes the change to a different route.

adisuissa avatar Jul 11 '22 15:07 adisuissa

Thanks @adisuissa For 1 can you help with more concrete example. I am not sure how this can be achieved

For 2 this is my sample code in lua filter. Even though above cluster is round robin and STRICT_DNS, all requests are landing on same host from lua filter

               while retry and count < 3 do
                 count = count+ 1
                 rlHeaders["x-retry-count"] = count
                 headers, body = request_handle:httpCall(
                  "lua_cluster",
                 rlHeaders,
                 limitBody,
                 30000)
                 rlStatus = headers[":status"]
                 if(rlStatus and rlStatus == "200")
                 then
                  retry = false
                 end
                end

sumitaneja avatar Jul 12 '22 04:07 sumitaneja

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or "no stalebot" or other activity occurs. Thank you for your contributions.

github-actions[bot] avatar Aug 11 '22 08:08 github-actions[bot]

This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted" or "no stalebot". Thank you for your contributions.

github-actions[bot] avatar Aug 18 '22 12:08 github-actions[bot]