feat: support per-route timeout overrides for ingress path rules#2250
Conversation
Changes the additional_api_paths_handled_by_ingress variable from
list(string) to list(object({ paths, timeout_sec? })). Each entry now
creates its own path_rule, and when timeout_sec is set, it adds a
route_action.timeout that overrides the ingress backend default (80s).
Backwards compatible: existing callers just need to wrap their path
lists, e.g.:
# Before
additional_api_paths_handled_by_ingress = ["/v1/foo", "/v1/bar"]
# After
additional_api_paths_handled_by_ingress = [
{ paths = ["/v1/foo", "/v1/bar"] }
]
# Or with a custom timeout
additional_api_paths_handled_by_ingress = [
{ paths = ["/v1/foo"], timeout_sec = 300 },
{ paths = ["/v1/bar"] }
]
PR SummaryMedium Risk Overview Written by Cursor Bugbot for commit 62ed9e9. This will update automatically on new commits. Configure here. |
dobrac
left a comment
There was a problem hiding this comment.
LGTM, but please address the bot comments first
sitole
left a comment
There was a problem hiding this comment.
Ping me when ready i will approve it 🙏🏼
Please make sure all our deploy ENVs for clusters are configured properly before merging.
| variable "additional_traefik_arguments" { | ||
| type = list(string) | ||
| default = [] | ||
| variable "traefik_config_files" { |
There was a problem hiding this comment.
Are we planning on using these outside of provider-aws / provider-gcp? If we're not, I'm passing the values in from both modules. so defaults are never used. Adding defaults only hides the fact that we forgot to implement the configuration in aws or gcp.
If we're planning on publishing these modules to terraform (for example) or having people use them on their own, then the default is still useful.
| %{ for filename, content in config_files } | ||
| template { | ||
| data = <<EOF | ||
| ${content} |
There was a problem hiding this comment.
Do we already have examples of what we want to reconfigure? I did not find any relevant PR using this.
There was a problem hiding this comment.
Using this feature we (and anyone else) can configure traefik any way they want. New files could override logging, improve tracing, add routers, etc. We'll be using it to increase timeouts for specific paths, but that'll be done directly in runtime configuration.
| })) | ||
| } | ||
|
|
||
| variable "ingress_timeout_seconds" { |
There was a problem hiding this comment.
The network module is used in our closed-source code, so you don't need to redefine it imho.
There was a problem hiding this comment.
This default would never be used; we pass a value in to network/variables.tf explicitly. We define a default in iac/provider-gcp/variables.tf though, which is used and passed up the chain to here.
| } | ||
|
|
||
| variable "additional_api_paths_handled_by_ingress" { | ||
| type = list(string) |
There was a problem hiding this comment.
The default is defined in iac/provider-gcp/variables.tf and propagated here.
| @@ -132,16 +132,14 @@ variable "ingress_count" { | |||
| } | |||
|
|
|||
| variable "additional_api_paths_handled_by_ingress" { | |||
There was a problem hiding this comment.
I think there is a missing change in the makefile to remove old and add new vars.
There was a problem hiding this comment.
No need, we support both the old and new versions (as of the latest commit)
No changes are necessary; this is backwards compatible, and new values don't need to be added until after we merge this. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Co-authored-by: djeebot <djeebot@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

Changes the additional_api_paths_handled_by_ingress variable from
list(string)to also acceptinglist(object({ paths, timeout_sec? })). Each entry now creates its own path_rule, and when timeout_sec is set, it adds a route_action.timeout that overrides the ingress backend default (80s). Fully backwards compatible.Also move traefik configuration to a config file, and support extra config files.
This was done in order to increase timeouts for specific paths, and enhance our ability to configure traefik per environment without exposing new variables.