Skip to content

Commit

Permalink
Merge pull request #10617 from k8s-infra-cherrypick-robot/cherry-pick…
Browse files Browse the repository at this point in the history
…-10591-to-release-1.6

[release-1.6] 🐛 Skip publishing the `RemediationRestricted` event when there are no unhealthy target
  • Loading branch information
k8s-ci-robot committed May 15, 2024
2 parents 48c0ac8 + ab78f3f commit 9edcb47
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -280,12 +280,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 the `RemediationRestricted` 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 9edcb47

Please sign in to comment.