Skip to content

Commit 668f14c

Browse files
Merge pull request #142 from shiftstack/events-on-update
OCPBUGS-67298: Don't record event for every reconcile
2 parents b5a300c + 564b1a2 commit 668f14c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pkg/machine/actuator.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ func (oc *OpenstackClient) Update(ctx context.Context, machine *machinev1.Machin
176176
}
177177

178178
func (oc *OpenstackClient) reconcile(ctx context.Context, machine *machinev1.Machine) error {
179+
originalResourceVersion := machine.ResourceVersion
180+
179181
machineSpec, err := clients.MachineSpecFromProviderSpec(machine.Spec.ProviderSpec)
180182
if err != nil {
181183
return maoMachine.InvalidMachineConfiguration("Cannot unmarshal providerSpec for %s: %v", machine.Name, err)
@@ -233,7 +235,10 @@ func (oc *OpenstackClient) reconcile(ctx context.Context, machine *machinev1.Mac
233235
return err
234236
}
235237

236-
oc.eventRecorder.Eventf(machine, corev1.EventTypeNormal, "Reconciled", "Reconciled machine %v", machine.Name)
238+
// Only record the Updated event if the machine was actually modified
239+
if machine.ResourceVersion != originalResourceVersion {
240+
oc.eventRecorder.Eventf(machine, corev1.EventTypeNormal, "Updated", "Updated machine %v", machine.Name)
241+
}
237242
return nil
238243
}
239244

0 commit comments

Comments
 (0)