diff --git a/artifacts/flagger/crd.yaml b/artifacts/flagger/crd.yaml index d2fb67dda..67fb22e8d 100644 --- a/artifacts/flagger/crd.yaml +++ b/artifacts/flagger/crd.yaml @@ -941,6 +941,9 @@ spec: - event - rollback - confirm-traffic-increase + muteAlert: + description: Mute all alerts for the webhook + type: boolean url: description: URL address of this webhook type: string diff --git a/charts/flagger/crds/crd.yaml b/charts/flagger/crds/crd.yaml index d2fb67dda..67fb22e8d 100644 --- a/charts/flagger/crds/crd.yaml +++ b/charts/flagger/crds/crd.yaml @@ -941,6 +941,9 @@ spec: - event - rollback - confirm-traffic-increase + muteAlert: + description: Mute all alerts for the webhook + type: boolean url: description: URL address of this webhook type: string diff --git a/pkg/apis/flagger/v1beta1/canary.go b/pkg/apis/flagger/v1beta1/canary.go index a660095b7..7579b7c2a 100644 --- a/pkg/apis/flagger/v1beta1/canary.go +++ b/pkg/apis/flagger/v1beta1/canary.go @@ -329,6 +329,9 @@ type CanaryWebhook struct { // URL address of this webhook URL string `json:"url"` + // MuteAlert mutes all alerts generated from this webhook, if any + MuteAlert bool `json:"muteAlert"` + // Request timeout for this webhook Timeout string `json:"timeout,omitempty"` diff --git a/pkg/controller/scheduler_hooks.go b/pkg/controller/scheduler_hooks.go index b17783ac8..e7cdffba5 100644 --- a/pkg/controller/scheduler_hooks.go +++ b/pkg/controller/scheduler_hooks.go @@ -30,7 +30,9 @@ func (c *Controller) runConfirmTrafficIncreaseHooks(canary *flaggerv1.Canary) bo if err != nil { c.recordEventWarningf(canary, "Halt %s.%s advancement waiting for traffic increase approval %s", canary.Name, canary.Namespace, webhook.Name) - c.alert(canary, "Canary traffic increase is waiting for approval.", false, flaggerv1.SeverityWarn) + if !webhook.MuteAlert { + c.alert(canary, "Canary traffic increase is waiting for approval.", false, flaggerv1.SeverityWarn) + } return false } c.recordEventInfof(canary, "Confirm-traffic-increase check %s passed", webhook.Name) @@ -50,7 +52,9 @@ func (c *Controller) runConfirmRolloutHooks(canary *flaggerv1.Canary, canaryCont } c.recordEventWarningf(canary, "Halt %s.%s advancement waiting for approval %s", canary.Name, canary.Namespace, webhook.Name) - c.alert(canary, "Canary is waiting for approval.", false, flaggerv1.SeverityWarn) + if !webhook.MuteAlert { + c.alert(canary, "Canary is waiting for approval.", false, flaggerv1.SeverityWarn) + } } return false } else { @@ -79,7 +83,9 @@ func (c *Controller) runConfirmPromotionHooks(canary *flaggerv1.Canary, canaryCo } c.recordEventWarningf(canary, "Halt %s.%s advancement waiting for promotion approval %s", canary.Name, canary.Namespace, webhook.Name) - c.alert(canary, "Canary promotion is waiting for approval.", false, flaggerv1.SeverityWarn) + if !webhook.MuteAlert { + c.alert(canary, "Canary promotion is waiting for approval.", false, flaggerv1.SeverityWarn) + } } return false } else {