Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add option to mute alerts generated from webhooks #887

Merged
merged 2 commits into from
Apr 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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