Skip to content

Commit

Permalink
events: Remove duplicated 'Available' events (#1922)
Browse files Browse the repository at this point in the history
CNAO is emitting  config 'Availabe' event after each reconcile even
when nothing changes, this add noise to users. This change emits the
event only if Available changes from false to true.

Signed-off-by: Enrique Llorente <[email protected]>
  • Loading branch information
qinqon authored Oct 25, 2024
1 parent 608031a commit fca381a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/controller/statusmanager/status_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,11 @@ func (status *StatusManager) set(reachedAvailableLevel bool, conditions ...condi
)
} else if reachedAvailableLevel {
// If successfully deployed all components and is not failing on anything, mark as Available
status.eventEmitter.EmitAvailableForConfig()
if conditionsv1.IsStatusConditionFalse(config.Status.Conditions, conditionsv1.ConditionAvailable) {
// Emit event only if conditions changes from false to true to
// so we don't duplicate events
status.eventEmitter.EmitAvailableForConfig()
}
conditionsv1.SetStatusConditionNoHeartbeat(&config.Status.Conditions,
conditionsv1.Condition{
Type: conditionsv1.ConditionAvailable,
Expand Down

0 comments on commit fca381a

Please sign in to comment.