-
Notifications
You must be signed in to change notification settings - Fork 702
Description
How can we configure timeouts in Contour - based on Gateway API objects - to avoid HTTP 504 "upstream request timeout" responses from Envoy when our upstream service is slow (response in > 15 seconds)?
Background:
We have Contour's Gateway provisioner installed, currently v1.23.0, so our apps can use Gateway API with dynamic provisioning.
We hit a road-block with a slow upstream service that exceeds 15 seconds and causes Envoy to respond with HTTP 504 "upstream request timeout". I think this means that the upstream service is exceeding Envoy's default 15-second route-level timeout.
I gleaned from the Gateway API guide that I could use ContourDeployment to set some configuration, including the runtimeSettings.envoy.timeouts block with e.g. timeouts.requestTimeout. And I verified using /config_dump that Envoy's config reflects these timeouts settings, e.g. request_timeout. But this requestTimeout/request_timeout is different from the route-level timeout in Envoy's config, and changing it doesn't seem to affect this 15-second limit. It doesn't seem that any of ContourDeployment impacts the route-level timeout.
Outside of Gateway API, it looks like there are different ways of setting the route-level timeout:
But I don't see a way using Gateway API and associated objects (GatewayClass, ContourDeployment, Gateway, HTTPRoute, Service) to set this.
How can we use Gateway API and still support a slow upstream service that takes > 15 seconds?
If there's not an immediate solution in the current Contour version, here are some thoughts:
- Can
ContourDeploymentruntimeSettings.envoy.timeoutsget a new field that gives a global value to apply as the route-level timeout for all Envoy routes? - Can Contour process the annotation
projectcontour.io/response-timeouton Gateway, similar to what it does on Ingress? Or even on Service (since there are already Service Contour annotations that seem like they map to Envoy route config)? - Can Contour implement a policy CRD for settings like the route-level timeout along the lines of the Gateway policy attachment spec? E.g. we would create a
ContourTimeoutPolicywith a settingresponse: '30s'andtargetRefpointing to an HTTPRoute?
Thanks for your time!
Environment:
- Contour version: v1.23.0
- Kubernetes version: (use
kubectl version): v1.23.8