Heimdall overview
Heimdall is a bounded, durable delivery path from event producers to Kafka. It owns HTTP admission, JetStream buffering, Kafka production, retry and DLQ behavior, and the operational APIs used to inspect the pipeline.
Architecture
Edge
The edge is the only Heimdall process that receives a player bearer token. The prepared dev contract targets http://spark-dev1-quasar-svc.core-spark-test1.svc.cluster.local/getPlayer; the production player-api-svc contract remains disabled and unverified. The edge:
- maps the exact browser
Originto trusted tenant, site, and player-validation configuration - accepts
X-Heimdall-Client-IPonly from configured trusted proxy CIDRs - applies Redis-backed request and validation limits
- resolves the logged player with a bearer-authenticated
GETwhose JSON body contains the trusted positive-decimalsite_idand canonical clientip - treats configured
4xxstatuses as definitive invalid-player results; the default401,403,422contract includes Quasar's422 - caches a successful player resolution for five minutes
- validates and sanitizes the event body
- overwrites tenant, site, and player identity with trusted values
- forwards the envelope to the private ingest listener without an application token
Dev1 uses one dedicated HTTPS Ingress hostname, not one Heimdall route per frontend host. Verified frontend origins remain exact CORS and trusted tenant/site/player-validation mappings. Generic frontend defaults and all production environments remain disabled.
Ingest
Ingest exposes two isolated listeners:
POST /v1/eventson the public listener for existing service producers, protected by the existing ingest bearer when authentication is enabledPOST /internal/v1/eventson private port8082for the edge, without application authentication
The listeners have separate in-flight budgets. Browser traffic cannot consume the public service-producer budget. Both publish to the same JetStream stream and share readiness state.
Worker
The worker pulls from the JetStream WorkQueue and publishes to Kafka. Failed deliveries are retried, then moved to the DLQ according to the existing worker policy. A message is not acknowledged when the DLQ write fails.
Admin API
The admin API is off the ingest hot path. It provides health and readiness, queue state, Kafka watermarks, live tail, statistics, routing inspection, DLQ reads, and explicit DLQ reprocessing.
HTTP interfaces
| Interface | Authentication | Intended caller |
|---|---|---|
POST /api/heimdall/events | Existing player bearer | online-services-front for logged players |
POST /v1/events | Existing Heimdall ingest bearer | Trusted service producers |
POST /internal/v1/events | No application token | Edge pods through the private Service |
/admin/v1/* | Separate admin bearer | Dashboard and operators |
The public ingest and admin credentials are separate. Neither credential belongs in the browser or edge deployment.
Delivery and trust boundaries
- A
202 Acceptedresponse means JetStream acknowledged the durable publish. It does not mean Kafka has already accepted the event. - The browser event UUID becomes the envelope event ID and remains stable across frontend retries.
- The browser cannot choose
source,event_type, tenant, site, or player identity. - The edge fixes the source to
online-services-front. It assignsui.analytics.v1to ordinary analytics andplayer.casino-presence.v1only to the allowlistedcasino_presenceclassification. - The trusted client IP is sent only to the player-validation backend. It is not logged, stored as a raw value, or copied into the event sent to ingest and Kafka.
- Session ID is the Kafka partition key for ordinary browser analytics. Casino presence uses a stable hash of trusted tenant, site, and player identity.
- The edge-to-ingest listener is protected by Kubernetes network isolation, not an application token.
- Readiness includes the dependencies required by each process. For the edge, Redis and the internal ingest readiness endpoint must both be available.
Static routing
The worker falls back to heimdall.events.v1 for ordinary and unknown trusted
service event types. Casino presence is the first dedicated route:
| Trusted event type | Kafka topic | Partitioning |
|---|---|---|
ui.analytics.v1 | heimdall.events.v1 | Browser session ID |
player.casino-presence.v1 | heimdall.player-casino-presence.v1 | Trusted tenant + site + player hash |
GET /admin/v1/routing exposes this static table read-only. Adding or changing
a route remains a reviewed code change and deployment, not runtime state.
Read next
- Logged-player analytics for the frontend, CORS, player validation, retry, and privacy contracts.
- Deployment and operations for Helm values, NetworkPolicies, scaling, metrics, and local validation.