Skip to content

feat(ingress): render regex paths as synapse match_expr routes#43

Merged
pigri merged 3 commits into
mainfrom
feat/ingress-regex-routes
Jun 21, 2026
Merged

feat(ingress): render regex paths as synapse match_expr routes#43
pigri merged 3 commits into
mainfrom
feat/ingress-regex-routes

Conversation

@pigri

@pigri pigri commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

The ingress renderer dropped regex path matches ("synapse v1 has no regex path support"), but synapse supports regex routing via match_expr. Render them as regex routes instead.

  • Gateway RegularExpression + nginx use-regex Ingress paths → match_expr: http.request.path matches "<regex>", anchored at ^ (matches from the start of the path; k8s also requires the stored path to begin with /, so the ^ is supplied by the renderer)
  • routeCfg.matchExpr + annSettings.useRegex; addRegexRoute() (first-writer-wins); emit match_expr in both the v1 and v2 upstreams schemas
  • rulePaths now returns prefixes + regexes; the Ingress + HTTPRoute callers emit regex routes (primary host + server-aliases)
  • README: a Path matching section + the previously-undocumented --upstreams-out-configmap / --resolve-backend-cluster-ips flags

Tests: TestRulePaths updated; new TestRegexRouteRender + TestRegexAnchoring. go build / vet / test ./... green, gofmt clean.

pigri added 3 commits June 18, 2026 13:37
Gateway RegularExpression path matches and nginx use-regex Ingress paths
were dropped ("no regex path support"), but synapse supports regex
routing via match_expr. Render them as match_expr regex routes instead:

- routeCfg.matchExpr + annSettings.useRegex; addRegexRoute() keyed by the
  regex (first-writer-wins), match_expr = http.request.path matches "<re>"
- emit match_expr in both the v1 and v2 upstreams schemas
- rulePaths returns prefixes + regexes; HTTPRoute RegularExpression and
  Ingress paths under nginx.ingress.kubernetes.io/use-regex now produce
  regex routes (primary host + server-aliases)

Tests: TestRulePaths updated; new TestRegexRouteRender covers v1+v2.
An Ingress/HTTPRoute path regex matches from the beginning of the request
path (nginx use-regex / Gateway semantics); k8s also requires the stored
Ingress path to begin with "/", so the leading ^ is supplied by the
renderer. Prevents an unanchored match (e.g. /x/api/runs/1/stream).
Add a Path matching section (Prefix/Exact/RegularExpression/use-regex →
match_expr, ^-anchored) and the --upstreams-out-configmap /
--resolve-backend-cluster-ips ingress-mode flags.
@pigri pigri merged commit 57e8495 into main Jun 21, 2026
6 checks passed
@pigri pigri deleted the feat/ingress-regex-routes branch June 21, 2026 20:45
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