Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,14 @@ func (r *Reconciler) patchUnhealthyTargets(ctx context.Context, logger logr.Logg
klog.KObj(t.Machine),
klog.KObj(t.MHC),
)
// Record event on MachineHealthCheck to track remediation history
r.recorder.Eventf(
m,
corev1.EventTypeNormal,
EventRemediationTriggered,
"Triggered remediation for unhealthy Machine %s",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation is not triggered by MHC, MHC only marks the machine as unhealthy (as well as it unmarks it in case it goes back to healthy).

Also, I would not add the name of the machine to an event added to the machine itself, it is redundant. May be, let's consider instead to track which MHC instance applied the event

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as well as it unmarks it in case it goes back to healthy

Should I handle this as well?

klog.KObj(t.Machine),
)
}
return errList
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ const (

// EventMachineMarkedUnhealthy is emitted when machine was successfully marked as unhealthy.
EventMachineMarkedUnhealthy string = "MachineMarkedUnhealthy"
// EventRemediationTriggered is emitted when MachineHealthCheck triggers remediation for an unhealthy machine.
EventRemediationTriggered string = "RemediationTriggered"
)

var (
Expand Down