1 control plane route policy and coordination api
forgejo-actions edited this page 2026-07-11 12:38:13 +00:00

Control-Plane Route Policy And Coordination API

The control plane has an explicit route identity matrix. A valid signature is required, but the route still decides which internal service identity may call it.

Purpose

Use this page when adding a control-plane route, debugging 403 or internal auth failures, or deciding whether login, game, or control panel should call a coordination endpoint.

Route Identity Matrix

Monitor reads are control-panel only. Instance reads allow login server and control panel. Public protected writes such as instance upsert/delete and allocator requests are control-panel only. Internal coordination routes allow login server and game server. Internal Redis admin cleanup is login-server only.

Unknown protected routes map to the deny policy even if the request is signed.

Public Protected Routes

Protected non-internal routes include /v1/instances, /v1/allocator/game, /v1/allocator/zone-transfer, /v1/instances/{service}/{instance_id}, and /v1/presence. These are still signed internal-service calls, but they are intended for operator/control-panel flows or controlled login reads.

Do not expose a route publicly just because it is useful to a service. If it mutates coordination state, prefer the internal coordination namespace.

Internal Coordination Routes

Internal routes live under /v1/internal/coordination. They cover instance registration, deregistration, game assignment, zone-transfer assignment, handoff prepare/preflight/consume/redirect, and transfer activation confirmation/status.

Login and game server helper clients build URLs through internal_coordination_url and sign requests with their service identity.

RPC Version Guard

Coordination request types carry version, defaulting to the current internal RPC version. API handlers call validate_internal_rpc_request_version; unsupported future versions map to 400 Bad Request.

When adding a request type, include the version field and use the same validation path before mutating state.

Status And Failure Mapping

Allocation misses return 503 Service Unavailable. Unsupported internal RPC version returns 400. Disallowed identities fail before route mutation. Nonce replay or signature errors fail in internal auth middleware.

Debug status codes before debugging business logic; many failures intentionally never reach the handler.

Client Helper URL Construction

Login server, game server, and control panel should use shared URL helpers from aether_net::control_plane. This avoids accidental /v1/internal/coordination drift and keeps signed canonical requests stable.

Change Checklist For New Routes

Add the route, add an identity policy entry, add request/response types with version fields, use shared URL helpers, add middleware/handler tests, and document the intended caller. If a route needs a new service identity, update signing config and nonce replay expectations together.