[Multi_K8s-Plugin] Prune orphaned resources on rollback#6748
Open
mohammedfirdouss wants to merge 2 commits intopipe-cd:masterfrom
Open
[Multi_K8s-Plugin] Prune orphaned resources on rollback#6748mohammedfirdouss wants to merge 2 commits intopipe-cd:masterfrom
mohammedfirdouss wants to merge 2 commits intopipe-cd:masterfrom
Conversation
Signed-off-by: Mohammed Firdous <124298708+mohammedfirdouss@users.noreply.github.com>
6edf250 to
41df9e4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.This PR resolves the explicit TODO in
rollback.go: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.