Deploy to multiple targets at the same time

Using Cloud Deploy, you can deploy to a target that's configured to represent multiple targets, and your application is deployed to those targets in parallel (concurrently). The target you identify as a stage in your pipeline is called a multi-target, and the targets that multi-target comprises are called child targets.

You can use parallel deployment with any target type that Cloud Deploy supports.

Why parallel deployment

You can use parallel deployment, for example, to deploy your application to multiple production targets. In this case, you don't need to deploy to each target in succession, because there's no progression (for example, from dev to staging to production).

And this parallel deployment can be a part of a normal delivery pipeline progression:
dev -> staging -> prod [prod1, prod2, prod3, prod4, ...].

Cloud Deploy resources used for parallel deployment

Parallel deployment uses the following Cloud Deploy specialized resources:

  • multi-targets

    A multi-target is a target that is configured with the property multiTarget, at the top level of the target config YAML, and instead of referencing the runtime cluster or service, it references one or more other targets, using multiTarget.targetIds.

  • Child targets

    A child target is any target referenced by a multi-target as multiTarget.targetIds.

  • Controller rollouts

    A controller rollout is a rollout that corresponds to the multi-target.

    See Limitations for more information about what you can and can't do with a controller rollout.

  • Child rollouts

    See Limitations for more information about what you can and can't do with a child rollout.

Set up parallel deployment

Setting up parallel deployment consists of defining one multi-target and the number of child targets you need (up to the limit). Target definitions are the same as for all targets, except for the following:

  • Multi-targets include the multiTarget property.
  • Child targets do not include the multiTarget property, but are referenced from the multi-target using the multiTarget.targetIds property.
  • You can configure the multi-target for approval, but not the child targets, which cannot include requireApproval:true.

Multi-targets and child targets can include custom execution environment configs. If a child target doesn't specify an execution environment, it inherits the one defined in the multi-target definition, or the default. See Execution environments and parallel deployment for more details.

Configure the multi-target

A multi-target is a single target identified as a stage in your delivery pipeline, but pointing to one or more child targets.

The multi-target configuration includes the multiTarget property. A multi-target cannot have the gke or run or anthosCluster properties. Configuration for a multi-target is the same regardless of which runtime you're deploying to.

In your delivery pipeline YAML or in a separate YAML file, create the basic target definition, including multiTarget:

apiVersion: deploy.cloud.google.com/v1
kind: Target
metadata:
 name: TARGET_NAME
description: TARGET_DESCRIPTION
multiTarget:
 targetIds: [ CHILD_TARGET1, CHILD_TARGET2, CHILD_TARGETn