# ADR-0131 grant broker. One replica: serials are ordered by the database, but the # per-account rate limit lives in the process. The realm's public signing key is # pinned below (BROKER_JWKS); a Keycloak key rotation needs a Git update here. apiVersion: apps/v1 kind: Deployment metadata: name: evo-grant-broker annotations: argocd.argoproj.io/sync-wave: "2" # After migration (schema v39). labels: app.kubernetes.io/name: evo-grant-broker app.kubernetes.io/component: grant-broker spec: replicas: 1 revisionHistoryLimit: 3 progressDeadlineSeconds: 180 selector: matchLabels: app.kubernetes.io/name: evo-grant-broker template: metadata: labels: app.kubernetes.io/name: evo-grant-broker app.kubernetes.io/component: grant-broker app.kubernetes.io/part-of: aevolution spec: serviceAccountName: aevolution-grant-broker automountServiceAccountToken: false terminationGracePeriodSeconds: 10 securityContext: runAsNonRoot: true runAsUser: 10001 runAsGroup: 10001 fsGroup: 10001 seccompProfile: {type: RuntimeDefault} containers: - name: evo-grant-broker image: aevolution-server command: ["/bin/bash", "-c"] args: - | set -eu routes=() for route in $BROKER_ROUTES; do routes+=(--route "$route"); done exec /usr/local/bin/evo-grant-broker --listen 0.0.0.0:8080 --world "$BROKER_WORLD" --frame "$BROKER_FRAME" --default-region "$BROKER_DEFAULT_REGION" "${routes[@]}" --issuer-key /run/grant-issuer/issuer.key --jwks "$BROKER_JWKS" --oidc-issuer "$BROKER_OIDC_ISSUER" --audience aevolution-grants --client aevolution-game --grant-lifetime "$BROKER_GRANT_LIFETIME" --pg-service /run/postgres/pg_service.conf --pg-passfile /run/postgres/pgpass env: - {name: BROKER_WORLD, value: "100"} - {name: BROKER_FRAME, value: "9"} # New accounts start here; an account with a live life goes to its region. - {name: BROKER_DEFAULT_REGION, value: "14"} # Space-separated REGION=HOST:PORT=TLS_NAME, every region a grant may name. - {name: BROKER_ROUTES, value: "14=void.aeternalisgames.com:7400=void.aeternalisgames.com"} # Must not exceed the region's REGION_M10_MAX_GRANT_LIFETIME. - {name: BROKER_GRANT_LIFETIME, value: "600"} - {name: BROKER_OIDC_ISSUER, value: "https://auth.aeternalisgames.com/realms/aeternalis"} # Public RS256 signing key(s) of realm aeternalis, from its JWKS endpoint. - name: BROKER_JWKS value: '{"keys":[{"alg":"RS256","e":"AQAB","kid":"NGQG4QzQuBCIHVEomUPy-OoWOTVQIuyf3RXqeNbP8JI","kty":"RSA","n":"vvOpu1xxdyH_mB8LkJG6cwc6UVmmAj6mwQi1oEwrpJDLerBI2OZr2kpgMAUJ3-hMIkz5tRtSjHieMFteVrpDDQaCViIPCIvJTL3T7ujTGFNReSE6ho7h0DB_kybFeEWVpLqm6SSXWFYls5TKo6_t8Hw4G3njiRW9pX_NxyaBHqLkrCi63EyIGHOkdgUczg2d4pM4JTt-q25bcFSlYz8bhD3WEORQmbp-bU7aPPluCqCEAZRrbzf8Iy7svNemP5daDdlWQ3LaNy-ixC2HRjiPZdqK5BgAE800BigI-l1dkyJ4X172TLIPVPLW1WKlvdm3kHOpBXwACYiy8boSNDW7gQ","use":"sig"}]}' ports: - {name: http, containerPort: 8080, protocol: TCP} readinessProbe: httpGet: {path: /healthz, port: http} periodSeconds: 5 timeoutSeconds: 1 livenessProbe: httpGet: {path: /healthz, port: http} initialDelaySeconds: 5 periodSeconds: 10 timeoutSeconds: 2 failureThreshold: 3 resources: requests: {cpu: 10m, memory: 16Mi} limits: {memory: 64Mi} securityContext: allowPrivilegeEscalation: false readOnlyRootFilesystem: true capabilities: {drop: [ALL]} volumeMounts: - {name: connection, mountPath: /run/postgres, readOnly: true} - {name: issuer, mountPath: /run/grant-issuer, readOnly: true} volumes: - name: connection secret: secretName: aevolution-grant-broker-pg defaultMode: 0440 items: - {key: pg_service.conf, path: pg_service.conf} - {key: pgpass, path: pgpass} - {key: ca.crt, path: ca.crt} - name: issuer secret: secretName: aevolution-grant-issuer defaultMode: 0440 items: - {key: issuer.key, path: issuer.key}