Public: anyone can read this; the crew can change it.

The release agent refuses a dark roll unless the owner said yes to that roll #951

Closed opened this in answer to
Closed without merging

A release now has a pre-roll check: before rolling, the release agent can tell whether a second forge pod fits beside the first. If it doesn't, the roll waits for the owner's yes to that particular roll. What changed scripts/roll.ts: a small module that takes the JSON kubectl prints and decides.

Notes

stopped closed without shipping

opened this

A release now has a pre-roll check: before rolling, the release agent can tell whether a second forge pod fits beside the first. If it doesn't, the roll waits for the owner's yes to that particular roll.

What changed

  • scripts/roll.ts: a small module that takes the JSON kubectl prints and decides. A second pod has to fit on the forge's own node, because its storage only lives on that node.
    • Free space is the node's allocatable minus the requests of every pod on it that is still running or pending. The sum counts each pod's request the way the scheduler does, including init and sidecar containers and runtime overhead.
    • What the second pod needs is the forge pod's CPU request, and for memory the larger of its request and its steady memory. Steady memory counts because a 2 Gi request that settles at 3.5–4 Gi would schedule and then run the node out of memory.
    • All arithmetic is in whole millicores and bytes, like the scheduler. That avoids floating-point slips: in plain floats, 4.1 − 3.1 comes out just under 1, which wrongly turned a fitting pod away.
  • scripts/roll-preflight.ts: the command line the release agent runs. When the pod doesn't fit, it prints a report with:
    • the shortfall in GiB and CPU, which is the extra room that would make the roll zero-downtime;
    • the dark time: about 215 s typical (180 s crew drain + 35 s start, from v0.7.52's 213 s). The worst case is 485 s, using the chart's 300 s grace period, startup probe limit and readiness period;
    • a roll id, which is a hash of the version and the node's numbers.

    Exit codes:

exitmeaning
0roll: the pod fits, or --yes gives the right roll id
3don't roll: it would go dark and the owner hasn't said yes
4don't roll: a file passed with --overlay contains maxSurge: 0 or type: Recreate
2the input isn't what kubectl prints

A yes for one release doesn't cover the next one, and if the node's numbers change the id changes too. The command only reads files; it never contacts a cluster.

  • docs/ops/RELEASE.md: the release checklist. It gives the kubectl commands to collect the inputs, the rule with its units, what each exit code means, and how an approved dark roll is done. That is a one-off patch to the live deployment, set back to maxSurge: 1, maxUnavailable: 0 straight after the roll and checked. README.md links to it.
  • test/roll.test.ts (added to GATE): every expected number is worked out by hand in a comment. It covers a node where the pod's request fits but its steady memory doesn't, and yes ids that must be refused. It also keeps the chart at maxSurge: 1, maxUnavailable: 0 and checks that the worst-case seconds match the chart's grace period and probe settings.

Tests: tsc --noEmit is clean. roll, shards, check-list and hollow pass. studio and reserved-names fail here only because this sandbox won't let them open a Unix socket (EPERM on listen).

What I did not do

  • The issue says the checklist lives in docs/ops and in the standby scripts' roll recipe, and also names a gitops overlay. None of these are in this repository, so I created docs/ops here and didn't touch the standby scripts. Whoever owns the standby scripts and the overlay needs to wire this check into the roll recipe and pass the overlay files with --overlay.
  • The checklist uses $NS and $REL for the namespace and release name because I don't know their production values.
  • There is no in-app page for this; it is a step in the release checklist.

To try it: bun test test/roll.test.ts, or run bun scripts/roll-preflight.ts --version 0.7.53 --node node.json --pods pods.json --pod NS/POD --steady 3712Mi on kubectl get node -o json and kubectl get pods -A -o json output.

🤖 Generated with Claude Code

Closes #876

commented

Parked by the crew: the check failed ("capacity: only a forge admin reads or changes it > an admin changes each one from the page, the API and MCP; a wrong value is refused; every change is kept") and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs