Skip to content

Commit

Permalink
ECOPROJECT-1829
Browse files Browse the repository at this point in the history
Verify that Remediation started event isn't spammed

Signed-off-by: Michael Shitrit <[email protected]>
  • Loading branch information
mshitrit committed Jan 15, 2024
1 parent af81a44 commit 953ded5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion controllers/selfnoderemediation_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,11 @@ func (r *SelfNodeRemediationReconciler) Reconcile(ctx context.Context, req ctrl.
r.logger.Error(err, "failed to get SNR")
return ctrl.Result{}, err
}
events.RemediationStarted(r.Recorder, snr)

//used as an indication not to spam the event
if isFinalizerAlreadyAdded := controllerutil.ContainsFinalizer(snr, SNRFinalizer); !isFinalizerAlreadyAdded {
events.RemediationStarted(r.Recorder, snr)
}

defer func() {
if updateErr := r.updateSnrStatus(ctx, snr); updateErr != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ var _ = Describe("SNR Controller", func() {
It("Remediation flow", func() {
node := verifyNodeIsUnschedulable()

verifyEvent("Normal", "RemediationCreated", "Remediation started")
verifyEvent("Normal", "RemediationStarted", "[remediation] Remediation started")

verifyEvent("Normal", "MarkUnschedulable", "Remediation process - unhealthy node marked as unschedulable")

Expand Down

0 comments on commit 953ded5

Please sign in to comment.