From 163f5292b0a44b860f888b1a075e776fb00fa404 Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Thu, 25 Jul 2019 19:10:46 +0300 Subject: [PATCH] Push a notification when a canary is waiting for approval --- docs/gitbook/how-it-works.md | 3 ++- pkg/controller/scheduler.go | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/gitbook/how-it-works.md b/docs/gitbook/how-it-works.md index bec6f796e..483b6226a 100644 --- a/docs/gitbook/how-it-works.md +++ b/docs/gitbook/how-it-works.md @@ -901,7 +901,8 @@ Manual gating with Flagger's tester: url: http://flagger-loadtester.test/gate/halt ``` -The `/gate/halt` returns HTTP 403 thus blocking the rollout. +The `/gate/halt` returns HTTP 403 thus blocking the rollout. +If you have notifications enabled, Flagger will post a message to Slack or MS Teams if a canary rollout is waiting for approval. Change the URL to `/gate/approve` to start the canary analysis: diff --git a/pkg/controller/scheduler.go b/pkg/controller/scheduler.go index bca276007..cf9a595b8 100644 --- a/pkg/controller/scheduler.go +++ b/pkg/controller/scheduler.go @@ -537,11 +537,12 @@ func (c *Controller) runConfirmRolloutHooks(canary *flaggerv1.Canary) bool { err := CallWebhook(canary.Name, canary.Namespace, flaggerv1.CanaryPhaseProgressing, webhook) if err != nil { if canary.Status.Phase != flaggerv1.CanaryPhaseWaiting { - c.recordEventWarningf(canary, "Halt %s.%s advancement waiting for approval %s", - canary.Name, canary.Namespace, webhook.Name) if err := c.deployer.SetStatusPhase(canary, flaggerv1.CanaryPhaseWaiting); err != nil { c.logger.With("canary", fmt.Sprintf("%s.%s", canary.Name, canary.Namespace)).Errorf("%v", err) } + c.recordEventWarningf(canary, "Halt %s.%s advancement waiting for approval %s", + canary.Name, canary.Namespace, webhook.Name) + c.sendNotification(canary, "Canary is waiting for approval.", false, false) } return false } else {