Progressive delivery Kubernetes operator (Canary, A/B Testing and Blue/Green deployments)
Go to file
stefanprodan 7fe273a21d Fix SMI cluster role binding 2019-05-11 14:08:58 +03:00
.circleci Run SMI Istio e2e tests 2019-05-11 14:00:53 +03:00
.github Add maintainers 2019-03-21 12:34:28 +02:00
artifacts Fix SMI cluster role binding 2019-05-11 14:08:58 +03:00
charts Add SMI group to RBAC 2019-05-11 13:45:32 +03:00
cmd Log mesh provider at startup 2019-05-06 18:41:04 +03:00
docs Fix typos 2019-05-10 10:24:47 +03:00
hack Generate the SMI TrafficSplit clientset 2019-05-11 12:49:23 +03:00
pkg Enable Istio checks for SMI-Istio adapter 2019-05-11 13:06:06 +03:00
test Add SMI Istio e2e tests 2019-05-11 13:46:24 +03:00
vendor dep ensure twice 2019-04-19 11:23:32 -04:00
.codecov.yml Disable PR comments when coverage doesn't change 2019-03-05 16:25:30 +02:00
.gitbook.yaml Set gitbook root 2018-12-19 12:00:18 +02:00
.gitignore update .gitignore 2019-03-05 12:15:27 +08:00
.goreleaser.yml Move to weaveworks org 2019-03-20 18:26:04 +02:00
.travis.yml Switch to Docker Hub from Quay 2019-04-17 11:03:38 +03:00
CHANGELOG.md Release v0.13.1 2019-05-09 14:29:42 +03:00
CONTRIBUTING.md Add contributing and code of conduct docs 2018-10-11 14:33:28 +03:00
Dockerfile Update go to 1.12 2019-03-27 13:02:30 +02:00
Dockerfile.loadtester Add bash bats task runner 2019-04-17 11:05:10 +03:00
Gopkg.lock pin supergloo\solo-kit 2019-04-19 11:20:28 -04:00
Gopkg.toml pin supergloo\solo-kit 2019-04-19 11:20:28 -04:00
LICENSE Copyright Weaveworks 2019-01-03 14:42:21 +02:00
MAINTAINERS Add maintainers 2019-03-21 12:34:28 +02:00
Makefile Add SMI Istio adapter deployment 2019-05-11 13:35:36 +03:00
README.md Add NGINX to readme 2019-05-08 18:30:00 +03:00
code-of-conduct.md Add contributing and code of conduct docs 2018-10-11 14:33:28 +03:00

README.md

flagger

build report codecov license release

Flagger is a Kubernetes operator that automates the promotion of canary deployments using Istio, App Mesh or NGINX routing for traffic shifting and Prometheus metrics for canary analysis. The canary analysis can be extended with webhooks for running acceptance tests, load tests or any other custom validation.

Flagger implements a control loop that gradually shifts traffic to the canary while measuring key performance indicators like HTTP requests success rate, requests average duration and pods health. Based on analysis of the KPIs a canary is promoted or aborted, and the analysis result is published to Slack.

flagger-overview

Documentation

Flagger documentation can be found at docs.flagger.app

Canary CRD

Flagger takes a Kubernetes deployment and optionally a horizontal pod autoscaler (HPA), then creates a series of objects (Kubernetes deployments, ClusterIP services and Istio or App Mesh virtual services). These objects expose the application on the mesh and drive the canary analysis and promotion.

Flagger keeps track of ConfigMaps and Secrets referenced by a Kubernetes Deployment and triggers a canary analysis if any of those objects change. When promoting a workload in production, both code (container images) and configuration (config maps and secrets) are being synchronised.

For a deployment named podinfo, a canary promotion can be defined using Flagger's custom resource:

apiVersion: flagger.app/v1alpha3
kind: Canary
metadata:
  name: podinfo
  namespace: test
spec:
  # deployment reference
  targetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: podinfo
  # the maximum time in seconds for the canary deployment
  # to make progress before it is rollback (default 600s)
  progressDeadlineSeconds: 60
  # HPA reference (optional)
  autoscalerRef:
    apiVersion: autoscaling/v2beta1
    kind: HorizontalPodAutoscaler
    name: podinfo
  service:
    # container port
    port: 9898
    # Istio gateways (optional)
    gateways:
    - public-gateway.istio-system.svc.cluster.local
    - mesh
    # Istio virtual service host names (optional)
    hosts:
    - podinfo.example.com
    # HTTP match conditions (optional)
    match:
      - uri:
          prefix: /
    # HTTP rewrite (optional)
    rewrite:
      uri: /
    # Envoy timeout and retry policy (optional)
    headers:
      request:
        add:
          x-envoy-upstream-rq-timeout-ms: "15000"
          x-envoy-max-retries: "10"
          x-envoy-retry-on: "gateway-error,connect-failure,refused-stream"
    # cross-origin resource sharing policy (optional)
    corsPolicy:
      allowOrigin:
        - example.com
  # promote the canary without analysing it (default false)
  skipAnalysis: false
  # define the canary analysis timing and KPIs
  canaryAnalysis:
    # schedule interval (default 60s)
    interval: 1m
    # max number of failed metric checks before rollback
    threshold: 10
    # max traffic percentage routed to canary
    # percentage (0-100)
    maxWeight: 50
    # canary increment step
    # percentage (0-100)
    stepWeight: 5
    # Istio Prometheus checks
    metrics:
    # builtin checks
    - name: request-success-rate
      # minimum req success rate (non 5xx responses)
      # percentage (0-100)
      threshold: 99
      interval: 1m
    - name: request-duration
      # maximum req duration P99
      # milliseconds
      threshold: 500
      interval: 30s
    # custom check
    - name: "kafka lag"
      threshold: 100
      query: |
        avg_over_time(
          kafka_consumergroup_lag{
            consumergroup=~"podinfo-consumer-.*",
            topic="podinfo"
          }[1m]
        )        
    # external checks (optional)
    webhooks:
      - name: load-test
        url: http://flagger-loadtester.test/
        timeout: 5s
        metadata:
          cmd: "hey -z 1m -q 10 -c 2 http://podinfo.test:9898/"

For more details on how the canary analysis and promotion works please read the docs.

Features

Feature Istio App Mesh SuperGloo NGINX Ingress
Canary deployments (weighted traffic) ✔️ ✔️ ✔️ ✔️
A/B testing (headers and cookies filters) ✔️ ✔️
Load testing ✔️ ✔️ ✔️ ✔️
Webhooks (custom acceptance tests) ✔️ ✔️ ✔️ ✔️
Request success rate check (L7 metric) ✔️ ✔️ ✔️ ✔️
Request duration check (L7 metric) ✔️ ✔️ ✔️
Custom promql checks ✔️ ✔️ ✔️ ✔️
Ingress gateway (CORS, retries and timeouts) ✔️ ✔️ ✔️

Roadmap

  • Integrate with other service mesh technologies like Linkerd v2
  • Add support for comparing the canary metrics to the primary ones and do the validation based on the derivation between the two

Contributing

Flagger is Apache 2.0 licensed and accepts contributions via GitHub pull requests.

When submitting bug reports please include as much details as possible:

  • which Flagger version
  • which Flagger CRD version
  • which Kubernetes/Istio version
  • what configuration (canary, virtual service and workloads definitions)
  • what happened (Flagger, Istio Pilot and Proxy logs)

Getting Help

If you have any questions about Flagger and progressive delivery:

Your feedback is always welcome!