@@ -567,8 +567,11 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.
567
567
u .UpdateStatus (updater .EnsureCondition (conditions .Initialized (corev1 .ConditionTrue , "" , "" )))
568
568
569
569
if obj .GetDeletionTimestamp () != nil {
570
- err := r .handleDeletion (ctx , actionClient , obj , log )
571
- return ctrl.Result {}, err
570
+ if err := r .handleDeletion (ctx , actionClient , obj , log ); err != nil {
571
+ return ctrl.Result {}, err
572
+ }
573
+ u .CancelUpdates ()
574
+ return ctrl.Result {}, nil
572
575
}
573
576
574
577
vals , err := r .getValues (ctx , obj )
@@ -660,28 +663,27 @@ const (
660
663
)
661
664
662
665
func (r * Reconciler ) handleDeletion (ctx context.Context , actionClient helmclient.ActionInterface , obj * unstructured.Unstructured , log logr.Logger ) error {
663
- if ! controllerutil .ContainsFinalizer (obj , uninstallFinalizer ) {
664
- log .Info ("Resource is terminated, skipping reconciliation" )
665
- return nil
666
- }
667
-
668
- // Use defer in a closure so that it executes before we wait for
669
- // the deletion of the CR. This might seem unnecessary since we're
670
- // applying changes to the CR after is has a deletion timestamp.
671
- // However, if uninstall fails, the finalizer will not be removed
672
- // and we need to be able to update the conditions on the CR to
673
- // indicate that the uninstall failed.
674
- if err := func () (err error ) {
675
- uninstallUpdater := updater .New (r .client )
676
- defer func () {
677
- applyErr := uninstallUpdater .Apply (ctx , obj )
678
- if err == nil {
679
- err = applyErr
680
- }
681
- }()
682
- return r .doUninstall (actionClient , & uninstallUpdater , obj , log )
683
- }(); err != nil {
684
- return err
666
+ if controllerutil .ContainsFinalizer (obj , uninstallFinalizer ) {
667
+ // Use defer in a closure so that it executes before we wait for
668
+ // the deletion of the CR. This might seem unnecessary since we're
669
+ // applying changes to the CR after is has a deletion timestamp.
670
+ // However, if uninstall fails, the finalizer will not be removed
671
+ // and we need to be able to update the conditions on the CR to
672
+ // indicate that the uninstall failed.
673
+ if err := func () (err error ) {
674
+ uninstallUpdater := updater .New (r .client )
675
+ defer func () {
676
+ applyErr := uninstallUpdater .Apply (ctx , obj )
677
+ if err == nil {
678
+ err = applyErr
679
+ }
680
+ }()
681
+ return r .doUninstall (actionClient , & uninstallUpdater , obj , log )
682
+ }(); err != nil {
683
+ return err
684
+ }
685
+ } else {
686
+ log .Info ("Resource is already terminated, skipping deletion." )
685
687
}
686
688
687
689
// Since the client is hitting a cache, waiting for the
0 commit comments