Skip to content

feat(relay): Cloud Storage bucket for the per-cell runtime switch files (targeted apply only) - #26835

Merged
Jinwoo-H merged 3 commits into
mainfrom
relay-control-bucket-terraform
Oct 9, 2026
Merged

Jinwoo-H merged 3 commits into
mainfrom
relay-control-bucket-terraform

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 0 0 0 0
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​81 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​81

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 (production onorca-cloud-relay-control, staging onorca-cloud-staging-relay-control), in var.region. The name is fixed because the cell image derives it from the metadata server's project id.
    • Versioning on: every write is a new object generation, so the version history is the audit trail. Noncurrent versions are deleted after 365 days.
    • Soft delete for 90 days (the GCS maximum). The writer needs storage.objects.delete to 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.
    • Uniform bucket-level access, public access prevention enforced, force_destroy = false.
  • relay_control_cell_reader: cell runtime SA (relay_runtime), roles/storage.objectViewer.
  • relay_control_writer (custom role orcaRelayControlWriter): only storage.objects.get, create and delete, 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-deploy in production, gha-relay in 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 under cells/; directors.json stays 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:

terraform init -backend-config=backend/production.hcl
terraform plan -var-file=environments/production.tfvars \
  -target=google_storage_bucket.relay_control \
  -target=google_storage_bucket_iam_member.relay_control_cell_reader \
  -target='google_project_iam_custom_role.relay_control_writer[0]' \
  -target='google_storage_bucket_iam_member.relay_control_workflow_writer[0]' \
  -out=relay-control.tfplan
terraform show relay-control.tfplan
terraform apply relay-control.tfplan

Go / no-go on terraform show: exactly 4 to add, 0 to change, 0 to destroy, and the four are the resources above. -target also 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, swap production for staging in 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 -recursive and terraform 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

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

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

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

<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.
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bbdc565c-3226-40b6-98c7-9ce4b67d5a43

📥 Commits

Reviewing files that changed from the base of the PR and between f65be50 and c6d3308.


📒 Files selected for processing (2)
  • cloud/dev/fixtures/terraform-root-partition/families.json
  • cloud/infra/terraform/relay-control-bucket.tf

💤 Files with no reviewable changes (1)
  • cloud/dev/fixtures/terraform-root-partition/families.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.



📝 Walkthrough

Walkthrough

The 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 cells/. The relay fixture family now includes the bucket, IAM members, and custom role.


Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to c6d33

No actionable issue remains from the reviewed bucket and fixture changes. Normal deployment checks can proceed.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly identifies the main change: a Cloud Storage bucket for per-cell runtime switch files. The targeted-apply qualifier adds useful scope.
Description check Passed The description covers the template’s main sections, including the change, rationale, linked-issue status, visual proof, testing, review notes, and checklist. It explains the infrastructure change and…


  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…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.
@Jinwoo-H
Jinwoo-H merged commit 1472b68 into main Oct 9, 2026
26 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant