Skip to content

Commit

Permalink
Update RemoveFinalizer to RemoveRemediationCR event
Browse files Browse the repository at this point in the history
RemoveFinalizer event is a not needed as finalizer is not that important while RemoveRemediationCR suits better for this use case that the remediation CR was deleted
  • Loading branch information
razo7 committed Jan 24, 2024
1 parent d9382b2 commit 89db554
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion controllers/fenceagentsremediation_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func (r *FenceAgentsRemediationReconciler) Reconcile(ctx context.Context, req ct
return emptyResult, fmt.Errorf("failed to remove finalizer from CR - %w", err)
}
r.Log.Info("Finalizer was removed", "CR Name", req.Name)
commonEvents.NormalEvent(r.Recorder, far, utils.EventReasonRemoveFinalizer, utils.EventMessageRemoveFinalizer)
commonEvents.NormalEvent(r.Recorder, far, utils.EventReasonRemoveRemediationCR, utils.EventMessageRemoveRemediationCR)
return emptyResult, nil
}
// Add FAR (medik8s) remediation taint
Expand Down
1 change: 1 addition & 0 deletions controllers/fenceagentsremediation_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,7 @@ func cleanupFar() func(ctx context.Context, far *v1alpha1.FenceAgentsRemediation
}
return deleteErr
}, pollInterval, timeoutPostRemediation).Should(BeNil(), "CR should be deleted")
verifyEvent(corev1.EventTypeNormal, utils.EventReasonRemoveRemediationCR, utils.EventMessageRemoveRemediationCR)
clearEvents()
return nil
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/utils/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const (
EventReasonCrNodeNotFound = "NodeNotFound"
EventReasonRemediationStoppedByNHC = "RemediationStoppedByNHC"
EventReasonRemoveRemediationTaint = "RemoveRemediationTaint"
EventReasonRemoveFinalizer = "RemoveFinalizer"
EventReasonRemoveRemediationCR = "RemoveRemediationCR"
EventReasonAddRemediationTaint = "AddRemediationTaint"
EventReasonFenceAgentExecuted = "FenceAgentExecuted"
EventReasonFenceAgentSucceeded = "FenceAgentSucceeded"
Expand All @@ -20,7 +20,7 @@ const (
EventMessageCrNodeNotFound = "CR name doesn't match a node name"
EventMessageRemediationStoppedByNHC = "Remediation was stopped by the Node Healthcheck Operator"
EventMessageRemoveRemediationTaint = "Remediation taint was removed"
EventMessageRemoveFinalizer = "Finalizer was removed"
EventMessageRemoveRemediationCR = "FAR Remediation CR was removed"
EventMessageAddRemediationTaint = "Remediation taint was added"
EventMessageFenceAgentExecuted = "Fence agent was executed"
EventMessageFenceAgentSucceeded = "Fence agent was succeeded"
Expand Down

0 comments on commit 89db554

Please sign in to comment.