Skip to content

Commit 95bfc18

Browse files
committed
add an event if deletion is blocked
1 parent e17a9bc commit 95bfc18

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/component/reconcile.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,15 +369,15 @@ func (r *Reconciler[T]) Reconcile(ctx context.Context, req ctrl.Request) (result
369369
}
370370
log.V(1).Info("deletion not allowed")
371371
// TODO: have an additional StateDeletionBlocked?
372-
// TODO: emit an event
373372
status.SetState(StateDeleting, readyConditionReasonDeletionBlocked, "Deletion blocked: "+msg)
373+
r.client.EventRecorder().Event(component, corev1.EventTypeNormal, readyConditionReasonDeletionBlocked, "Deletion blocked: "+msg)
374374
return ctrl.Result{RequeueAfter: 1*time.Second + r.backoff.Next(req, readyConditionReasonDeletionBlocked)}, nil
375375
} else if len(slices.Remove(component.GetFinalizers(), r.name)) > 0 {
376376
// deletion is blocked because of foreign finalizers
377377
log.V(1).Info("deleted blocked due to existence of foreign finalizers")
378378
// TODO: have an additional StateDeletionBlocked?
379-
// TODO: emit an event
380379
status.SetState(StateDeleting, readyConditionReasonDeletionBlocked, "Deletion blocked due to existing foreign finalizers")
380+
r.client.EventRecorder().Event(component, corev1.EventTypeNormal, readyConditionReasonDeletionBlocked, "Deletion blocked due to existing foreign finalizers")
381381
return ctrl.Result{RequeueAfter: 1*time.Second + r.backoff.Next(req, readyConditionReasonDeletionBlocked)}, nil
382382
} else {
383383
// deletion case

0 commit comments

Comments
 (0)