Skip to content

feat(charts): make HTTPRoute backendRefs optional per rule - #216

Merged
IxDay merged 1 commit into
lago-v2from
feat/httproute-backendrefs-hook
Jun 26, 2026
Merged

feat(charts): make HTTPRoute backendRefs optional per rule#216
IxDay merged 1 commit into
lago-v2from
feat/httproute-backendrefs-hook

Conversation

@IxDay

@IxDay IxDay commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

lago-rails and lago-front always appended the default service backendRefs to every rule in their HTTPRoute template. That blocked rules ending in a terminal filter (DirectResponse via ExtensionRef, RequestRedirect, etc.), since those must render without a backendRefs to be valid Gateway API.

The change uses hasKey on .backendRefs per rule:

  • omitted → default service backend injected (back-compat with every existing values file)
  • backendRefs: [] → no backendRefs rendered, for terminal-filter rules
  • explicit list → passed through for custom or weighted backends

HTTPRouteRule.backendRefs is optional in the Gateway API spec, so this just stops the chart from overriding that optionality.

Motivation: lago-infrastructure needs to add a /metrics block rule (DirectResponse 404 via Envoy Gateway's HTTPRouteFilter) to the lago-api HTTPRoute in staging-eu. Since that route is templated by lago-rails, the chart had to grow a hook for terminal filters.

Test plan

  • helm template charts/lago-rails -f <values> with backendRefs: [] on a rule renders the rule with no backendRefs: line
  • same with backendRefs: [{...}] renders the user backends
  • same with no backendRefs key renders the default service backend (back-compat)
  • same three cases on charts/lago-front
  • task render on the umbrella lago chart exits clean
  • (deferred) task test:unit once untt is available locally

The lago-rails and lago-front httproute templates always appended the
default service backendRefs to every rule, which blocked rules ending
in a terminal filter (DirectResponse via ExtensionRef, RequestRedirect)
since those must render without backendRefs to be valid Gateway API.

Switch to hasKey on .backendRefs: omitted keeps the previous default
backend (back-compat with every existing values file), [] suppresses
backendRefs entirely (for terminal filters), and an explicit list
passes through for custom or weighted backends. backendRefs is optional
in the Gateway API spec, so this just stops the chart from overriding
that optionality.
@IxDay
IxDay force-pushed the feat/httproute-backendrefs-hook branch from 99755d0 to 51e3850 Compare June 26, 2026 08:14
@IxDay
IxDay merged commit 3fa61a5 into lago-v2 Jun 26, 2026
3 checks passed
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.

1 participant