Skip to content

[Multi_K8s-Plugin] Canary Clean#6589

Open
mohammedfirdouss wants to merge 5 commits intopipe-cd:masterfrom
mohammedfirdouss:feat/k8s-multi-canary-clean
Open

[Multi_K8s-Plugin] Canary Clean#6589
mohammedfirdouss wants to merge 5 commits intopipe-cd:masterfrom
mohammedfirdouss:feat/k8s-multi-canary-clean

Conversation

@mohammedfirdouss
Copy link
Contributor

What this PR does: Implements the K8S_CANARY_CLEAN stage for the kubernetes_multicluster plugin. When this stage runs, it deletes all canary variant resources (labelled pipecd.dev/variant: canary) from every targeted cluster in parallel, completing the canary lifecycle after evaluation. The stage uses the existing deleteVariantResources helper and follows the same errgroup orchestration pattern as K8S_CANARY_ROLLOUT for consistency.

Why we need it: The multicluster plugin now supports canary deployments with K8S_CANARY_ROLLOUT, but lacked a way to clean up canary resources after evaluation. K8S_CANARY_CLEAN enables the complete canary/baseline/primary pipeline strategy by providing a dedicated cleanup step, preventing canary replicas from persisting in the cluster and reducing resource waste. This completes the canary workflow and ensures a clean state for subsequent promotions.

Which issue(s) this PR fixes: Part of #6446

Does this PR introduce a user-facing change?:

Yes — users can now add a K8S_CANARY_CLEAN 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 canary pipeline can now add K8S_CANARY_CLEAN as a post-evaluation step to automatically remove canary resources across all targeted clusters. This stage requires no additional configuration options—it simply deletes all resources with the canary variant label.

Is this breaking change: No
How to migrate (if breaking change): N/A

Signed-off-by: Mohammed Firdous <mohammedfirdousaraoye@gmail.com>
Signed-off-by: Mohammed Firdous <mohammedfirdousaraoye@gmail.com>
…ions

Signed-off-by: Mohammed Firdous <mohammedfirdousaraoye@gmail.com>
@codecov
Copy link

codecov bot commented Mar 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 36.52%. Comparing base (25601c8) to head (ab35e4a).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6589      +/-   ##
==========================================
+ Coverage   28.79%   36.52%   +7.73%     
==========================================
  Files         575       17     -558     
  Lines       60858      876   -59982     
==========================================
- Hits        17526      320   -17206     
+ Misses      41997      533   -41464     
+ Partials     1335       23    -1312     
Flag Coverage Δ
. ?
.-pkg-app-pipedv1-plugin-analysis ?
.-pkg-app-pipedv1-plugin-ecs ?
.-pkg-app-pipedv1-plugin-kubernetes ?
.-pkg-app-pipedv1-plugin-kubernetes_multicluster ?
.-pkg-app-pipedv1-plugin-scriptrun ?
.-pkg-app-pipedv1-plugin-terraform 37.95% <ø> (ø)
.-pkg-app-pipedv1-plugin-wait ?
.-pkg-app-pipedv1-plugin-waitapproval 52.71% <ø> (ø)
.-pkg-plugin-sdk ?
.-tool-actions-gh-release ?
.-tool-actions-plan-preview ?
.-tool-codegen-protoc-gen-auth 0.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mohammedfirdouss
Copy link
Contributor Author

mohammedfirdouss commented Mar 14, 2026

@Warashi This is the PR for Canary Clean, I will resolve the merge conflicts shortly

Also, there is no need for testdata right? Clean doesn't load manifests at all, it just queries live resources by label and deletes them.

…multi-cluster deployments

Signed-off-by: Mohammed Firdous <124298708+mohammedfirdouss@users.noreply.github.com>
Signed-off-by: Mohammed Firdous <124298708+mohammedfirdouss@users.noreply.github.com>
@mohammedfirdouss mohammedfirdouss changed the title [Multi_K8s-Plugin] Multi Canary Clean [Multi_K8s-Plugin] Canary Clean Mar 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant