Files
dingoandClaude Opus 5.5 46c106409e
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (network) (push) Successful in 4s
Foundation / checks (postgres) (push) Successful in 4s
Foundation / checks (tsan) (push) Successful in 5s
Foundation / checks (deploy) (push) Successful in 4m33s
Foundation / postgres-tools (push) Successful in 2m14s
Foundation / server-image (push) Successful in 5m21s
Foundation / image (push) Successful in 6m18s
feat(admin): session windows in SQL, opened from the admin portal (schema 62)
The dev session window moves from Git to SQL (ADR-0087 amendment): the admin
portal opens, extends (30 min to 4 h from now) and closes it, and the cellular
region re-reads it every 5 s with --session-window-source db. No push, sync or
restart per window; a closed window keeps the region running instead of
crash-looping.

- Schema 62: append-only session_windows (4 h cap, no rewrites),
  load_session_window_v1 for the runtime group, admin_set_session_window_v1
  and admin_session_windows_v1 for a dedicated admin group role, granted and
  audited each migration run when EVO_PG_ADMIN_ROLE is set (aevolution_admin in
  DEV). Schema 61's views are revoked from the runtime group.
- RegionSessions admission switch: while closed every Hello is refused before
  signature work and closing closes open sessions (new sessions were still
  admitted after expiry before).
- Admin API: GET/POST /api/regions/<n>/session-window, window state in the
  regions list; the portal's session-window card with history.
- Git: REGION_SESSION_WINDOW and the pre-push refresh rule are removed; the
  policy check requires the database source and refuses a committed window.

Needs the new image and the aevolution_admin role (with the portal's login in
aevolution-admin-pg) before a sync.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 15:13:02 -04:00

155 lines
7.0 KiB
YAML

