diff --git a/controllers/alertmanagerconfig_controller.go b/controllers/alertmanagerconfig_controller.go index d40ce40..1698853 100644 --- a/controllers/alertmanagerconfig_controller.go +++ b/controllers/alertmanagerconfig_controller.go @@ -257,7 +257,7 @@ func (r *AlertmanagerConfigReconciler) deleteWebhooksFromRelatedAlerts(ctx conte } for _, alert := range alerts.Items { - alert.Spec.NotificationGroups = []coralogixv1alpha1.NotificationGroup{{}} + alert.Spec.NotificationGroups = nil if err := r.Update(ctx, &alert); err != nil { return fmt.Errorf("received an error while trying to update Alert CRD from AlertmanagerConfig: %w", err) } @@ -315,7 +315,9 @@ func generateNotificationGroupFromRoutes(matchedRoutes []*prometheus.Route, matc notificationsGroups = append(notificationsGroups, notificationsGroup) } - + if len(notificationsGroups) == 0 { + return nil, nil + } return notificationsGroups, nil }