How-to guide

Release with blue/green and canary routing

Route traffic between two versions of a service, swap them, or send a slice of calls to a candidate.

Distro Current 2 min read Updated

Prerequisites

  • Workers registered for two versions of the same service

Note

Kiwi Distro is currently in private preview. Interfaces and behaviour described here can change before general availability. Contact Kiwify Labs for access.

Each worker declares a version when it registers (default 1.0.0), and a client can pin one with --service-version. A service's deployment strategy tells the middleware which version receives live traffic.

Blue/green#

bash
kiwi distro set-deployment-strategy --service-id <service-id> --strategy bluegreen --active 1.0.0 --candidate 1.1.0
kiwi distro get-deployment-strategy --service-id <service-id>

Live traffic goes to the active version, and the candidate is the version waiting to be swapped in. When you are satisfied with the candidate, swap:

bash
kiwi distro swap-blue-green --service-id <service-id>

The active and candidate versions trade places. To roll back, swap again.

Canary#

bash
kiwi distro set-deployment-strategy --service-id <service-id> --strategy canary --active 1.0.0 --candidate 1.1.0 --canary-pct 10

The candidate receives the given percentage (0 to 100) of calls, and the active version is the fallback. Raise the percentage as confidence grows, then switch the active version.

Notes#

  • Strategy settings are also available through the admin API (GET/PUT /client/service/{id}/deployment_strategy and PUT /client/service/{id}/swap_blue_green) and the desktop app.
  • Routing is per service, so different services can use different strategies.

Expected result

  • Live calls go to the active version, and the candidate can be promoted with a swap