# M8.4 region host (ADR-0071). One replica, Recreate: a rolling update would start
# the new pod while the old one still holds the lease; the new pod could never become
# ready, so the old one would never be removed. Recreate drains the old pod (commits,
# releases the lease) before the new one starts and recovers. Readiness is /readyz
# (current lease + verified recovered head), liveness is /livez only. No CPU limit:
# throttling would delay lease renewals.
apiVersion: apps/v1
kind: Deployment
metadata:
name: evo-region
annotations:
argocd.argoproj.io/sync-wave: "1" # After migration and provisioning.
labels:
app.kubernetes.io/name: evo-region
app.kubernetes.io/component: region
spec:
replicas: 1
strategy:
type: Recreate
revisionHistoryLimit: 3
progressDeadlineSeconds: 180
selector:
matchLabels:
app.kubernetes.io/name: evo-region
template:
metadata:
labels:
app.kubernetes.io/name: evo-region
app.kubernetes.io/component: region
app.kubernetes.io/part-of: aevolution
spec:
serviceAccountName: aevolution-region
automountServiceAccountToken: false
nodeSelector:
aevolution.io/stores: "true"
# Longer than --drain-ms, so a graceful stop commits and releases the lease.
terminationGracePeriodSeconds: 45
securityContext:
runAsNonRoot: true
runAsUser: 10001
runAsGroup: 10001
fsGroup: 10001
seccompProfile: {type: RuntimeDefault}
containers:
- name: evo-server
image: aevolution-server
# Read the Secret-backed pgpass through stdin; no writable rootfs path or
# password environment variable is needed.
command: ["/bin/bash", "-c"]
args:
- |
set -eu
# Builds that wrote this region's history stay recoverable (ADR-0068).
retained=()
for build in $REGION_RETAINED; do retained+=(--retained "$build"); done
# Synthetic load is set only by tools/ops/fault-drill.sh (ADR-0073).
inputs=()
if [ -n "$REGION_INPUTS" ]; then inputs=(--synthetic-inputs "$REGION_INPUTS"); fi
# M10 QUIC dev sessions are loopback by default. Only the enabled
# dev-session-route component (ADR-0087) may bind the pod interface.
m10=()
grant=()
if [ -n "$REGION_SESSION" ]; then
m10=(--m10-listen "$REGION_SESSION_LISTEN" --m10-cert /run/session/server.pem
--m10-key /run/session/server.key --m10-issuer /run/session/issuer.pub
--m10-environment "$REGION_SESSION" --session-window-source db)
grant=(--m10-max-grant-lifetime "$REGION_M10_MAX_GRANT_LIFETIME")
fi
# Lineage keeps its 20 s drain. Both profiles take the overlay grant ceiling;
# the cellular profile (M11.3) fixes its own 10 s drain and needs the
# world's --life-route catalog, one entry per region.
profile=(--profile lineage "${grant[@]}" --drain-ms 20000)
if [ "$REGION_PROFILE" = cellular ]; then
profile=(--profile cellular "${grant[@]}")
for route in $REGION_LIFE_ROUTES; do profile+=(--life-route "$route"); done
fi
exec /usr/local/bin/evo-server "${profile[@]}" "${retained[@]}" "${inputs[@]}" \
"${m10[@]}" \
--world "$REGION_WORLD" --region "$REGION_ID" --frame "$REGION_FRAME" \
--pg-service /run/postgres/pg_service.conf --pg-passfile /run/postgres/pgpass \
--objects /objects --objects-reserve-mib "$REGION_RESERVE_MIB" \
--build "$REGION_BUILD" --lease-profile default \
--flush-ms 1000 --ops-listen 0.0.0.0:9100
env:
- {name: REGION_WORLD, value: set-by-overlay}
- {name: REGION_ID, value: set-by-overlay}
- {name: REGION_FRAME, value: "9"}
- {name: REGION_BUILD, value: set-by-overlay}
# lineage, or cellular (M11.3, needs a cellular-v1 genesis and REGION_LIFE_ROUTES:
# space-separated REGION=HOST:PORT=TLS_NAME, one per region including this one).
- {name: REGION_PROFILE, value: lineage}
- {name: REGION_LIFE_ROUTES, value: ""}
# Earlier builds whose commits this region may still hold, space-separated.
- {name: REGION_RETAINED, value: ""}
# Drill-only overrides; Git keeps no synthetic load and the 1024 MiB reserve.
- {name: REGION_INPUTS, value: ""}
- {name: REGION_RESERVE_MIB, value: "1024"}
# M10 drill-only: "dev" enables the QUIC session listener; Git keeps it empty.
- {name: REGION_SESSION, value: ""}
# Session listener address; the policy check allows only this loopback value
# outside region/dev-session-route.
- {name: REGION_SESSION_LISTEN, value: "127.0.0.1:7400"}
# DEV-only grant ceiling; overlays must keep this within the server contract.
- {name: REGION_M10_MAX_GRANT_LIFETIME, value: "300"}
ports:
- {name: ops, containerPort: 9100, protocol: TCP}
readinessProbe:
httpGet: {path: /readyz, port: ops}
periodSeconds: 2
timeoutSeconds: 1
failureThreshold: 1
livenessProbe:
httpGet: {path: /livez, port: ops}
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 2
failureThreshold: 3
resources:
requests: {cpu: 50m, memory: 64Mi}
limits: {memory: 256Mi}
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities: {drop: [ALL]}
volumeMounts:
- {name: objects, mountPath: /objects}
- {name: connection, mountPath: /run/postgres, readOnly: true}
- {name: session, mountPath: /run/session, readOnly: true}
- {name: scratch, mountPath: /tmp}
volumes:
- name: objects
persistentVolumeClaim:
claimName: aevolution-objects
- name: connection
secret:
secretName: evolution-postgres-runtime
defaultMode: 0440
items:
- {key: pg_service.conf, path: pg_service.conf}
- {key: pgpass, path: pgpass}
- {key: ca.crt, path: ca.crt}
- name: scratch
emptyDir: {medium: Memory, sizeLimit: 1Mi}
# Created out of band in evolution-dev only (docs/networking/DEV_SESSION_OPERATIONS.md).
# Optional: stage and World0 never have it, and the pod starts without it.
- name: session
secret:
secretName: evolution-dev-session
optional: true
defaultMode: 0440
items:
- {key: server.pem, path: server.pem}
- {key: server.key, path: server.key}
- {key: issuer.pub, path: issuer.pub}