strategy:canary:# Custom configuration for each canary phasecustomCanaryDeployment:phaseConfigs:-phaseId:"PHASE1_NAME"percentage:PERCENTAGE1profiles:["PROFILE_NAME"]verify:true | falsepredeploy:actions:"PREDEPLOY_ACTION"postdeploy:actions:"POSTDEPLOY_ACTION"-…-phaseId:"stable"percentage:100profiles:["LAST_PROFILE_NAME"]verify:true|falsepredeploy:actions:"PREDEPLOY_ACTION"postdeploy:actions:"POSTDEPLOY_ACTION"
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-17。"],[],[],null,["# Custom Canary Deployments\n\nThis document describes how to configure and use custom canary deployments to\ndeploy your applications to [all target types](/deploy/docs/deploying-application#set_up_for_the_runtime_environment_of_your_choice)\nusing Cloud Deploy.\n\nHow custom canary deployments work\n----------------------------------\n\nWhen you deploy using a custom canary deployment strategy,\nCloud Deploy does not modify your manifests in order to facilitate the\nchosen traffic-balancing configuration. Instead you are responsible for\nproviding manifests that are applied to your target runtime for each canary\nphase.\n\n### Make sure you have the required permissions\n\nIn addition to other Identity and Access Management permissions you need for using\nCloud Deploy, you need the following permissions in order to\nperform additional actions that might be needed for a canary deployment:\n\n- `clouddeploy.rollouts.advance`\n- `clouddeploy.rollouts.ignoreJob`\n- `clouddeploy.rollouts.cancel`\n- `clouddeploy.rollouts.retryJob`\n- `clouddeploy.jobRuns.get`\n- `clouddeploy.jobRuns.list`\n- `clouddeploy.jobRuns.terminate`\n\nSee [IAM roles and permissions](/deploy/docs/iam-roles-permissions)\nfor more information about what available roles include these permissions.\n\n### Prepare your `skaffold.yaml`\n\nYour `skaffold.yaml` file defines how your manifests are rendered and deployed.\nFor a custom canary deployment you are responsible for defining profiles that\nare associated with each canary phase in order to facilitate the chosen\ntraffic-balancing configuration. These profiles are mapped to phases in the\ndelivery pipeline strategy configuration.\n\nThe following is an example `skaffold.yaml` configuration used by a custom\ncanary: \n\n apiVersion: skaffold/v4beta7\n kind: Config\n profiles:\n - name: canary-25\n manifests:\n rawYaml:\n - canary-25-resources.yaml\n - name: canary-50\n manifests:\n rawYaml:\n - canary-50-resources.yaml\n - name: stable\n manifests:\n rawYaml:\n - stable-resources.yaml\n\n### Configure a custom canary\n\nWith custom canary configuration, you specify the following, in your delivery\npipeline definition:\n\n- Rollout phase names\n\n In a fully-automated canary, Cloud Deploy names the phases for you\n (`canary-25`, `canary-75`, `stable`, for example). With a custom canary,\n however, you can give each phase any name, as long as it's unique among all\n phases for this canary stage, and it honors\n [resource ID restrictions](/apis/design/resource_names#resource-id-segments). But the final\n (100%) phase name must be `stable`.\n- Percentage goals for each phase\n\n Specify the percentages separately, per phase.\n- Skaffold profiles to use for the phase\n\n You can use a separate Skaffold profile for each phase, or the same profile,\n or any combination. And each profile can use a different Cloud Run service definition. You can also use more than\n one profile for a given phase. Cloud Deploy combines them.\n- Whether there is a verify job for the phase\n\n Remember that if you're enabling verify, you need to\n [configure](/deploy/docs/verify-deployment) your `skaffold.yaml` for\n verification also.\n- Whether there are predeploy or postdeploy jobs for the phase\n\n If you're enabling predeploy or postdeploy jobs, you need to\n [configure](/deploy/docs/hooks) your `skaffold.yaml` for those jobs.\n\n#### Custom canary configuration elements\n\nThe following YAML shows the configuration for the phases of fully custom canary\ndeployment: \n\n strategy:\n canary:\n # Custom configuration for each canary phase\n customCanaryDeployment:\n phaseConfigs:\n - phaseId: \"\u003cvar label=\"phase 1\" translate=\"no\"\u003ePHASE1_NAME\u003c/var\u003e\"\n percentage: \u003cvar label=\"percent1\" translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003ePERCENTAGE1\u003c/span\u003e\u003c/var\u003e\n profiles: [ \"\u003cvar label=\"profile\" translate=\"no\"\u003ePROFILE_NAME\u003c/var\u003e\" ]\n verify: true | false\n predeploy:\n actions: \"\u003cvar translate=\"no\"\u003ePREDEPLOY_ACTION\u003c/var\u003e\"\n postdeploy:\n actions: \"\u003cvar translate=\"no\"\u003ePOSTDEPLOY_ACTION\u003c/var\u003e\"\n - ...\n - phaseId: \"stable\"\n percentage: 100\n profiles: [ \"\u003cvar label=\"profile n\" translate=\"no\"\u003eLAST_PROFILE_NAME\u003c/var\u003e\" ]\n verify: true|false\n predeploy:\n actions: \"\u003cvar translate=\"no\"\u003ePREDEPLOY_ACTION\u003c/var\u003e\"\n postdeploy:\n actions: \"\u003cvar translate=\"no\"\u003ePOSTDEPLOY_ACTION\u003c/var\u003e\"\n\nIn this YAML\n\n- \u003cvar label=\"phase 1\" translate=\"no\"\u003ePHASE1_NAME\u003c/var\u003e\n\n Is the name of the phase. Each phase name must be unique.\n- `[ \"`\u003cvar label=\"profile 1\" translate=\"no\"\u003ePROFILE_NAME\u003c/var\u003e`\" ]`\n\n Is the name of the profile to use for the phase. You can use the same profile\n for each phase, or a different one for each, or any combination. Also, you can\n specify more than one profile. Cloud Deploy uses all of the\n profiles you specify, *plus* the profile or manifest used by the overall\n stage.\n- `stable`\n\n The final phase must be named `stable`.\n- \u003cvar label=\"percent1\" translate=\"no\"\u003ePERCENTAGE1\u003c/var\u003e\n\n Is the percentage to deploy for the first phase. Each phase must have a unique\n percentage value, and that value must be a whole percentage (not `10.5`, for\n example), and the phases must be in ascending order.\n- `verify: true|false`\n\n Tells Cloud Deploy whether to include a verify job for the phase.\n Note that for each phase to use verify, Skaffold uses the same profile for\n verify that is specified for render and deploy for that phase.\n- \u003cvar translate=\"no\"\u003ePREDEPLOY_ACTION\u003c/var\u003e\n\n Is the same as the \u003cvar translate=\"no\"\u003eACTION_NAME\u003c/var\u003e that you used in your\n `skaffold.yaml` to define the custom action you want to run before deploying.\n- \u003cvar translate=\"no\"\u003ePOSTDEPLOY_ACTION\u003c/var\u003e\n\n Is the same as the \u003cvar translate=\"no\"\u003eACTION_NAME\u003c/var\u003e that you used in your\n `skaffold.yaml` to define the custom action you want to run after deploying.\n\nThe percentage for the last phase must be `100`. Phases are executed according\nin the order you configure them in this `customCanaryDeployment` stanza, but if\nthe percentage values are not in ascending order, the command to\n[register the delivery pipeline](/deploy/docs/create-pipeline-targets#register_the_delivery_pipeline_and_targets)\nfails with an error.\n\nNote that the configuration for a custom canary doesn't include a\n`runtimeConfig` stanza. If you include `runtimeConfig`, it's considered a\n[custom-automated canary](/deploy/docs/deployment-strategies/canary#types_of_canary).\n\nWhat's next\n-----------\n\n- Try the [canary deployment quickstart](/deploy/docs/deploy-app-canary).\n\n- Find out how to [manage the lifecycle of your canary's rollouts](/deploy/docs/deployment-strategies/manage-rollout).\n\n- Learn more about [parallel deployment](/deploy/docs/parallel).\n\n- Learn more about [Cloud Deploy deployment strategies](/deploy/docs/deployment-strategies)."]]