From 96ccfa54fb9dbfa476d421478e81392e11a37b42 Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Sun, 22 Sep 2019 14:10:29 +0300 Subject: [PATCH] Add confirm-promotion hook example to docs --- Makefile | 11 ++--------- docs/gitbook/how-it-works.md | 23 +++++++++++++++++++++-- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 5685b975..e0ceb3de 100644 --- a/Makefile +++ b/Makefile @@ -7,15 +7,8 @@ LT_VERSION?=$(shell grep 'VERSION' cmd/loadtester/main.go | awk '{ print $$4 }' TS=$(shell date +%Y-%m-%d_%H-%M-%S) run: - GO111MODULE=on go run cmd/flagger/* -kubeconfig=$$HOME/.kube/config -log-level=info -mesh-provider=istio -namespace=test \ - -metrics-server=https://prometheus.istio.weavedx.com \ - -enable-leader-election=true - -run2: - GO111MODULE=on go run cmd/flagger/* -kubeconfig=$$HOME/.kube/config -log-level=info -mesh-provider=istio -namespace=test \ - -metrics-server=https://prometheus.istio.weavedx.com \ - -enable-leader-election=true \ - -port=9092 + GO111MODULE=on go run cmd/flagger/* -kubeconfig=$$HOME/.kube/config -log-level=info -mesh-provider=istio -namespace=test-istio \ + -metrics-server=https://prometheus.istio.flagger.dev run-appmesh: GO111MODULE=on go run cmd/flagger/* -kubeconfig=$$HOME/.kube/config -log-level=info -mesh-provider=appmesh \ diff --git a/docs/gitbook/how-it-works.md b/docs/gitbook/how-it-works.md index 1546c9ce..32626ad5 100644 --- a/docs/gitbook/how-it-works.md +++ b/docs/gitbook/how-it-works.md @@ -663,6 +663,9 @@ The canary advancement is paused if a pre-rollout hook fails and if the number o threshold the canary will be rollback. * Rollout hooks are executed during the analysis on each iteration before the metric checks. If a rollout hook call fails the canary advancement is paused and eventfully rolled back. +* Confirm-promotion hooks are executed before the promotion step. +The canary promotion is paused until the hooks return HTTP 200. +While the promotion is paused, Flagger will continue to run the metrics checks and rollout hooks. * Post-rollout hooks are executed after the canary has been promoted or rolled back. If a post rollout hook fails the error is logged. @@ -687,6 +690,9 @@ Spec: timeout: 15s metadata: cmd: "hey -z 1m -q 5 -c 2 http://podinfo-canary.test:9898/" + - name: "promotion gate" + type: confirm-promotion + url: http://flagger-loadtester.test/gate/approve - name: "notify" type: post-rollout url: http://telegram.bot:8080/ @@ -914,8 +920,8 @@ Note that you should create a ConfigMap with your Bats tests and mount it inside ### Manual Gating -For manual approval of a canary deployment you can use the `confirm-rollout` webhook. -The confirmation hooks are executed before the pre-rollout hooks. +For manual approval of a canary deployment you can use the `confirm-rollout` and `confirm-promotion` webhooks. +The confirmation rollout hooks are executed before the pre-rollout hooks. Flagger will halt the canary traffic shifting and analysis until the confirm webhook returns HTTP status 200. Manual gating with Flagger's tester: @@ -974,3 +980,16 @@ kubectl get canary/podinfo NAME STATUS WEIGHT podinfo Waiting 0 ``` + +The `confirm-promotion` hook type can be used to manually approve the canary promotion. +While the promotion is paused, Flagger will continue to run the metrics checks and load tests. + +```yaml + canaryAnalysis: + webhooks: + - name: "promotion gate" + type: confirm-promotion + url: http://flagger-loadtester.test/gate/halt +``` + +If you have notifications enabled, Flagger will post a message to Slack or MS Teams if a canary promotion is waiting for approval.