Skip to content

Commit

Permalink
remove dataimage finalizer if bmh is missing
Browse files Browse the repository at this point in the history
Signed-off-by: Himanshu Roy <hroy@redhat.com>
  • Loading branch information
hroyrh committed Nov 22, 2024
1 parent b99b337 commit ab830c2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion controllers/metal3.io/dataimage_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,13 @@ func (r *DataImageReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
if err := r.Get(ctx, req.NamespacedName, bmh); err != nil {
// There might not be any BareMetalHost for the DataImage
if k8serrors.IsNotFound(err) {
reqLogger.Info("bareMetalHost not found for the dataImage")
reqLogger.Info("bareMetalHost not found for the dataImage, remove finalizer if it exists")
di.Finalizers = utils.FilterStringFromList(
di.Finalizers, metal3api.DataImageFinalizer)

if err := r.Update(ctx, di); err != nil {
return ctrl.Result{Requeue: true, RequeueAfter: dataImageRetryDelay}, fmt.Errorf("failed to update resource after remove finalizer, %w", err)
}
return ctrl.Result{}, nil
}

Expand Down

0 comments on commit ab830c2

Please sign in to comment.