Skip to content

feat: support per-route timeout overrides for ingress path rules#2250

Merged
djeebus merged 12 commits into
mainfrom
joe/per-route-ingress-timeouts
Apr 6, 2026
Merged

feat: support per-route timeout overrides for ingress path rules#2250
djeebus merged 12 commits into
mainfrom
joe/per-route-ingress-timeouts

Conversation

@djeebus
Copy link
Copy Markdown
Contributor

@djeebus djeebus commented Mar 28, 2026

Changes the additional_api_paths_handled_by_ingress variable from list(string) to also accepting 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). 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.

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"] }
  ]
@cursor
Copy link
Copy Markdown

cursor Bot commented Mar 28, 2026

PR Summary

Medium Risk
Touches ingress routing and proxy configuration across GCP/AWS modules; misconfiguration could change request routing or timeouts and impact availability. Backward-compat normalization reduces migration risk but still alters variable types and template rendering paths.

Overview
Adds per-route timeout overrides for GCP load balancer path rules by allowing additional_api_paths_handled_by_ingress to accept structured entries (paths + optional timeout_sec) and introducing an ingress_timeout_seconds default for the ingress backend service. Refactors the Nomad ingress/Traefik job to use a generated traefik.toml config file plus optional extra dynamic config files via the file provider, replacing the prior additional_traefik_arguments plumbing and propagating the new traefik_config_files variable through AWS and GCP Terraform modules.

Written by Cursor Bugbot for commit 62ed9e9. This will update automatically on new commits. Configure here.

Comment thread iac/provider-gcp/nomad-cluster/network/main.tf
Comment thread iac/provider-gcp/nomad-cluster/network/main.tf
@djeebus djeebus marked this pull request as ready for review March 28, 2026 14:25
Comment thread iac/provider-gcp/nomad-cluster/network/variables.tf
Comment thread iac/modules/job-ingress/jobs/traefik.toml Outdated
Comment thread iac/provider-aws/nomad/variables.tf
Comment thread iac/modules/job-ingress/jobs/traefik.toml
Copy link
Copy Markdown
Contributor

@dobrac dobrac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but please address the bot comments first

dobrac
dobrac previously requested changes Apr 2, 2026
@sitole sitole self-assigned this Apr 2, 2026
@sitole sitole self-requested a review April 2, 2026 12:43
Copy link
Copy Markdown
Member

@sitole sitole left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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" {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please provide default

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +100 to +103
%{ for filename, content in config_files }
template {
data = <<EOF
${content}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we already have examples of what we want to reconfigure? I did not find any relevant PR using this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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" {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we set a default here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The network module is used in our closed-source code, so you don't need to redefine it imho.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty default here would be nice

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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" {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is a missing change in the makefile to remove old and add new vars.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need, we support both the old and new versions (as of the latest commit)

@djeebus
Copy link
Copy Markdown
Contributor Author

djeebus commented Apr 2, 2026

Ping me when ready i will approve it 🙏🏼 Please make sure all our deploy ENVs for clusters are configured properly before merging.

No changes are necessary; this is backwards compatible, and new values don't need to be added until after we merge this.

@djeebus djeebus requested a review from sitole April 2, 2026 21:16
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment thread iac/modules/job-ingress/jobs/ingress.hcl
@djeebus djeebus requested review from dobrac and sitole April 3, 2026 00:13
@djeebus djeebus dismissed dobrac’s stale review April 6, 2026 23:03

resolved all bot comments

@djeebus djeebus merged commit e83bf5f into main Apr 6, 2026
36 checks passed
@djeebus djeebus deleted the joe/per-route-ingress-timeouts branch April 6, 2026 23:03
ValentaTomas pushed a commit that referenced this pull request May 4, 2026
Co-authored-by: djeebot <djeebot@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants