Repository navigation
feat(relay): Cloud Storage bucket for the per-cell runtime switch files (targeted apply only) - #26835
Conversation
<project_id>-relay-control, versioned, uniform access, public access prevented. Cells and directors read; only the flag workflow's deploy identity writes. Apply with a targeted apply, never a root plan.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
💤 Files with no reviewable changes (1)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review. 📝 WalkthroughWalkthroughThe change adds a versioned relay-control bucket with public-access protections and retention settings. It grants object-viewer access to the shared relay runtime service account. When the deploy identity is enabled, Terraform creates a custom writer role and grants it access to objects under Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to No actionable issue remains from the reviewed bucket and fixture changes. Normal deployment checks can proceed. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…tom role; soft-delete keeps history The deploy identity is shared, so its grant now reaches only cells/<cellId>.json and carries only get, create and delete. A 90-day soft-delete window keeps every deleted generation recoverable, since overwrite needs delete and delete also reaches old versions.
…the control bucket
ELI5
Cells already know how to read a small per-cell settings file from Cloud Storage (#26805), but the storage bucket doesn't exist yet, so every read finds nothing and every switch stays off. This PR declares that bucket and who may touch it. Nothing is created until someone runs the targeted apply below.
What Changed
One new file,
cloud/infra/terraform/relay-control-bucket.tf, plus the four new resource names in the root-partition fixture:google_storage_bucket.relay_control:<project_id>-relay-control(productiononorca-cloud-relay-control, stagingonorca-cloud-staging-relay-control), invar.region. The name is fixed because the cell image derives it from the metadata server's project id.storage.objects.deleteto overwrite a live object, and that permission also reaches old generations; soft delete keeps any deleted generation recoverable for 90 days, so a mistaken or hostile delete cannot erase the trail inside that window.force_destroy = false.relay_control_cell_reader: cell runtime SA (relay_runtime),roles/storage.objectViewer.relay_control_writer(custom roleorcaRelayControlWriter): onlystorage.objects.get,createanddelete, the minimum to read and overwrite. There is no list, ACL or bucket permission.relay_control_workflow_writer: that role for the relay GitHub deploy identity (local.relay_github_deploy_service_account_member:gha-deployin production,gha-relayin staging), the only writer, used by the one-cell flag workflow. The deploy account is shared by every relay deploy workflow, so an IAM condition limits the grant to objects undercells/;directors.jsonstays out of its reach.Before: cell reads get 404 (defaults, everything off). After apply: they get 404 until the workflow writes an object, then they apply it. No user-visible change from this PR alone.
Scope of "a cell reads only its own file": cells share one runtime account, so IAM cannot scope a cell to its own object. The image reads only
cells/<its cellId>.json, and read access grants no control.How to apply (targeted only; never a root plan)
A root plan rolls the fleet. Run exactly this, from
cloud/infra/terraform, with production credentials, after review:Go / no-go on
terraform show: exactly4 to add, 0 to change, 0 to destroy, and the four are the resources above.-targetalso pulls in the cell runtime service account as a dependency; it exists already and must show no change. Anything else (a template, MIG, Cloud Run service or any other resource) means stop. For staging, swapproductionforstagingin the two paths.Order: apply before the cell image that carries #26805 is published. The flag workflow then needs a cell's object written before its first flip; until then cells stay on defaults.
Why
Design §2.1 and PR 3 in §6. Per review-step2-ops §3, a store with no table and no director endpoint keeps working with the database or the directors down. Versioning plus the object generation gives both the audit trail and the compare-and-swap the workflow uses.
Directors get no grant: no director code reads or writes switch files today. A director reader (for a future
directors.json) belongs with the code that reads it.Linked Issue
N/A (internal relay redesign, step-5 prep).
Visual Proof
N/A: infrastructure declaration only.
Testing
terraform fmt -check -recursiveandterraform validate(init -backend=false) pass locally.node --test dev/scripts/terraform-root-partition.test.mjs: 7/7 pass with the four families assigned to the relay root.Not planned against real state (no credentials used, by brief). The targeted plan above is the check.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
Agent skill upstream boundary
Notes
Cost: about 5 reads/s fleet-wide, mostly 304s, roughly $5/month (design estimate). Do not merge or apply without the owner's go.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)