Skip alert if it's not ready
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
This commit is contained in:
parent
6c855a22bc
commit
9ba52a45e5
|
|
@ -127,6 +127,11 @@ func (r *AlertReconciler) validate(ctx context.Context, alert v1beta1.Alert) err
|
|||
if err := r.Get(ctx, providerName, &provider); err != nil {
|
||||
return fmt.Errorf("failed to get provider %s, error: %w", providerName.String(), err)
|
||||
}
|
||||
|
||||
if !meta.HasReadyCondition(provider.Status.Conditions) {
|
||||
return fmt.Errorf("provider %s is not ready", providerName.String())
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import (
|
|||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
|
||||
"github.com/fluxcd/pkg/apis/meta"
|
||||
"github.com/fluxcd/pkg/recorder"
|
||||
|
||||
"github.com/fluxcd/notification-controller/api/v1beta1"
|
||||
|
|
@ -64,8 +65,8 @@ func (s *EventServer) handleEvent() func(w http.ResponseWriter, r *http.Request)
|
|||
// find matching alerts
|
||||
alerts := make([]v1beta1.Alert, 0)
|
||||
for _, alert := range allAlerts.Items {
|
||||
// skip suspended alerts
|
||||
if alert.Spec.Suspend {
|
||||
// skip suspended and not ready alerts
|
||||
if alert.Spec.Suspend || !meta.HasReadyCondition(alert.Status.Conditions) {
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue