tcb cloudrun traffic
View the version traffic split of a CloudBase Run service, or send a share of traffic to a canary version.
v3.0.0+
tcb cloudrun traffic has been available since v3.0.0.
Usage
# View the current traffic split
tcb cloudrun traffic -e <envId> -s <serviceName>
# Set canary traffic
tcb cloudrun traffic -e <envId> -s <serviceName> --stable <n> --canary <n>
Parameters
| Parameter | Required | Description | Default |
|---|---|---|---|
-e, --env-id <envId> | No | Environment ID | — |
-s, --serviceName <name> | No | Service name; read from cloudbaserc.json or prompted when omitted | — |
--stable <n> | No | Traffic share of the stable version, 0 to 100 | — |
--canary <n> | No | Traffic share of the canary version, 0 to 100 | — |
--stable and --canary must add up to 100.
Examples
# View the current traffic split
tcb cloudrun traffic -e env-123456 -s my-service
# 90% stable, 10% canary
tcb cloudrun traffic -e env-123456 -s my-service --stable 90 --canary 10
Canary workflow
# 1. Deploy a new version as the canary
tcb cloudrun deploy -e <envId> -s my-service
# 2. Send 10% of traffic to the canary and verify
tcb cloudrun traffic -e <envId> -s my-service --stable 90 --canary 10
# 3a. Verified: finish the release
tcb cloudrun traffic promote -e <envId> -s my-service
# 3b. Failed: roll back
tcb cloudrun traffic rollback -e <envId> -s my-service