[Multi_K8s-Plugin] Canary Rollout#6583
Conversation
Signed-off-by: Mohammed Firdous <mohammedfirdousaraoye@gmail.com>
…ndService constant Signed-off-by: Mohammed Firdous <124298708+mohammedfirdouss@users.noreply.github.com>
…ions Signed-off-by: Mohammed Firdous <124298708+mohammedfirdouss@users.noreply.github.com>
Signed-off-by: Mohammed Firdous <124298708+mohammedfirdouss@users.noreply.github.com>
Signed-off-by: Mohammed Firdous <124298708+mohammedfirdouss@users.noreply.github.com>
|
@khanhtc1202 I have a question, am I meant to create example yml files for the pipecd-config, service and deployment to test fully? or it depends on how the user wants to setup their application. |
There was a problem hiding this comment.
Pull request overview
Implements a new K8S_CANARY_ROLLOUT stage for the kubernetes_multicluster plugin to deploy a canary variant across all targeted clusters in parallel.
Changes:
- Add canary rollout stage plumbing (stage constant + plugin dispatch) and stage options in config.
- Add manifest helpers to duplicate/generate variant resources (workloads/services/configmaps/secrets) and apply them as canary.
- Add testdata and unit tests for single-cluster, multi-cluster, and failure scenarios.
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/app/pipedv1/plugin/kubernetes_multicluster/provider/resource.go | Adds Service kind constant for resource classification. |
| pkg/app/pipedv1/plugin/kubernetes_multicluster/provider/manifest.go | Adds manifest utilities (DeepCopyWithName, NestedString, IsService). |
| pkg/app/pipedv1/plugin/kubernetes_multicluster/go.mod | Bumps plugin dependencies (pipecd, SDK) and yaml library; adds new indirect deps. |
| pkg/app/pipedv1/plugin/kubernetes_multicluster/go.sum | Updates sums for bumped/added dependencies. |
| pkg/app/pipedv1/plugin/kubernetes_multicluster/deployment/testdata/canary/deployment.yaml | Adds canary-related test manifest. |
| pkg/app/pipedv1/plugin/kubernetes_multicluster/deployment/testdata/canary/app.pipecd.yaml | Adds test app config used by canary tests. |
| pkg/app/pipedv1/plugin/kubernetes_multicluster/deployment/plugin.go | Dispatches the new K8S_CANARY_ROLLOUT stage to implementation. |
| pkg/app/pipedv1/plugin/kubernetes_multicluster/deployment/pipeline.go | Registers the new stage constant and description. |
| pkg/app/pipedv1/plugin/kubernetes_multicluster/deployment/misc.go | Adds helpers for generating/deleting variant resources (service/workload/config/secret). |
| pkg/app/pipedv1/plugin/kubernetes_multicluster/deployment/canary_test.go | Adds tests for canary rollout execution paths. |
| pkg/app/pipedv1/plugin/kubernetes_multicluster/deployment/canary.go | Implements canary manifest generation, patching, and parallel rollout per target. |
| pkg/app/pipedv1/plugin/kubernetes_multicluster/config/application.go | Adds stage options structs and service reference; adds custom JSON unmarshal w/ defaults. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Sorry, I merged #6518, which caused a merge conflict with this PR.
You need to create configs if you want to test on your local piped. From another point of view, it would be better to demonstrate how to use this plugin by including example configs in the repository. |
@Warashi Thanks for the feedback! I've added example configs mirroring the structure used in the single-cluster plugin. I also added tests for both paths — one that verifies the canary Service is created with the variant selector injected, and one that verifies no Service is created when createService is false. Will resolve the conflicts now. |
…anary rollout with and without service creation Signed-off-by: Mohammed Firdous <124298708+mohammedfirdouss@users.noreply.github.com>
Signed-off-by: Mohammed Firdous <124298708+mohammedfirdouss@users.noreply.github.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #6583 +/- ##
===========================================
+ Coverage 28.79% 45.41% +16.61%
===========================================
Files 575 86 -489
Lines 60858 8466 -52392
===========================================
- Hits 17526 3845 -13681
+ Misses 41997 4386 -37611
+ Partials 1335 235 -1100
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@Warashi I intend to create seperate individual branches for all deployment/development stages of this plugin. What best practice would you give here, eg. Should Canary have both rollout and clean stages in one branch or seperate branches etc. |
Yes, I want each stages implementations to be separate PRs, i.e. separate branches. |
Warashi
left a comment
There was a problem hiding this comment.
Thank you! LGTM
As I wrote above, please open another PR for Canary Clean stage.
Alright no problem, it is most likely going to cause a bit conflicts, but no issues. |
What this PR does: Implements the K8S_CANARY_ROLLOUT stage for the kubernetes_multicluster plugin. When this stage runs it deploys the new version as a small canary replica set (configurable by count or percentage) to all targeted clusters in parallel, while leaving the primary workload untouched.
Why we need it: The multicluster plugin previously only supported K8S_MULTI_SYNC (all-or-nothing rollout) and K8S_MULTI_ROLLBACK. There was no way to progressively test a new version across clusters before promoting it. K8S_CANARY_ROLLOUT fills that gap and is the first step toward a full canary/baseline/primary pipeline strategy for multi-cluster deployments.
Which issue(s) this PR fixes: Part of #6446
Fixes #
Does this PR introduce a user-facing change?:
Yes — users can now add a K8S_CANARY_ROLLOUT stage to their app.pipecd.yaml pipeline when using the kubernetes_multicluster plugin.
How are users affected by this change: Users who do not use a pipeline are unaffected. Users who configure a pipeline can now add K8S_CANARY_ROLLOUT with replicas, suffix, createService, and patches options.
Is this breaking change: No
How to migrate (if breaking change): N/A