Skip to content

Commit

Permalink
Merge pull request #64 from razo7/end-reconcile-after-finalizer-addition
Browse files Browse the repository at this point in the history
End Reconcile after Finalizer Addition
  • Loading branch information
openshift-merge-robot authored Jul 9, 2023
2 parents a50d9f6 + 3c94365 commit 9893bf8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions controllers/fenceagentsremediation_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ func (r *FenceAgentsRemediationReconciler) Reconcile(ctx context.Context, req ct
if err := r.Client.Update(context.Background(), far); err != nil {
return emptyResult, fmt.Errorf("failed to add finalizer to the CR - %w", err)
}
r.Log.Info("Finalizer was added", "CR Name", req.Name)
return emptyResult, nil
// TODO: should return Requeue: true when the CR has a status and not end reconcile with empty result when a finalizer has been added
//return ctrl.Result{Requeue: true}, nil
} else if controllerutil.ContainsFinalizer(far, v1alpha1.FARFinalizer) && !far.ObjectMeta.DeletionTimestamp.IsZero() {
// Delete CR only when a finalizer and DeletionTimestamp are set
r.Log.Info("CR's deletion timestamp is not zero, and FAR finalizer exists", "CR Name", req.Name)
Expand Down

0 comments on commit 9893bf8

Please sign in to comment.