Skip to content

Commit

Permalink
Merge pull request #160 from kajinamit/remove-finalizer-update
Browse files Browse the repository at this point in the history
Skip redundant update when removing a finalizer
  • Loading branch information
openshift-merge-robot authored Aug 2, 2023
2 parents 5cac9bf + e0c2be9 commit 67049bf
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions controllers/ceilometercentral_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,13 @@ func (r *CeilometerCentralReconciler) reconcileDelete(ctx context.Context, insta
}

if err == nil {
controllerutil.RemoveFinalizer(keystoneService, helper.GetFinalizer())
if err = helper.GetClient().Update(ctx, keystoneService); err != nil && !k8s_errors.IsNotFound(err) {
return ctrl.Result{}, err
if controllerutil.RemoveFinalizer(keystoneService, helper.GetFinalizer()) {
err = r.Update(ctx, keystoneService)
if err != nil && !k8s_errors.IsNotFound(err) {
return ctrl.Result{}, err
}
util.LogForObject(helper, "Removed finalizer from our KeystoneService", instance)
}
util.LogForObject(helper, "Removed finalizer from our KeystoneService", instance)
}

// Service is deleted so remove the finalizer.
Expand Down

0 comments on commit 67049bf

Please sign in to comment.