Set Traffic
cloud_run.set_traffic
ActionGoogle Cloudconnection required
Calls Cloud Run Admin API v2 PATCH /services/{s}?updateMask=traffic.
Route a Cloud Run service's traffic to a revision (rollback or canary).
Connection
- Required
- Yes — the node will not save without one
- Auth type
- OAuth 2.0
- Providers
- Google Cloud Run
- Secret shape
- {"client_id", "client_secret", "refresh_token"}
- Config it needs
- project_id, region
- Resolved by
- config.connection_id, else node.connection_id
Configuration
8 fields, 1 required. A dotted path is a nested object and name[] an array of objects — the editor renders the same tree.
| Field | Type | Required | Default | Constraints | Example |
|---|---|---|---|---|---|
project_id GCP project id (overrides connection). | string | No | — | — | — |
region Cloud Run region (overrides connection). | string | No | us-central1 | — | — |
service Service name. | string | Yes | — | — | — |
revision Revision to send traffic to, e.g. api-00042-abc. | string | No | — | — | — |
percent Share for that revision; the remainder goes to 'fallback_revision'. | number | No | 100 | 0–100 | — |
fallback_revision Revision that keeps the remaining traffic when percent < 100. Left blank, the revision currently serving the most traffic is used. | string | No | — | — | — |
to_latest Send 100% to the latest revision instead of a named one. | boolean | No | false | — | — |
traffic Raw TrafficTarget list, for allocations the fields above cannot express. | array | No | — | array of object | — |
- At least one of revision, to_latest, traffic must be set.
Example configuration
Every value below is the contract’s own example or default — nothing invented.
{
"percent": 100,
"region": "us-central1",
"to_latest": false
}Output
One shape.
result
| Field | Type | Example |
|---|---|---|
ok | boolean | — |
operation Feed this to cloud_run.wait_operation. | string | — |
done | boolean | — |
error Set only when Cloud Run rejected the patch. | object | — |
traffic The allocation that was sent. | array | — |
{
"done": false,
"error": {},
"ok": false,
"operation": "",
"traffic": []
}Notes
- Percentages must total 100; the remainder is assigned to `fallback_revision` for you, defaulting to the revision serving the most traffic right now.
- The remainder never goes to the latest revision: after a deploy the latest revision is the one being canaried, so that would put 100% on it.
- A revision whose `ready` is false cannot serve — check cloud_run.list_revisions before rolling back onto one.
Related Google Cloud Run nodes
See Set Traffic run in a workflow.
In a technical demo we add the Google Cloud Run connection, drop the node on the canvas and let Workflow Health pre-flight it before the first real run.