Commit 9f35cf6
committed
feat(api): per-route port overrides on NebariApp routes
Adds an optional Port field on RouteMatch so a single NebariApp can
route different path prefixes to different ports on the same backend
Service under one hostname. Routes without a per-route Port continue
to forward to spec.service.port, so all existing NebariApp manifests
behave identically.
A NebariApp still targets exactly one Service. Per-route backend
Services are intentionally not supported — packs that need to fan out
to multiple Services should split into multiple NebariApps.
Tightens the same-namespace contract by removing
ServiceReference.Namespace. The field was a half-feature: the operator
emitted a cross-namespace BackendObjectReference on the HTTPRoute, but
never created the Gateway API ReferenceGrant the gateway needs in the
target namespace, so traffic would silently fail. The new contract is
"the backend Service lives in the NebariApp's own namespace";
workloads that need cross-namespace communication should use
in-cluster DNS rather than the public HTTPRoute.
Reconciler changes:
- buildHTTPRouteRules now emits one HTTPRouteRule per RouteMatch when
routes are configured, each with its own resolved port (the route's
Port override if set, else spec.service.port). The "no routes" case
still emits a single rule with empty matches so Gateway API's "/"
default applies (unchanged behavior).
- buildPublicHTTPRoute applies the same shape so per-route ports
also work on routing.publicRoutes[].
- ValidateService looks up spec.service once and confirms every
effective port (spec.service.port plus each route override) is
exposed by the Service.
Design rationale: docs/design/multi-backend-routes.md. This PR
implements only the multi-port + namespace-removal portions of the
design; the streaming/BackendTrafficPolicy portion is a follow-up.1 parent 2d096ea commit 9f35cf6
8 files changed
Lines changed: 346 additions & 211 deletions
File tree
- api/v1
- config/crd/bases
- docs
- internal/controller/reconcilers
- core
- routing
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
28 | 36 | | |
29 | 37 | | |
30 | 38 | | |
31 | 39 | | |
32 | 40 | | |
33 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
34 | 45 | | |
35 | 46 | | |
36 | 47 | | |
| |||
63 | 74 | | |
64 | 75 | | |
65 | 76 | | |
66 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
67 | 83 | | |
68 | | - | |
| 84 | + | |
69 | 85 | | |
70 | 86 | | |
71 | 87 | | |
72 | 88 | | |
73 | | - | |
| 89 | + | |
| 90 | + | |
74 | 91 | | |
75 | 92 | | |
76 | 93 | | |
77 | 94 | | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | 95 | | |
87 | 96 | | |
88 | 97 | | |
| |||
125 | 134 | | |
126 | 135 | | |
127 | 136 | | |
128 | | - | |
| 137 | + | |
129 | 138 | | |
130 | 139 | | |
131 | 140 | | |
| |||
140 | 149 | | |
141 | 150 | | |
142 | 151 | | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
143 | 162 | | |
144 | 163 | | |
145 | 164 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
325 | 325 | | |
326 | 326 | | |
327 | 327 | | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
328 | 336 | | |
329 | 337 | | |
330 | 338 | | |
| |||
445 | 453 | | |
446 | 454 | | |
447 | 455 | | |
448 | | - | |
| 456 | + | |
449 | 457 | | |
450 | 458 | | |
451 | 459 | | |
| |||
461 | 469 | | |
462 | 470 | | |
463 | 471 | | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
464 | 483 | | |
465 | 484 | | |
466 | 485 | | |
| |||
477 | 496 | | |
478 | 497 | | |
479 | 498 | | |
480 | | - | |
| 499 | + | |
481 | 500 | | |
482 | 501 | | |
483 | 502 | | |
| |||
493 | 512 | | |
494 | 513 | | |
495 | 514 | | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
496 | 526 | | |
497 | 527 | | |
498 | 528 | | |
| |||
514 | 544 | | |
515 | 545 | | |
516 | 546 | | |
517 | | - | |
518 | | - | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
519 | 552 | | |
520 | 553 | | |
521 | 554 | | |
522 | | - | |
523 | | - | |
524 | | - | |
525 | | - | |
526 | | - | |
527 | | - | |
528 | | - | |
529 | | - | |
530 | | - | |
| 555 | + | |
531 | 556 | | |
532 | 557 | | |
533 | 558 | | |
534 | | - | |
535 | | - | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
536 | 562 | | |
537 | 563 | | |
538 | 564 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
235 | | - | |
236 | | - | |
| 235 | + | |
| 236 | + | |
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
| |||
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
290 | | - | |
| 290 | + | |
291 | 291 | | |
| 292 | + | |
292 | 293 | | |
293 | 294 | | |
294 | 295 | | |
| |||
373 | 374 | | |
374 | 375 | | |
375 | 376 | | |
376 | | - | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
377 | 383 | | |
378 | 384 | | |
379 | 385 | | |
380 | 386 | | |
381 | 387 | | |
382 | 388 | | |
383 | | - | |
384 | | - | |
385 | | - | |
| 389 | + | |
| 390 | + | |
386 | 391 | | |
387 | 392 | | |
388 | 393 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
119 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
120 | 123 | | |
121 | 124 | | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | 125 | | |
130 | 126 | | |
131 | | - | |
| 127 | + | |
132 | 128 | | |
133 | 129 | | |
134 | 130 | | |
135 | 131 | | |
136 | 132 | | |
137 | | - | |
| 133 | + | |
138 | 134 | | |
139 | 135 | | |
140 | 136 | | |
141 | 137 | | |
142 | | - | |
143 | | - | |
| 138 | + | |
144 | 139 | | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
| 140 | + | |
149 | 141 | | |
150 | 142 | | |
151 | | - | |
| 143 | + | |
152 | 144 | | |
153 | 145 | | |
154 | 146 | | |
155 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
156 | 171 | | |
157 | 172 | | |
0 commit comments