Files
orca/cloud/dev/scripts/read-relay-production-capacity-identity.mjs
Jinwoo-H 25e31c931d chore(cloud): add the relay fence broker, ops console, Terraform root, and scripts
Copies the private repository's relay side: the IAM-only fence broker, the
operations console and incident monitor, the relay Terraform root with its
backend configuration and tfvars, and the deploy/capacity/admission/rehome/
monitoring scripts the workflows call, with their contract tests, contracts,
and fixtures.

The foundation and apps Terraform roots and the API and auth services stay
private. Four surfaces that spanned both trees are narrowed to the relay side
rather than left with a dangling read: the infra runner and the root-partition
and workload-identity-condition renderers now declare only the relay root, and
the Cloud SQL rollout census drops the six app workflows that are not here.
2026-09-03 06:20:32 -04:00

32 lines
1.1 KiB
JavaScript

import { readFileSync } from 'node:fs'
import { pathToFileURL } from 'node:url'
const CAPACITY_IDENTITY_NAME = 'ORCA_RELAY_CAPACITY_SERVICE_ACCOUNT'
export function readProductionCapacityIdentity(revision) {
const env = revision?.spec?.containers?.[0]?.env
if (!Array.isArray(env)) throw new Error('director revision environment is missing')
const matches = env.filter((entry) => entry?.name === CAPACITY_IDENTITY_NAME)
if (matches.length === 0) return null
if (matches.length !== 1) throw new Error('duplicate capacity identity')
const value = matches[0]?.value
if (typeof value !== 'string' || value.length === 0) {
throw new Error('capacity identity is not a literal string')
}
return value
}
export function main() {
const revision = JSON.parse(readFileSync(0, 'utf8'))
process.stdout.write(`${JSON.stringify(readProductionCapacityIdentity(revision))}\n`)
}
if (import.meta.url === pathToFileURL(process.argv[1]).href) {
try {
main()
} catch (error) {
process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`)
process.exitCode = 1
}
}