Merge control portal work from RPGTheory/aeternalis-portal
RPGTheory/aeternalis-portal had diverged from this repo (the git/CI/CD copy) with an in-progress control portal feature that was never synced back here, so none of it had gone through CI or been deployed: - New site/game/control routing split: index.html becomes a world directory landing page (site.ts), game.html is the renamed former index.html (main.ts), control.html is a new admin panel (control.ts, portal-shared.ts, portal.css). - Server: new internal/store/portal.go (character/world registry, command queue, admin grants) and internal/transport/control.go (portal API routes), plus a new internal/gitops package that lets the portal provision new worlds via a GitOps repo commit. - game.World gains BornAt/DiedAt/DeathReason and an operator Control() path (close/open admissions, awaken boss, end world, per-character rename/heal/unstuck/retire); death no longer reuses the same character id on rejoin, matching the "new life" permadeath model in Plan.md rather than the old bypass-prevention test's expectations. - deploy/: new control-egress network policy and portal/control values (admin role, GitOps repo/branch/values file/CIDRs). - New e2e coverage: tests/portal.spec.ts, tools/capture-world.mjs. Verified this repo's own independent commits (800ms movement-staleness window, 20s boss-attack poll, SRS/TLS deploy values, ubuntu-22.04 runner pin, DOCKER_HOST fix) were already present in the portal copy before merging, so nothing here regresses them. `tsc --noEmit`, the vite client build, and the protocol contract check all pass; no go.mod changes. Could not run `go build`/`go test` locally (no Go toolchain on PATH, Docker daemon not running) — every new/changed Go symbol was manually cross-referenced and resolves, but this should still be built and tested in CI before merging to master. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
{{- if and .Values.networkPolicy.enabled .Values.control.existingSecret }}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: NetworkPolicy
|
||||
metadata:
|
||||
name: {{ .Release.Name }}-control-gitops
|
||||
spec:
|
||||
podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/instance: {{ .Release.Name | quote }}
|
||||
aeternalis.world: {{ .Values.portal.primaryWorld | quote }}
|
||||
policyTypes: [Egress]
|
||||
egress:
|
||||
{{- range .Values.control.gitopsCIDRs }}
|
||||
- to: [{ ipBlock: { cidr: {{ . | quote }} } }]
|
||||
ports: [{ protocol: TCP, port: 443 }]
|
||||
{{- else }}
|
||||
[]
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -1,9 +1,16 @@
|
||||
{{- $root := . -}}
|
||||
{{- $directory := list -}}
|
||||
{{- $ids := dict -}}
|
||||
{{- range .Values.worlds -}}
|
||||
{{- $directory = append $directory (dict "id" .id "url" (printf "https://%s" .host)) -}}
|
||||
{{- if hasKey $ids .id -}}{{- fail "world IDs must be unique" -}}{{- end -}}
|
||||
{{- $_ := set $ids .id true -}}
|
||||
{{- $host := default .host $root.Values.portal.host -}}
|
||||
{{- $directory = append $directory (dict "id" .id "url" (printf "https://%s/game?world=%s" $host .id)) -}}
|
||||
{{- end -}}
|
||||
{{- if and .Values.portal.host (not (hasKey $ids .Values.portal.primaryWorld)) -}}{{- fail "portal.primaryWorld must exist in worlds" -}}{{- end -}}
|
||||
{{- range .Values.worlds }}
|
||||
{{- $host := default .host $root.Values.portal.host -}}
|
||||
{{- $primary := eq .id $root.Values.portal.primaryWorld -}}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
@@ -54,10 +61,20 @@ spec:
|
||||
- { name: LISTEN_ADDR, value: "0.0.0.0:8080" }
|
||||
- { name: WORLD_ID, value: {{ .id | quote }} }
|
||||
- { name: WORLD_SEED, value: {{ .seed | quote }} }
|
||||
- { name: PUBLIC_URL, value: {{ printf "https://%s" .host | quote }} }
|
||||
- { name: PUBLIC_URL, value: {{ printf "https://%s" $host | quote }} }
|
||||
- { name: WORLD_DIRECTORY, value: {{ $directory | toJson | quote }} }
|
||||
- { name: OIDC_ADMIN_ROLE, value: {{ $root.Values.control.adminRole | quote }} }
|
||||
- { name: CONTROL_PRIMARY, value: {{ $primary | quote }} }
|
||||
{{- if and $primary $root.Values.control.existingSecret }}
|
||||
- { name: CONTROL_GITOPS_REPOSITORY, value: {{ $root.Values.control.gitopsRepository | quote }} }
|
||||
- { name: CONTROL_GITOPS_BRANCH, value: {{ $root.Values.control.gitopsBranch | quote }} }
|
||||
- { name: CONTROL_GITOPS_VALUES_FILE, value: {{ $root.Values.control.gitopsValuesFile | quote }} }
|
||||
{{- end }}
|
||||
envFrom:
|
||||
- secretRef: { name: {{ $root.Values.existingSecret | quote }} }
|
||||
{{- if and $primary $root.Values.control.existingSecret }}
|
||||
- secretRef: { name: {{ $root.Values.control.existingSecret | quote }} }
|
||||
{{- end }}
|
||||
resources: {{ $root.Values.resources | toJson }}
|
||||
startupProbe: { httpGet: { path: /readyz, port: http }, periodSeconds: 5, failureThreshold: 24 }
|
||||
readinessProbe: { httpGet: { path: /readyz, port: http }, periodSeconds: 3, failureThreshold: 2 }
|
||||
@@ -76,7 +93,7 @@ kind: Ingress
|
||||
metadata:
|
||||
name: {{ $root.Release.Name }}-{{ .id }}
|
||||
annotations:
|
||||
{{- if $root.Values.ingress.clusterIssuer }}
|
||||
{{- if and $root.Values.ingress.clusterIssuer (or $primary (not $root.Values.portal.host)) }}
|
||||
cert-manager.io/cluster-issuer: {{ $root.Values.ingress.clusterIssuer | quote }}
|
||||
{{- end }}
|
||||
nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
|
||||
@@ -86,13 +103,19 @@ metadata:
|
||||
nginx.ingress.kubernetes.io/ssl-redirect: "true"
|
||||
spec:
|
||||
ingressClassName: {{ $root.Values.ingress.className | quote }}
|
||||
tls: [{ hosts: [{{ .host | quote }}], secretName: {{ $root.Values.ingress.tlsSecret | quote }} }]
|
||||
tls: [{ hosts: [{{ $host | quote }}], secretName: {{ $root.Values.ingress.tlsSecret | quote }} }]
|
||||
rules:
|
||||
- host: {{ .host | quote }}
|
||||
- host: {{ $host | quote }}
|
||||
http:
|
||||
paths:
|
||||
- path: {{ printf "/worlds/%s" .id }}
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service: { name: {{ $root.Release.Name }}-{{ .id }}, port: { name: http } }
|
||||
{{- if or $primary (not $root.Values.portal.host) }}
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service: { name: {{ $root.Release.Name }}-{{ .id }}, port: { name: http } }
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
"type": "object",
|
||||
"required": ["worlds", "existingSecret", "image"],
|
||||
"properties": {
|
||||
"portal": {"type":"object","required":["host","primaryWorld"],"properties":{"host":{"type":"string","pattern":"^([a-zA-Z0-9.-]+)?$"},"primaryWorld":{"type":"string","pattern":"^[a-z][a-z0-9-]{0,30}$"}}},
|
||||
"control": {"type":"object","required":["adminRole","existingSecret","gitopsCIDRs"],"properties":{"adminRole":{"type":"string","minLength":1},"existingSecret":{"type":"string"},"gitopsRepository":{"type":"string"},"gitopsBranch":{"type":"string"},"gitopsValuesFile":{"type":"string"},"gitopsCIDRs":{"type":"array","items":{"type":"string"}}}},
|
||||
"worlds": {"type": "array", "minItems": 1, "items": {"type": "object", "required": ["id", "seed", "host"], "properties": {"id": {"type": "string", "pattern": "^[a-z][a-z0-9-]{0,30}$"}, "seed": {"type": "string", "pattern": "^[0-9]{1,15}$"}, "host": {"type": "string", "minLength": 1}}}},
|
||||
"existingSecret": {"type": "string", "minLength": 1},
|
||||
"image": {"type": "object", "required": ["repository", "tag", "digest"], "properties": {"repository": {"type": "string", "minLength": 1}, "tag": {"type": "string", "minLength": 1}, "digest": {"type": "string", "pattern": "^(sha256:[a-f0-9]{64})?$"}}}
|
||||
|
||||
@@ -5,6 +5,16 @@ image:
|
||||
imagePullSecrets:
|
||||
- name: harbor-pull
|
||||
existingSecret: aeternalis-runtime
|
||||
portal:
|
||||
host: ""
|
||||
primaryWorld: world-001
|
||||
control:
|
||||
adminRole: aeternalis-admin
|
||||
existingSecret: ""
|
||||
gitopsRepository: ""
|
||||
gitopsBranch: master
|
||||
gitopsValuesFile: deploy/values-srs.yaml
|
||||
gitopsCIDRs: []
|
||||
databaseCA:
|
||||
configMap: ""
|
||||
externalDatabase:
|
||||
|
||||
@@ -6,6 +6,17 @@ image:
|
||||
imagePullSecrets:
|
||||
- name: harbor-pull
|
||||
existingSecret: aeternalis-runtime
|
||||
portal:
|
||||
host: srs.aeternalisgames.com
|
||||
primaryWorld: world-001
|
||||
control:
|
||||
adminRole: aeternalis-admin
|
||||
# Set existingSecret and gitopsCIDRs after provisioning a scoped GitOps token.
|
||||
existingSecret: ""
|
||||
gitopsRepository: https://git.aeternalisgames.com/Stone/aeternalis.git
|
||||
gitopsBranch: master
|
||||
gitopsValuesFile: deploy/values-srs.yaml
|
||||
gitopsCIDRs: []
|
||||
databaseCA:
|
||||
configMap: postgres-ca
|
||||
externalDatabase:
|
||||
|
||||
Reference in New Issue
Block a user