Skip to content

Commit

Permalink
🐛 Skip publishing the RemediationRestricted event when there are no u…
Browse files Browse the repository at this point in the history
…nhealty target
  • Loading branch information
Levi080513 committed May 14, 2024
1 parent 180b50f commit b973a05
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -279,12 +279,15 @@ func (r *Reconciler) reconcile(ctx context.Context, logger logr.Logger, cluster
Message: message,
})

r.recorder.Event(
m,
corev1.EventTypeWarning,
EventRemediationRestricted,
message,
)
// If there are no unhealthy target, skip publishing an event to avoid misleading.
if len(unhealthy) != 0 {
r.recorder.Event(
m,
corev1.EventTypeWarning,
EventRemediationRestricted,
message,
)
}
errList := []error{}
for _, t := range append(healthy, unhealthy...) {
if err := t.patchHelper.Patch(ctx, t.Machine); err != nil {
Expand Down

0 comments on commit b973a05

Please sign in to comment.