| Preflight API surge | constant 100m | **derived from the values the release deploys** (390m); fallback constant 390m | `scripts/release_headroom_preflight.py` |
Reasons:
- API: 7d p95 258m sits above the 250m request and the 975m peak comes from
release and migration bursts. The review sets 390m (p95 x1.5, rounded up)
as an override and leaves the limit unchanged. The budget row
`state-hub/railiance-apps` reads "260→390" for two pods. That row adds the
MCP 10m into the current figure but not into the proposed one. This change
sets the API to 390m and keeps MCP at 10m, so the workload goes 260m→400m
(+140m) and the review's node budget is 10m short. The 258.5m p95 is the
workload figure. MCP p95 is about 2m, so the API's own p95 is about 256m and
the result rounds to 390m either way.
- DB: the pod had no requests. 7d CPU p95 is 36.7m and peak 133.2m, so
max(50m DB floor, p95 x1.5 = 55m, peak x0.5 = 67m) gives 70m. The memory
working set p95 is 349Mi, x1.15 gives 416Mi. shared_buffers is the CNPG
default (no override in the Cluster spec). The 416Mi figure is a request
only and lowers nothing.
- Preflight: STATE-WP-0091 modelled a 100m API surge (revision 63). The live
API pod has requested 250m since 2026-09-21. With maxSurge=1 and
maxUnavailable=0 the surge pod carries the request of the release being
deployed. The preflight now reads that request from the chart values merged
with the production values (`--values` is repeatable in Helm `-f` order, and
`--release` JSON still overrides). It also reads the live API request and
reports `remaining_after_rollout_cpu_m`. When the release changes the request
it notes the steady remainder, and it notes when the next release would be
refused. A test keeps the fallback constants equal to the shipped values.
## Required ordering (node has 395m unrequested)
Before this change the node had 4000m allocatable and 3605m requested, which
leaves 395m. The API change needs a **390m surge pod** while the old 250m pod
is still running. Its net steady cost is +140m. The DB change restarts the
single instance in place, with a net cost of +70m.
Pod-effective deltas of the other wave-1 owners, taken from the review rows:
rail-knative −160m, railiance-forge +225m (gitea 100→200 counting its init
container, runner 0→125), rapp-telemetry +10m.
| Sequence | Free before the state-hub API rollout | API surge 390m |
| --- | ---: | --- |
| state-hub first (today) | 395m | fits by only 5m. Any CronJob pod (10–25m) or pending pod breaks it. **Not acceptable** |
- Preflight: ok, 605m remaining against a 390m surge (surge read from the values).
- Helm revision 78: the API requests 390m, health is ok and the schema is current.
- The upgrade also rolled out image main-c103cbf. The values bump bb525bc was committed on 17 Oct and never deployed; revision 77 ran main-5dd3df9. Those commits were already in main, and their migration c4d5e6f7a8b9 had already been applied. Rollback: `helm rollback state-hub 77`.
- state-hub-db (namespace databases) requests 70m/416Mi. The CNPG cluster is healthy and the hub stayed connected.
- Node requests after the probe removal: 3605m. Evidence: the-custodian docs/evidence/2026-10-21-wave1-apply.md.