Skip to content

Wire HTTPRoute defaults through web context#1063

Open
Bafbi wants to merge 1 commit intoInseeFrLab:mainfrom
Bafbi:feat/httproute-gateway-api-api
Open

Wire HTTPRoute defaults through web context#1063
Bafbi wants to merge 1 commit intoInseeFrLab:mainfrom
Bafbi:feat/httproute-gateway-api-api

Conversation

@Bafbi
Copy link
Contributor

@Bafbi Bafbi commented Mar 13, 2026

This pull request introduces support for exposing Onyxia using the Kubernetes Gateway API via HTTPRoute, alongside documentation and code changes to enable this new feature. The most important changes are grouped below by theme.

depend on #1061 , #InseeFrLab/onyxia-api#664
for #1062

Gateway API / HTTPRoute support

  • Added a new httproute.yaml Helm template to generate HTTPRoute resources when httpRoute.enabled is true, including validation of parentRefs and backend routing for API, web, and onboarding services.
  • Extended values.yaml to include a new httpRoute configuration section, allowing specification of enabled, annotations, parentRefs, and hostnames.

Documentation updates

  • Updated README.md with instructions and examples for configuring Onyxia with the Gateway API (HTTPRoute), including sample onyxia-values.yaml files and clear guidance on referencing cluster Gateways. [1] [2] [3]

API and context propagation

  • Added httpRoute fields to the Onyxia API types, deployment region, and context interfaces in the web codebase to propagate Gateway API configuration from backend to frontend and service deployment logic. [1] [2] [3] [4] [5]

Testing

  • Added a new test case to verify that computeHelmValues correctly supports httpRoute.parentRefs propagation from the x-onyxia context, ensuring that the new configuration is handled as expected.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added HTTP route configuration support for deployment regions with enable/disable control.
    • Introduced parent reference definitions allowing customization of namespace and port settings for deployments.
  • Tests

    • Added test coverage for HTTP route parent reference configuration derivation.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d4e7646b-a7fa-4ac0-8cad-208c256b053d

📥 Commits

Reviewing files that changed from the base of the PR and between 64453a3 and 86f8599.

📒 Files selected for processing (6)
  • web/src/core/adapters/onyxiaApi/ApiTypes.ts
  • web/src/core/adapters/onyxiaApi/onyxiaApi.ts
  • web/src/core/ports/OnyxiaApi/DeploymentRegion.ts
  • web/src/core/ports/OnyxiaApi/XOnyxia.ts
  • web/src/core/usecases/launcher/decoupledLogic/computeHelmValues.test.ts
  • web/src/core/usecases/launcher/thunks.ts
🚧 Files skipped from review as they are similar to previous changes (5)
  • web/src/core/usecases/launcher/decoupledLogic/computeHelmValues.test.ts
  • web/src/core/usecases/launcher/thunks.ts
  • web/src/core/adapters/onyxiaApi/onyxiaApi.ts
  • web/src/core/adapters/onyxiaApi/ApiTypes.ts
  • web/src/core/ports/OnyxiaApi/XOnyxia.ts

📝 Walkthrough

Walkthrough

The pull request introduces a new optional httpRoute configuration property across the API type layer, deployment model, context, and integration points. The property encapsulates ingress routing settings with an enabled flag and parent references, propagating from API responses through to Kubernetes context for helm value computation.

Changes

Cohort / File(s) Summary
Type Definitions
web/src/core/adapters/onyxiaApi/ApiTypes.ts, web/src/core/ports/OnyxiaApi/DeploymentRegion.ts, web/src/core/ports/OnyxiaApi/XOnyxia.ts
Added optional httpRoute property to type definitions across API, deployment region, and context layers. Structure includes enabled: boolean and parentRefs array with name, namespace, sectionName, and port fields.
Adapter & Integration
web/src/core/adapters/onyxiaApi/onyxiaApi.ts, web/src/core/usecases/launcher/thunks.ts
Implemented mappings to wire httpRoute from API region data through the DeploymentRegion into XOnyxiaContext for downstream consumption.
Test Coverage
web/src/core/usecases/launcher/decoupledLogic/computeHelmValues.test.ts
Added test cases validating that httpRoute.parentRefs propagates correctly through context overrides into helm values.

Sequence Diagram

sequenceDiagram
    actor API as Onyxia API
    participant Adapter as onyxiaApi Adapter
    participant Region as DeploymentRegion
    participant Context as XOnyxiaContext
    participant Helm as Helm Values

    API->>Adapter: /public/configuration with httpRoute
    Adapter->>Region: Map apiRegion.services.expose.httpRoute
    Region->>Context: Region.httpRoute → k8s.httpRoute
    Context->>Helm: Override defaults with k8s.httpRoute
    Helm->>Helm: Generate helmValues.httpRoute.parentRefs
Loading

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 ✨ A new route hops into view,
Through types and maps, the data flows true,
Parent refs find their way with care,
From API to Helm, everywhere!
The config now routes with fresh delight,
This little bunny sees it's just right!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Wire HTTPRoute defaults through web context' clearly and specifically describes the main change: propagating HTTPRoute configuration from API through the web context to deployment logic.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
web/src/core/ports/OnyxiaApi/DeploymentRegion.ts (1)

14-24: Consider extracting a shared HttpRouteParentRef/HttpRouteConfig type.

