feat: Add option to mute alerts generated from webhooks

Signed-off-by: Mayank Shah <mayankshah1614@gmail.com>
This commit is contained in:
Mayank Shah
2021-04-23 11:27:09 +05:30
parent 3e845f1a29
commit 975b84a2eb
4 changed files with 18 additions and 3 deletions
+3
View File
@@ -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
+3
View File
@@ -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
+3
View File
@@ -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"`
+9 -3
View File
@@ -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 {