Skip to content

Commit

Permalink
Remove WatcherAPI finalizer from memcached
Browse files Browse the repository at this point in the history
Remove the added WatcherAPI finalizer from the memcached instance. The
finalizer is added but not removed in the reconcileDelete due to an
oversight.
  • Loading branch information
cescgina authored and openshift-merge-bot[bot] committed Jan 13, 2025
1 parent 03067fa commit 326b44d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions controllers/watcherapi_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,20 @@ func (r *WatcherAPIReconciler) reconcileDelete(ctx context.Context, instance *wa
Log := r.GetLogger(ctx)
Log.Info(fmt.Sprintf("Reconcile Service '%s' delete started", instance.Name))

// Remove our finalizer from Memcached
memcached, err := memcachedv1.GetMemcachedByName(ctx, helper, instance.Spec.MemcachedInstance, instance.Namespace)
if err != nil && !k8s_errors.IsNotFound(err) {
return ctrl.Result{}, nil
}
if memcached != nil {
if controllerutil.RemoveFinalizer(memcached, helper.GetFinalizer()) {
err := helper.GetClient().Update(ctx, memcached)
if err != nil {
return ctrl.Result{}, err
}
}
}

controllerutil.RemoveFinalizer(instance, helper.GetFinalizer())
Log.Info(fmt.Sprintf("Reconciled Service '%s' delete successfully", instance.Name))
return ctrl.Result{}, nil
Expand Down

0 comments on commit 326b44d

Please sign in to comment.