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

Implement B/G for service mesh providers #305

Merged
merged 4 commits into from
Sep 22, 2019

Conversation

stefanprodan
Copy link
Member

This PR implements Blue/Green deployments for all service mesh providers. Flagger will use the B/G strategy when canaryAnalysis.iterations is specified in the canary spec instead of maxWeight/stepWeight. After the analysis finishes, the traffic is routed to the canary (green) before triggering the primary (blue) rolling update, this ensures a smooth transition to the new version avoiding dropping in-flight requests during the Kubernetes deployment rollout.

Blue/Green steps:

  • scale up green
  • run conformance tests on green
  • run load tests and metric checks on green
  • route traffic to green
  • promote green spec over blue
  • wait for blue rollout
  • route traffic to blue
  • scale down green

Example:

apiVersion: flagger.app/v1alpha3
kind: Canary
metadata:
  name: podinfo
  namespace: test-istio
spec:
  provider: istio
  targetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: podinfo
  autoscalerRef:
    apiVersion: autoscaling/v2beta1
    kind: HorizontalPodAutoscaler
    name: podinfo
  service:
    port: 9898
    gateways:
    - public-gateway.istio-system.svc.cluster.local
    - mesh
    hosts:
    - podinfo.istio.flagger.dev
    trafficPolicy:
      tls:
        mode: DISABLE
  canaryAnalysis:
    # schedule interval
    interval: 60s
    # iterations to be run for the B/G analysis
    iterations: 10
    # max number of failed metric checks before rollback
    threshold: 10
    metrics:
    - name: request-success-rate
      threshold: 99
      interval: 1m
    - name: request-duration
      threshold: 500
      interval: 30s
    webhooks:
      - name: acceptance-test
        type: pre-rollout
        url: http://flagger-loadtester.test/
        timeout: 30s
        metadata:
          type: bash
          cmd: "curl -sd 'test' http://podinfo-canary:9898/token | grep token"
      - name: load-test
        url: http://flagger-loadtester.test/
        timeout: 5s
        metadata:
          type: cmd
          cmd: "hey -z 1m -q 10 -c 2 http://podinfo:9898/"

Flagger image: weaveworks/flagger:service-mesh-blue-green-9d856a4

Fix: #294

Blue/Green steps:
- scale up green
- run conformance tests on green
- run load tests and metric checks on green
- route traffic to green
- promote green spec over blue
- wait for blue rollout
- route traffic to blue
@stefanprodan stefanprodan force-pushed the service-mesh-blue-green branch from 8a17098 to d908355 Compare September 22, 2019 06:32
@stefanprodan stefanprodan merged commit 37a1ff5 into master Sep 22, 2019
@stefanprodan stefanprodan deleted the service-mesh-blue-green branch September 22, 2019 09:01
@stefanprodan stefanprodan mentioned this pull request Oct 2, 2019
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.

Feature Request: B/G Deployment over istio
1 participant