Skip to content

Commit fca381a

Browse files
authored
events: Remove duplicated 'Available' events (#1922)
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]>
1 parent 608031a commit fca381a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/controller/statusmanager/status_manager.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,11 @@ func (status *StatusManager) set(reachedAvailableLevel bool, conditions ...condi
159159
)
160160
} else if reachedAvailableLevel {
161161
// If successfully deployed all components and is not failing on anything, mark as Available
162-
status.eventEmitter.EmitAvailableForConfig()
162+
if conditionsv1.IsStatusConditionFalse(config.Status.Conditions, conditionsv1.ConditionAvailable) {
163+
// Emit event only if conditions changes from false to true to
164+
// so we don't duplicate events
165+
status.eventEmitter.EmitAvailableForConfig()
166+
}
163167
conditionsv1.SetStatusConditionNoHeartbeat(&config.Status.Conditions,
164168
conditionsv1.Condition{
165169
Type: conditionsv1.ConditionAvailable,

0 commit comments

Comments
 (0)