Repository navigation
fix(relay): staging director deploys set the admin identity the director trusts to gha-relay - #27121
Conversation
62bb888 to
34f3a5c
Compare
…tor trusts to gha-relay Rebased onto main as one commit after its parent squash-merged.
e28f553 to
9090786
Compare
📝 Walkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to The staging deploy uses the same service account for authentication and director configuration, and both revisions receive the setting. The remaining recommendation strengthens regression coverage; no material merge-blocking risk is established. Pre-merge checks |
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
cloud/dev/scripts/deploy-relay-blue-green.test.mjs (1)
1028-1047: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAssert deploy identity on both generated revisions.
The changed test validates only
directorDeploymentEnvironment. It does not exercise either revision deployment. Add the deploy identity to the existing end-to-end fixture and assert it for both revisions.Suggested fix
const config = { project: 'onorca-cloud-staging', 'capacity-service-account': - 'orca-cloud-staging-gha-cap@onorca-cloud-staging.iam.gserviceaccount.com' + 'orca-cloud-staging-gha-cap@onorca-cloud-staging.iam.gserviceaccount.com', + 'deploy-service-account': + 'orca-cloud-staging-gha-relay@onorca-cloud-staging.iam.gserviceaccount.com' } ... assert.equal( harness.state.revisions.get(revision).env.ORCA_RELAY_CAPACITY_SERVICE_ACCOUNT, config['capacity-service-account'] ) + assert.equal( + harness.state.revisions.get(revision).env.ORCA_RELAY_DEPLOY_SERVICE_ACCOUNT, + config['deploy-service-account'] + )
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
3936c80a-c025-4862-b18d-0397f7b81656
📒 Files selected for processing (4)
.github/workflows/cloud-deploy-relay-staging.ymlcloud/dev/scripts/deploy-relay-blue-green.mjscloud/dev/scripts/deploy-relay-blue-green.test.mjscloud/dev/scripts/relay-staging-deploy-identity.test.mjs
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
ELI5
The staging director only accepts admin calls from a robot account called gha-deploy. Every staging workflow, and every staging cell, uses a different robot account, gha-relay. So the workflows' admin calls to the director are rejected. This makes staging director deploys tell the director to trust gha-relay.
What Changed
ORCA_RELAY_DEPLOY_SERVICE_ACCOUNT=orca-cloud-staging-gha-deploy@…. Terraform declares gha-relay (relay-shared.tf, the staging arm ofrelay_github_deploy_service_account_email), and the c1, c2 and c4 instance templates already carry gha-relay. Every/v1/admin/*call that a staging workflow makes to the director with gha-relay's token gets 401. That includes fix(relay): the cell switch tool changes only the named switches #27056's admit-mode guard, the cell-flags tool andverifyRehomeDisabled.deploy-relay-blue-green.mjsgains--deploy-service-account, which must be an account in the selected project. When it is passed, the candidate and rollback revisions getORCA_RELAY_DEPLOY_SERVICE_ACCOUNT. When it is omitted, the serving revision's value carries over, so the behavior is unchanged.cloud-deploy-relay-staging.ymlpassesvars.STAGING_GCP_RELAY_DEPLOY_SERVICE_ACCOUNT, the same identity it authenticates as.Who owns the value: the deploy, not Terraform
A targeted Terraform plan of
google_cloud_run_v2_service.relayon staging is far wider than this one variable. It moves the runtime account, and changes concurrency from 1000 to 80, timeout from 3600s to 30s, and scaling. It stripsORCA_RELAY_IMAGE_DIGESTand mints a revision outsidedeployDirector's guards. The deploy already owns every other live director env value, so this keeps one owner. No Terraform change is needed: Terraform already says gha-relay.Order
Stacked on #27118. The first staging deploy after both merge must be #27118's
bootstrap-runtime-identity=truedeploy. That path skips the rehome check against the serving origin, which still trusts gha-deploy. Its rollback and candidate revisions carry the new value, so every later call with gha-relay's token succeeds there. A non-bootstrap deploy before the bootstrap fails closed.The bootstrap must deploy the serving image digest, with
reserve-placement=preserveandshadow-seat-feed-cells=preserve. #27056's reserve guard (assertDirectorTrustsAdminCaller) refuses by name when the serving director trusts a different account than the caller, and it runs whenever the image or those settings change. With the same image and settings, it is skipped by design, and that is the only way through while the serving director still trusts gha-deploy. DeployDafter the bootstrap.Apply
No Terraform. The director change happens in the bootstrap deploy.
Production
Zero. No Terraform file changes. No production workflow passes
--deploy-service-account, so production deploys carry their serving value over exactly as before.Testing
deploy-relay-blue-greentest: the value is set only when asked, and a foreign-project account is refused.deploy-relay-blue-green(43),relay-staging-deploy-identity,relay-staging-capacity-identityandproduction-cloud-sql-rollout-lockpass.Visual Proof
N/A: CI and deploy tooling only.