Skip to content

Commit

Permalink
Merge pull request #84 from razo7/stop-update-status-no-finalizer
Browse files Browse the repository at this point in the history
Stop Update Status When a Finalizer is Missing
  • Loading branch information
openshift-ci[bot] authored Oct 5, 2023
2 parents 5a05b0d + a046ac6 commit b2d3419
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions controllers/fenceagentsremediation_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,11 @@ func isTimedOutByNHC(far *v1alpha1.FenceAgentsRemediation) bool {

// updateStatus updates the CR status, and returns an error if it fails
func (r *FenceAgentsRemediationReconciler) updateStatus(ctx context.Context, far *v1alpha1.FenceAgentsRemediation) error {
// When CR doesn't include a finalizer and the CR deletionTimestamp exsists
// then we can skip update, since it will be removed soon.
if !controllerutil.ContainsFinalizer(far, v1alpha1.FARFinalizer) && !far.ObjectMeta.DeletionTimestamp.IsZero() {
return nil
}
if err := r.Client.Status().Update(ctx, far); err != nil {
if !apiErrors.IsConflict(err) {
r.Log.Error(err, "failed to update far status in case on a non conflict")
Expand Down

0 comments on commit b2d3419

Please sign in to comment.