Skip to content

Commit

Permalink
Merge pull request #887 from mayankshah1607/mayank/alert-muting
Browse files Browse the repository at this point in the history
feat: Add option to mute alerts generated from webhooks
  • Loading branch information
stefanprodan authored Apr 28, 2021
2 parents 927b432 + 05b0557 commit a590968
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
3 changes: 3 additions & 0 deletions artifacts/flagger/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions charts/flagger/crds/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions pkg/apis/flagger/v1beta1/canary.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`

Expand Down
12 changes: 9 additions & 3 deletions pkg/controller/scheduler_hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit a590968

Please sign in to comment.