Line 14 introduces a shape that is duplicated across API, deployment-region, and context types. Centralizing it would reduce type drift risk.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/src/core/ports/OnyxiaApi/DeploymentRegion.ts` around lines 14 - 24,
Extract a shared type for the HTTP route shape and replace duplicated inline
definitions: create and export a HttpRouteParentRef (with fields name,
namespace?, sectionName?, port?) and a HttpRouteConfig (with enabled: boolean
and parentRefs: HttpRouteParentRef[]) and then update the existing httpRoute
property in DeploymentRegion (and the corresponding API and context types) to
use HttpRouteConfig | undefined instead of the inline object to prevent type
drift and ensure reuse.
helm-chart/templates/httproute.yaml (1)

6-8: Add explicit required checks for service ports to fail fast with clearer errors.

Right now port lookups rely on implicit value presence. Adding required(...) here makes misconfiguration errors immediate and actionable during rendering.

♻️ Proposed refactor
-{{- $svcPortApi := .Values.api.service.port -}}
-{{- $svcPortWeb := .Values.web.service.port -}}
-{{- $svcPortOnboarding := .Values.onboarding.service.port -}}
+{{- $svcPortApi := required "api.service.port is required when httpRoute.enabled=true" .Values.api.service.port -}}
+{{- $svcPortWeb := required "web.service.port is required when httpRoute.enabled=true" .Values.web.service.port -}}
+{{- $svcPortOnboarding := .Values.onboarding.service.port -}}
@@
-          port: {{ $svcPortOnboarding }}
+          port: {{ required "onboarding.service.port is required when onboarding.enabled=true and httpRoute.enabled=true" $svcPortOnboarding }}

Also applies to: 52-52

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@helm-chart/templates/httproute.yaml` around lines 6 - 8, Replace implicit
port lookups with Helm's required(...) wrapper so rendering fails fast with a
clear message; specifically update the variable assignments for $svcPortApi,
$svcPortWeb, and $svcPortOnboarding to use required("missing service port for
api|web|onboarding", .Values.api.service.port) (and analogous messages for web
and onboarding) and apply the same required(...) check to the other port usage
referenced around the second occurrence (the one at the other port lookup on
line ~52). Ensure each required call uses a distinct, descriptive message
mentioning the service name.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@helm-chart/templates/httproute.yaml`:
- Around line 6-8: Replace implicit port lookups with Helm's required(...)
wrapper so rendering fails fast with a clear message; specifically update the
variable assignments for $svcPortApi, $svcPortWeb, and $svcPortOnboarding to use
required("missing service port for api|web|onboarding",
.Values.api.service.port) (and analogous messages for web and onboarding) and
apply the same required(...) check to the other port usage referenced around the
second occurrence (the one at the other port lookup on line ~52). Ensure each
required call uses a distinct, descriptive message mentioning the service name.

In `@web/src/core/ports/OnyxiaApi/DeploymentRegion.ts`:
- Around line 14-24: Extract a shared type for the HTTP route shape and replace
duplicated inline definitions: create and export a HttpRouteParentRef (with
fields name, namespace?, sectionName?, port?) and a HttpRouteConfig (with
enabled: boolean and parentRefs: HttpRouteParentRef[]) and then update the
existing httpRoute property in DeploymentRegion (and the corresponding API and
context types) to use HttpRouteConfig | undefined instead of the inline object
to prevent type drift and ensure reuse.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a34e51fc-3827-4601-bdd1-b1053c2ba3a7

📥 Commits

Reviewing files that changed from the base of the PR and between a1815d3 and 64453a3.

📒 Files selected for processing (9)
  • helm-chart/README.md
  • helm-chart/templates/httproute.yaml
  • helm-chart/values.yaml
  • web/src/core/adapters/onyxiaApi/ApiTypes.ts
  • web/src/core/adapters/onyxiaApi/onyxiaApi.ts
  • web/src/core/ports/OnyxiaApi/DeploymentRegion.ts
  • web/src/core/ports/OnyxiaApi/XOnyxia.ts
  • web/src/core/usecases/launcher/decoupledLogic/computeHelmValues.test.ts
  • web/src/core/usecases/launcher/thunks.ts

@Bafbi Bafbi changed the title Feat/httproute gateway api api Wire HTTPRoute defaults through web context Mar 13, 2026
@olevitt
Copy link
Contributor

olevitt commented Mar 13, 2026

@Bafbi Thanks for these nice batch of PR 😍
Now that #1061 has been merged, could you rebase this one ? Or, if you prefer, allow Onyxia's maintainers to contribute to your branch (IIRC, it's a checkbox to be selected in the PR page) so that we can do it ?

@Bafbi Bafbi force-pushed the feat/httproute-gateway-api-api branch from 64453a3 to 86f8599 Compare March 13, 2026 12:03
@sonarqubecloud
Copy link

@Bafbi
Copy link
Contributor Author

Bafbi commented Mar 13, 2026

@Bafbi Thanks for these nice batch of PR 😍 Now that #1061 has been merged, could you rebase this one ? Or, if you prefer, allow Onyxia's maintainers to contribute to your branch (IIRC, it's a checkbox to be selected in the PR page) so that we can do it ?

No worries, I rebased my branch, also the checkbox was already mark as allowing edits.

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.

2 participants