Repository navigation
feat(deploy): the colour dimension — two web-api Deployments, one Service selector - #461
Merged
Merged
Conversation
athvin
force-pushed
the
bm/bluegreen-p9-colour
branch
from
November 4, 2026 23:52
40dc8de to
09b8d0a
Compare
This was referenced Nov 4, 2026
athvin
force-pushed
the
bm/bluegreen-p9-colour
branch
from
November 5, 2026 00:19
09b8d0a to
26096b5
Compare
…vice selector
The traffic half of blue/green, and the only part that needs no new controller:
`web-api` becomes two Deployments, one per colour, and `er-api`/`er-web` select
`color.active`. A cutover is one field on two Service objects. A rollback is
that field moving back, with the old pod still running because its colour was
never scaled down.
**Measured on a live kind cluster, in an isolated namespace, at the endpoint
level — which is where "zero downtime" is either true or not:**
samples=400 EMPTY_SAMPLES=0 distinct_consecutive_states=2
10.244.0.35 <- blue pod
10.244.0.36 <- green pod
400 samples of `endpoints/er-web` across a cutover, none of them empty. The
Service transitions directly from one pod's IP to the other with no window in
which it has no backend. Before and after, the previews inverted correctly:
active=blue er-api -> BLUE er-api-preview -> GREEN
active=green er-api -> GREEN er-api-preview -> BLUE
rollback er-web -> BLUE er-web-preview -> GREEN
**Four Services, and the preview pair is the point.** `er-api-preview` and
`er-web-preview` select the INACTIVE colour, so a new colour can be deployed,
probed and smoke-tested while taking no production traffic. They are ClusterIP
like the others, so `kubectl port-forward` reaches them — which is why this
works today, before task 1.4's ALB exists.
**`color.active` is a value; the inactive colour is DERIVED.** Two independent
values could be set to the same colour, which renders a preview Service aimed
at the live pod — and then the cutover's smoke test passes by testing what is
already in production. That failure looks like success, so the shape makes it
unrepresentable.
**The chart REFUSES an invalid colour** (`fail`, not a lint). A typo'd
`--set color.active=gren` would render Services selecting a colour no Deployment
carries: no endpoints, nothing served, and `helm upgrade` reporting success
because every object applied cleanly. CI cannot catch it either — the value
arrives on the deploy command line, not in the tree. Refusing to render is the
only place it is checkable at the moment it is wrong. Observed refusing.
**Per-colour digests** are why the `api`/`web` blocks nest under each colour: a
deploy pins the new image into the inactive colour while the live one keeps the
digest it is serving. One shared `images.api` would re-render BOTH Deployments
on every upgrade and restart the colour taking traffic — the outage this exists
to remove. Empty falls back to `images.*`, so kind, a developer namespace and
`make dev-up` need no colour values and get the topology they had.
**This lands inert.** Defaults are `blue` at one replica and `green` at zero, so
the existing CI deploy keeps doing exactly what it did. The three-phase cutover
job is the next change; so is moving the init container to a pre-upgrade hook
that may only add, which is what `er-server migrate --expect-additive` was built
for. Adopting this costs ONE restart, because `web-api` is renamed
`web-api-blue`.
Two call sites would have broken silently and are fixed here:
- `make dev-resume` ran `rollout status deployment/web-api`, which no longer
resolves, and `scale --all` would have woken BOTH colours — so both would
serve and the preview Service would point at a live pod. It now READS the live
colour from the Service selector, the same single source of truth the cutover
uses, so it cannot drift from whichever colour is actually serving.
- `kind.yml`'s failure diagnostic logged `deploy/web-api`. Now by label, which
is stable across both colours and across a cutover — a diagnostic that
silently prints nothing is worse than none, and it only runs when something
has already failed.
And one property documented where it will be needed: `allow-alb-to-web` is
colour-agnostic ON PURPOSE. Both colours carry `name: web-api`, so the hole
admits whichever is live without knowing which. Pinned to a colour, a cutover
would blackhole the newly-active pod until someone updated a NetworkPolicy in
the other chart — and the symptom would be a green deploy serving 100% errors
with every probe passing.
Verified: `make check` green; `helm lint` clean; `helm template` +
`kubeconform -strict` on the dev, kind and namespace profiles (the kind profile
correctly renders both colours and no `er-web*` Services, since `web.enabled` is
false); the guard observed refusing an invalid colour; and the cutover,
rollback and zero-gap measurement above on a real cluster. The probe namespace
was torn down and the pre-existing `er-kind` release was left untouched.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
athvin
force-pushed
the
bm/bluegreen-p9-colour
branch
from
November 5, 2026 01:18
26096b5 to
a97b7db
Compare
This was referenced Nov 5, 2026
athvin
added a commit
that referenced
this pull request
Nov 5, 2026
…g it (#499) Re-ran the three CUR probes against the November partition. One probe is unchanged and the spend underneath it is not. Split cost allocation is still producing nothing: 0 non-null out of 19,770 November rows, three days after the first probe said the same. Three more days of pod-level cost are permanently unrecoverable. The thing the re-run was not looking for is that November is on pace for roughly six times October. $160.47 in five days against $184.23 for all of October. S3 was not in October's top five; in November it is $76.27, and all of it is one line: 837 GB of `USE2-DataTransfer-Out-Bytes` from `er-ci-sccache` at $0.090/GB. That is internet egress — GitHub-hosted runners are not in the VPC, so a Gateway Endpoint cannot help and every sccache read leaves the region at the public rate. Nov 4 isolates the cause for free: that is the day the Actions billing block stopped CI running, and it egressed $0.00 against a $21.55 total. A day with no CI costs ~$20 and ships nothing; a day with CI costs $32-52 and the whole difference is this line. Nov 1 reads as $0.03 only because the first 100 GB a month is free, which was consumed during Nov 2. This is the price of the CI speedup and it was never measured. #424 removed rust-cache, which made sccache the only cache; the test job was then sharded, which multiplied the runners each pulling from it; and the hit rate is ~99%, so nearly every compilation unit downloads its object. PR wall time went 32-35 min to ~10 min. At ~$31 per CI day that is ~$600-900/month against a $600 budget that breaches mid-month. The baseline rose independently too — EC2 from ~$1.50/day to ~$7.60/day — which is the observability stack, the second web-api Deployment from #461 and the dispatcher. Real, new, and not sccache. Recorded as a decision with four options rather than a fix, because trading 25 minutes of wall clock for this is a judgement call and the defect was not knowing the number. The one thing the doc rules out is emptying the bucket: a cold sccache costs a 42-minute PR, which is what it was built to fix. Co-authored-by: bmoore813 <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The traffic half of blue/green, and the only part that needs no new controller.
web-apibecomes two Deployments, one per colour, ander-api/er-webselectcolor.active. A cutover is one field on two Service objects; a rollback is that field moving back, with the old pod still running because its colour was never scaled down.Measured on a live kind cluster, at the endpoint level
That is where "zero downtime" is either true or it isn't. 400 samples of
endpoints/er-webacross a cutover:Zero empty samples. The Service transitions straight from one pod's IP to the other, with no window in which it has no backend. And the previews inverted correctly throughout:
color.activeer-apier-api-previewbluegreenblueRun in an isolated
bg-probenamespace against the chart's own rendered Services, with stub pods carrying the chart's exact colour labels. The namespace was torn down and the pre-existinger-kindrelease was left untouched.Four Services, and the preview pair is the point
er-api-preview/er-web-previewselect the inactive colour, so a new colour can be deployed, probed and smoke-tested while taking no production traffic. They're ClusterIP like the others, sokubectl port-forwardreaches them — which is why this works today, before task 1.4's ALB exists.Three decisions that make the failure modes unrepresentable
color.activeis a value; the inactive colour is derived. Two independent values could be set to the same colour, which renders a preview Service aimed at the live pod — and then the cutover's smoke test passes by testing what is already in production. That failure looks like success, which is the worst kind.The chart refuses an invalid colour —
fail, not a lint. A typo'd--set color.active=grenwould render Services selecting a colour no Deployment carries: no endpoints, nothing served, andhelm upgradereporting success because every object applied cleanly. CI can't catch it either, since the value arrives on the deploy command line rather than in the tree. Refusing to render is the only place it's checkable at the moment it's wrong. Observed refusing:Per-colour digests are why
api/webnest under each colour: a deploy pins the new image into the inactive colour while the live one keeps the digest it's serving. One sharedimages.apiwould re-render both Deployments every upgrade and restart the colour taking traffic — the outage this exists to remove. Empty falls back toimages.*, so kind, a developer namespace andmake dev-upneed no colour values at all.This lands inert
Defaults are
blueat one replica,greenat zero, so the existing CI deploy keeps doing exactly what it did. The three-phase cutover job is the next change; so is moving the init container to a pre-upgrade hook that may only add, which is whater-server migrate --expect-additive(#456) was built for.Adopting it costs one restart —
web-apiis renamedweb-api-blue, so the first upgrade deletes the old object and creates the new one. Every upgrade after that can be a cutover.Two call sites that would have broken silently
make dev-resumeranrollout status deployment/web-api, which no longer resolves, andscale --allwould have woken both colours — so both would serve and the preview Service would point at a live pod. It now reads the live colour from the Service selector, the same single source of truth the cutover uses.kind.yml's failure diagnostic loggeddeploy/web-api. Now by label, stable across both colours and across a cutover. A diagnostic that silently prints nothing is worse than none, and it only runs when something has already failed.One property documented where it will be needed
allow-alb-to-webis colour-agnostic on purpose. Both colours carryname: web-api, so the hole admits whichever is live without knowing which. Pinned to a colour, a cutover would blackhole the newly-active pod until someone also updated a NetworkPolicy in the other chart — and the symptom would be a green deploy serving 100% errors with every probe passing.Verification
make checkgreen;helm lintclean.helm template+kubeconform -stricton the dev, kind and namespace profiles. The kind profile correctly renders both colours and noer-web*Services, sinceweb.enabled: false.🤖 Generated with Claude Code