Skip to content

Commit

Permalink
Fix indefintely increasing status events
Browse files Browse the repository at this point in the history
  • Loading branch information
Tharsanan1 committed Oct 8, 2024
1 parent 2553f6c commit 03f7b6a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion adapter/internal/operator/controllers/dp/api_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -2723,7 +2723,14 @@ func (apiReconciler *APIReconciler) handleStatus() {
hCopy.Status.DeploymentStatus.Status = successEvent.State
hCopy.Status.DeploymentStatus.Accepted = accept
hCopy.Status.DeploymentStatus.Message = message
hCopy.Status.DeploymentStatus.Events = append(hCopy.Status.DeploymentStatus.Events, event)
events := hCopy.Status.DeploymentStatus.Events
// Keep the first 2 and last 3 events, remove the rest
if len(events) > 6 {
// Truncate the events and add the special event
events = append(events[:2], events[len(events)-3:]...)
}

hCopy.Status.DeploymentStatus.Events = append(events, event)
hCopy.Status.DeploymentStatus.TransitionTime = &timeNow
return hCopy
},
Expand Down

0 comments on commit 03f7b6a

Please sign in to comment.