[Multi_K8s-Plugin] Prune orphaned resources on rollback#6748
Conversation
Signed-off-by: Mohammed Firdous <124298708+mohammedfirdouss@users.noreply.github.com>
6edf250 to
41df9e4
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6748 +/- ##
===========================================
+ Coverage 29.33% 62.14% +32.81%
===========================================
Files 598 30 -568
Lines 63902 3751 -60151
===========================================
- Hits 18744 2331 -16413
+ Misses 43711 1235 -42476
+ Partials 1447 185 -1262 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:
|
Signed-off-by: Mohammed Firdous <124298708+mohammedfirdouss@users.noreply.github.com>
| } else if len(namespacedLiveResources)+len(clusterScopedLiveResources) > 0 { | ||
| removeKeys := provider.FindRemoveResources(manifests, namespacedLiveResources, clusterScopedLiveResources) | ||
| if len(removeKeys) == 0 { | ||
| lp.Info("There are no live resources to prune") |
There was a problem hiding this comment.
It's good to log this info even when len(namespacedLiveResources)+len(clusterScopedLiveResources) == 0.
There was a problem hiding this comment.
Yeah exactly.
There was a problem hiding this comment.
@mohammedfirdouss This does not seem to be resolved. Please check?
There was a problem hiding this comment.
Lint check failed for now...
There was a problem hiding this comment.
I will add the log too
Signed-off-by: Mohammed Firdous <124298708+mohammedfirdouss@users.noreply.github.com>
|
@Warashi this need review. |
… are found Signed-off-by: Mohammed Firdous <124298708+mohammedfirdouss@users.noreply.github.com>
… are found Signed-off-by: Mohammed Firdous <124298708+mohammedfirdouss@users.noreply.github.com>
|
Thank you for contributing to PipeCD! The changes in this pull request will be part of the upcoming release! |
What this PR does / Why we need it:
Implements rollback pruning in the
kubernetes_multiclusterplugin. When a deployment pipeline fails mid-way, the ROLLBACK stage re-applies the last known good manifests but any new resource introduced by the failed deployment (e.g. a ConfigMap or Service already applied to the cluster) was never deleted, leaving orphaned resources that cause permanent live-state drift.After applying the running manifests and cleaning up canary/baseline variants, rollback now:
TargetDeploymentSourcefindOrphanedKeys)pruneOrphanedResources)Errors during target manifest loading are non-fatal, logged and skipped so a Helm/Kustomize rendering failure cannot prevent the rollback from completing.
Which issue(s) this PR fixes:
Part of #6446
How was this tested:
Unit tests added to
deployment/misc_test.goforfindOrphanedKeyscovering:Note on single-cluster plugin:
The same TODO exists in
pkg/app/pipedv1/plugin/kubernetes/deployment/rollback.go. That plugin is out of scope for this PR.