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

Add pre and post rollout hooks #147

Merged
merged 6 commits into from
Apr 14, 2019
Merged

Add pre and post rollout hooks #147

merged 6 commits into from
Apr 14, 2019

Conversation

stefanprodan
Copy link
Member

@stefanprodan stefanprodan commented Apr 13, 2019

This PR introduces two types of web hooks:

  • pre-rollout hooks are executed before routing traffic to canary. The canary advancement is paused if a pre-rollout hook fails and if the number of failures reach the threshold the canary will be rollback.
  • post-rollout hooks are executed after the canary has been promoted or rolled back. If a post rollout hook fails the error is logged.

Example:

apiVersion: flagger.app/v1alpha3
kind: Canary
spec:
  canaryAnalysis:
    webhooks:
      - name: "smoke test"
        type: pre-rollout
        url: http://some.service:8080/
        timeout: 5s
        metadata:
          some: "data"
      - name: "load test"
        type: rollout
        url: http://flagger-loadtester.test/
        timeout: 5s
        metadata:
          cmd: "hey -z 1m -q 5 -c 2 http://podinfo-canary.test:9898/"
      - name: "notify"
        type: post-rollout
        url: http://telegram.bot:8888/
        timeout: 5s
        metadata:
          some: "message"

If the webhook type is not specified it will default to rollout making this change backwards compatible.

Fix: #117

- pre-rollout execute webhook before routing traffic to canary
- rollout execute webhook during the canary analysis on each iteration
- post-rollout execute webhook after the canary has been promoted or rolled back
Add canary phase to webhook payload
- halt the canary advancement if pre-rollout hooks are failing
- include the canary status (Succeeded/Failed) in the post-rollout webhook payload
- ignore post-rollout webhook failures
- log pre/post rollout webhook response result
@stefanprodan stefanprodan merged commit 825d07a into master Apr 14, 2019
@stefanprodan stefanprodan deleted the pre-post-rollout-hooks branch April 14, 2019 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pre-rollout hooks
1 participant