Unkey

Routing Service

Atomic frontline route and sentinel configuration management

Routing Service

The RoutingService manages atomic frontline route assignments.

Location: go/apps/ctrl/workflows/routing/ Proto: go/proto/hydra/v1/routing.proto Key: project_id

Why Separate Service?

Frontline route and sentinel operations are the critical section of deployments:

  • Must be atomic - both succeed or both fail
  • Must be serialized per project to prevent race conditions
  • Should not block non-routing operations (like building containers)

By separating routing, we:

  • Allow multiple deployments to build in parallel
  • Serialize only the sensitive routing mutations
  • Provide clear boundaries for concurrency control

Operations

AssignFrontlineRoutes

flowchart TD Start([AssignFrontlineRoutes]) --> LoopRoutes{For Each Route} LoopRoutes --> FindRoute[Find or Create Frontline Route] FindRoute --> NextRoute NextRoute --> LoopRoutes LoopRoutes --> UpdateDeployment[Update Deployment ID] UpdateDeployment --> End([Return Success]) style UpdateDeployment fill:#e1f5fe

Creates or reassigns frontline routes to a deployment:

  1. For each frontline route ID: update the deployment ID
  2. Routes are pre-created with hostnames and sticky behavior
  3. This operation simply points them to the new deployment
  4. Per-tenant sentinels handle the actual traffic routing

Implementation: go/apps/ctrl/workflows/routing/assign_frontline_routes_handler.go

Frontline Route Sticky Levels:

  • BRANCH: Branch-level (e.g., main.domain.com)
  • ENVIRONMENT: Environment-level (e.g., staging.domain.com)
  • LIVE: Production domain (e.g., domain.com)

Per-Tenant Sentinel Architecture

With the new per-tenant sentinel model:

  1. Each environment has its own sentinel instances
  2. Frontline routes point to deployments within an environment
  3. Sentinel configuration is managed at the environment level
  4. This provides better isolation and scaling characteristics

Local Domain Filtering

Hostnames with .local or .test TLDs, or localhost/127.0.0.1 are typically excluded from production routing since they're for local development only.

On this page