- TLS: replace send() with a bounded queue/flush; an interrupted record is retried with identical arguments and later frames wait behind it, so no queued frame is lost or reordered; close() flushes first. - Carriers: server-issued 'I','N' | 48-bit epoch | 64-bit ordinal ids replace the aliasing low-32-bit packing; client sequences are kept separately for replies; out-of-range epochs are refused, never truncated. - Grants: a durable, fsynced, fail-closed consumed-grant ledger (--session-grant-ledger, /objects/dev-session-grants.v1 in dev) keeps single-use grants consumed across process and pod restarts. - Liveness: protocol v1 (undeployed) gains Heartbeat and the timeout close reason; both sides heartbeat when idle and treat 5 s of silence as dead. - Client sends are bounded and unresolved tracking starts at send time. - ci-client configures with an explicit C compiler. Each finding has a regression test; ADR-0083, the schema, operations doc and VALIDATION record the corrections. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
142 lines
6.2 KiB
YAML
142 lines
6.2 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
|
|
# libpq ignores group-readable password files: copy to private memory, then
|
|
# exec so evo-server is PID 1 and receives SIGTERM directly.
|
|
command: ["/bin/bash", "-c"]
|
|
args:
|
|
- |
|
|
set -eu
|
|
umask 077
|
|
cp /run/postgres/pgpass /tmp/pgpass
|
|
# 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
|
|
# Dev sessions are a drill-time override too (tools/ops/session-drill.sh,
|
|
# ADR-0083): loopback only, reached by kubectl port-forward, never a Service.
|
|
# evo-server refuses any environment but dev and needs the synthetic carrier.
|
|
# Consumed grants persist on the objects volume (outside the object
|
|
# namespaces, ignored by backups) so a restarted pod refuses them.
|
|
sessions=()
|
|
if [ -n "$REGION_SESSION" ]; then
|
|
sessions=(--session-listen 127.0.0.1:7400 --session-cert /run/session/server.pem
|
|
--session-key /run/session/server.key --session-grant-key /run/session/grant.key
|
|
--session-grant-ledger /objects/dev-session-grants.v1
|
|
--session-environment "$REGION_SESSION")
|
|
fi
|
|
exec /usr/local/bin/evo-server --profile lineage "${retained[@]}" "${inputs[@]}" \
|
|
"${sessions[@]}" \
|
|
--world "$REGION_WORLD" --region "$REGION_ID" --frame "$REGION_FRAME" \
|
|
--pg-service /run/postgres/pg_service.conf --pg-passfile /tmp/pgpass \
|
|
--objects /objects --objects-reserve-mib "$REGION_RESERVE_MIB" \
|
|
--build "$REGION_BUILD" --lease-profile default \
|
|
--flush-ms 1000 --drain-ms 20000 --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}
|
|
# 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"}
|
|
# M9.7 drill-only: "dev" enables the session listener; Git keeps it empty.
|
|
- {name: REGION_SESSION, value: ""}
|
|
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: grant.key, path: grant.key}
|