Repository navigation
feat(deploy): the cutover — deploy inactive, smoke-test, flip, retire - #472
Conversation
1062efd to
9f9f230
Compare
9f9f230 to
967d41b
Compare
|
Rebased onto One conflict, resolved by keeping both sides: #479 added a Say what was deployed step immediately before Recovery was a cherry-pick, not a rebase — the parents are in Re-verified after the resolution: |
The deploy becomes five phases instead of one `helm upgrade`, and traffic only
moves after the new colour has answered through its own Services.
Say what was deployed (#479, unchanged)
The namespace chart
Read the live colour from svc/er-web's selector — never guessed
Deploy the inactive colour new digests, color.active UNCHANGED
Smoke-test the inactive colour through the PREVIEW Services
Cut over one field on two Service objects
Retire the old colour only after the cutover is verified
**The live colour is READ, not stored.** `svc/er-web`'s selector is the same
field the cutover moves, so it cannot drift from reality the way a convention
or a recorded value would. `make dev-resume` reads it the same way. An absent
selector means first install: nothing to cut over from, so the cutover steps
skip.
**The live colour is pinned to the digests it is ALREADY serving** during the
deploy phase. Without that the live Deployment re-renders to the new digest and
restarts the pod taking traffic — the outage this exists to remove. Those
digests are read off the live Deployment's own containers BY CONTAINER NAME, so
the two halves cannot be transposed.
**The schema gate is the hook, not a step here.** `er-schema-migrate` (weight
-5) already runs `er-server migrate --expect-additive`, which plans first and
refuses — writing nothing — if the release is breaking; Helm runs hooks before
any release object is applied, so a breaking release fails with the live colour
untouched. A separate preflight Job would be the same check twice.
**The smoke test hits the PREVIEW Services, and that is the point.** Hitting the
live ones would test what is already in production and pass for the wrong
reason. `charts-check.py` now refuses a chart whose previews point at the live
colour, so the two halves of that property are enforced in different places.
**Retiring the old colour is deliberately decoupled from the cutover.** It runs
only after the cutover is verified, so a failure there leaves traffic correctly
on the new colour with one surplus pod — the harmless direction. Scaled to zero
rather than left warm (two serving pods doubles a namespace's cost); the
Deployment is kept, so the next deploy scales it up with its image cached. A
rollback after that point needs the replica count back as well as the selector,
which is why the step summary prints the command while the old pod is still
there.
**`executor.dagKinds` is now ONE value in `env:`, not two literals.** This step
pair introduces a second `helm upgrade`, and #498 had just extended the
allowlist to the `run_all_*` kinds — two hardcoded copies would have drifted
the first time someone added a third kind to one of them. #498's reasoning for
which kinds are on moves up with the value rather than being left behind in the
step that carried it.
Rebuilt on main's file rather than hand-resolving a conflict, after a
cherry-pick hit two hunks: #479 added a summary step immediately before the
step this replaces, and #498 expanded the allowlist inside it. Taking either
side alone would have silently dropped one of them. Verified both survive —
the summary step, and #498's expanded list in both invocations with its
rationale.
Verified on a real cluster, in throwaway namespaces, because the parts most
likely to be subtly wrong are the ones a render cannot check:
- every `run:` block syntax-checked with `bash -n` (0 errors)
- no inline `${{ }}` in any shell body this adds — values arrive through `env:`
- the colour read, against a live Service: `'blue'` -> target `green`
- digest extraction, against digest-pinned Deployments: both halves parsed to
`sha256:…`, selected by container NAME
- the first-install branch: absent Service -> empty -> direct path
- **and that the smoke test can FAIL.** `kubectl run` propagates the
container's exit code: unreachable target -> exit 7, with a positive control
against a reachable one -> exit 0. A smoke test that cannot fail is worse
than none, and the positive control is what makes the negative result mean
"the target is down" rather than "DNS or the image was broken".
Verified: `make check` green.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
967d41b to
9ce6a5f
Compare
|
Rebuilt on
Taking either side alone would have silently dropped one of them: mine would have reverted #498's allowlist and lost #479's stale-image reporting. One improvement that fell out of it. This PR introduces a second Verified both survive rather than trusting the rebuild: Re-ran after the rebuild: |
The deploy becomes four phases instead of one
helm upgrade, and traffic only moves after the new colour has answered through its own Services.Four decisions worth reviewing
The live colour is read, not stored.
svc/er-web's selector is the same field the cutover moves, so it cannot drift from reality the way a convention or a recorded value would.make dev-resumereads it the same way. An absent selector means first install — nothing to cut over from, so the cutover steps skip.The live colour is pinned to the digests it is already serving during the deploy phase. Without that, the live Deployment re-renders to the new digest and restarts the pod taking traffic — the outage this whole stack exists to remove. Those digests are read off the live Deployment's own containers by container name, so the two halves cannot be transposed.
The schema gate is the hook, not a step here. #468's
er-schema-migrate(weight −5) already runser-server migrate --expect-additive, which plans first and refuses — writing nothing — if the release is breaking. Helm runs hooks before any release object is applied, so a breaking release fails with the live colour untouched. A separate preflight Job would be the same check twice.images.api/web.digestis what the hook migrates with, which is why it carries the new digests while the colour blocks pin per-Deployment.Retiring the old colour is deliberately not coupled to the cutover. It runs only after the cutover is verified, so a failure there leaves traffic correctly on the new colour with one surplus pod — the harmless direction. Scaled to zero rather than left warm, because two serving pods doubles a namespace's steady-state cost; the Deployment is kept, so the next deploy scales it up with its image already cached. A rollback after that point needs the replica count back as well as the selector, which is why the step summary prints the command while the old pod is still there.
The smoke test hits the preview Services, and that is the point
Hitting the live ones would test what is already in production and pass for the wrong reason — the failure that would make this mechanism decorative without looking broken.
Readiness (#437) already proves er-server reached the control plane and the BFF reached er-server. This adds the one thing a probe cannot: that the answer arrives through a Service, over the network path a real request takes.
Verified on a real cluster, in throwaway namespaces
The parts most likely to be subtly wrong are the ones a render cannot check:
run:block,bash -n${{ }}in any shell bodyenv:, so nothing is interpolated into a command line'blue'→ targetgreensha256:…, selected by container namekubectl runexits 7 (curl's code propagated)That last pair is the one I'd want a reviewer to care about. A smoke test that cannot fail is worse than none, and the positive control is what makes the negative result mean "the target is down" rather than "DNS or the image was broken".
The escaped
executor.dagKinds=lake_maintain\,lake_migratesurvives in both helm invocations — checked in the rendered file rather than assumed.Verification
make checkgreen.skills-checkreports no generated-reference drift: the generator reads job metadata, and only steps changed.🤖 Generated with Claude Code