From 093348bc6061604cd5704f4b20893209c8fe7fbb Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Thu, 18 Apr 2019 13:45:32 +0300 Subject: [PATCH 1/6] Release loadtester 0.3.0 with bats support --- artifacts/loadtester/deployment.yaml | 2 +- charts/loadtester/Chart.yaml | 4 ++-- charts/loadtester/values.yaml | 2 +- cmd/loadtester/main.go | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/artifacts/loadtester/deployment.yaml b/artifacts/loadtester/deployment.yaml index fe77c3a9..653ef98e 100644 --- a/artifacts/loadtester/deployment.yaml +++ b/artifacts/loadtester/deployment.yaml @@ -17,7 +17,7 @@ spec: spec: containers: - name: loadtester - image: weaveworks/flagger-loadtester:0.2.0 + image: weaveworks/flagger-loadtester:0.3.0 imagePullPolicy: IfNotPresent ports: - name: http diff --git a/charts/loadtester/Chart.yaml b/charts/loadtester/Chart.yaml index df63a79d..d0127e99 100644 --- a/charts/loadtester/Chart.yaml +++ b/charts/loadtester/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v1 name: loadtester -version: 0.2.0 -appVersion: 0.2.0 +version: 0.3.0 +appVersion: 0.3.0 kubeVersion: ">=1.11.0-0" engine: gotpl description: Flagger's load testing services based on rakyll/hey that generates traffic during canary analysis when configured as a webhook. diff --git a/charts/loadtester/values.yaml b/charts/loadtester/values.yaml index 95db0b39..3e11175c 100644 --- a/charts/loadtester/values.yaml +++ b/charts/loadtester/values.yaml @@ -2,7 +2,7 @@ replicaCount: 1 image: repository: quay.io/weaveworks/flagger-loadtester - tag: 0.2.0 + tag: 0.3.0 pullPolicy: IfNotPresent logLevel: info diff --git a/cmd/loadtester/main.go b/cmd/loadtester/main.go index a3e98d3a..86b0ae87 100644 --- a/cmd/loadtester/main.go +++ b/cmd/loadtester/main.go @@ -10,7 +10,7 @@ import ( "time" ) -var VERSION = "0.2.0" +var VERSION = "0.3.0" var ( logLevel string port string From b60b912bf863c65a5a6af857f0ce09bcc4b2284d Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Thu, 18 Apr 2019 13:53:13 +0300 Subject: [PATCH 2/6] Use the builtin metrics in artifacts --- README.md | 6 +++--- artifacts/ab-testing/canary.yaml | 4 ++-- artifacts/appmesh/canary.yaml | 2 +- artifacts/canaries/canary.yaml | 4 ++-- artifacts/configs/canary.yaml | 4 ++-- charts/podinfo/Chart.yaml | 2 +- charts/podinfo/templates/canary.yaml | 4 ++-- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 048aec30..c25e5866 100644 --- a/README.md +++ b/README.md @@ -118,13 +118,13 @@ spec: stepWeight: 5 # Istio Prometheus checks metrics: - # builtin Istio checks - - name: istio_requests_total + # builtin checks + - name: request-success-rate # minimum req success rate (non 5xx responses) # percentage (0-100) threshold: 99 interval: 1m - - name: istio_request_duration_seconds_bucket + - name: request-duration # maximum req duration P99 # milliseconds threshold: 500 diff --git a/artifacts/ab-testing/canary.yaml b/artifacts/ab-testing/canary.yaml index 226a8c74..eb96fd22 100644 --- a/artifacts/ab-testing/canary.yaml +++ b/artifacts/ab-testing/canary.yaml @@ -43,12 +43,12 @@ spec: cookie: regex: "^(.*?;)?(type=insider)(;.*)?$" metrics: - - name: istio_requests_total + - name: request-success-rate # minimum req success rate (non 5xx responses) # percentage (0-100) threshold: 99 interval: 1m - - name: istio_request_duration_seconds_bucket + - name: request-duration # maximum req duration P99 # milliseconds threshold: 500 diff --git a/artifacts/appmesh/canary.yaml b/artifacts/appmesh/canary.yaml index b89dc903..d16ea07d 100644 --- a/artifacts/appmesh/canary.yaml +++ b/artifacts/appmesh/canary.yaml @@ -36,7 +36,7 @@ spec: stepWeight: 5 # App Mesh Prometheus checks metrics: - - name: envoy_cluster_upstream_rq + - name: request-success-rate # minimum req success rate (non 5xx responses) # percentage (0-100) threshold: 99 diff --git a/artifacts/canaries/canary.yaml b/artifacts/canaries/canary.yaml index 4599291c..ca023e05 100644 --- a/artifacts/canaries/canary.yaml +++ b/artifacts/canaries/canary.yaml @@ -56,12 +56,12 @@ spec: stepWeight: 5 # Istio Prometheus checks metrics: - - name: istio_requests_total + - name: request-success-rate # minimum req success rate (non 5xx responses) # percentage (0-100) threshold: 99 interval: 1m - - name: istio_request_duration_seconds_bucket + - name: request-duration # maximum req duration P99 # milliseconds threshold: 500 diff --git a/artifacts/configs/canary.yaml b/artifacts/configs/canary.yaml index c2a853f3..9e666222 100644 --- a/artifacts/configs/canary.yaml +++ b/artifacts/configs/canary.yaml @@ -40,12 +40,12 @@ spec: stepWeight: 5 # Istio Prometheus checks metrics: - - name: istio_requests_total + - name: request-success-rate # minimum req success rate (non 5xx responses) # percentage (0-100) threshold: 99 interval: 1m - - name: istio_request_duration_seconds_bucket + - name: request-duration # maximum req duration P99 # milliseconds threshold: 500 diff --git a/charts/podinfo/Chart.yaml b/charts/podinfo/Chart.yaml index c9bf218f..f2d33f2e 100644 --- a/charts/podinfo/Chart.yaml +++ b/charts/podinfo/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v1 -version: 2.0.0 +version: 2.0.1 appVersion: 1.4.0 name: podinfo engine: gotpl diff --git a/charts/podinfo/templates/canary.yaml b/charts/podinfo/templates/canary.yaml index 92cc5865..9fb007ec 100644 --- a/charts/podinfo/templates/canary.yaml +++ b/charts/podinfo/templates/canary.yaml @@ -32,10 +32,10 @@ spec: maxWeight: {{ .Values.canary.analysis.maxWeight }} stepWeight: {{ .Values.canary.analysis.stepWeight }} metrics: - - name: istio_requests_total + - name: request-success-rate threshold: {{ .Values.canary.thresholds.successRate }} interval: 1m - - name: istio_request_duration_seconds_bucket + - name: request-duration threshold: {{ .Values.canary.thresholds.latency }} interval: 1m {{- if .Values.canary.loadtest.enabled }} From 4a82e1e223803ff753b5a1e79f7312229c8febf4 Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Thu, 18 Apr 2019 14:25:55 +0300 Subject: [PATCH 3/6] Use the builtin metrics in docs --- docs/gitbook/how-it-works.md | 52 ++++++++++++++++--- docs/gitbook/usage/ab-testing.md | 4 +- .../usage/appmesh-progressive-delivery.md | 2 +- docs/gitbook/usage/progressive-delivery.md | 4 +- 4 files changed, 50 insertions(+), 12 deletions(-) diff --git a/docs/gitbook/how-it-works.md b/docs/gitbook/how-it-works.md index 2b325e50..b81b8900 100644 --- a/docs/gitbook/how-it-works.md +++ b/docs/gitbook/how-it-works.md @@ -56,14 +56,14 @@ spec: # canary increment step # percentage (0-100) stepWeight: 5 - # Istio Prometheus checks + # Prometheus checks metrics: - - name: istio_requests_total + - name: request-success-rate # minimum req success rate (non 5xx responses) # percentage (0-100) threshold: 99 interval: 1m - - name: istio_request_duration_seconds_bucket + - name: request-duration # maximum req duration P99 # milliseconds threshold: 500 @@ -398,14 +398,14 @@ Spec: ```yaml canaryAnalysis: metrics: - - name: istio_requests_total + - name: request-success-rate # minimum req success rate (non 5xx responses) # percentage (0-100) threshold: 99 interval: 1m ``` -Query: +Istio query: ```javascript sum( @@ -430,6 +430,29 @@ sum( ) ``` +App Mesh query: + +```javascript +sum( + rate( + envoy_cluster_upstream_rq{ + kubernetes_namespace="$namespace", + kubernetes_pod_name=~"$workload", + response_code!~"5.*" + }[$interval] + ) +) +/ +sum( + rate( + envoy_cluster_upstream_rq{ + kubernetes_namespace="$namespace", + kubernetes_pod_name=~"$workload" + }[$interval] + ) +) +``` + **HTTP requests milliseconds duration P99** Spec: @@ -437,14 +460,14 @@ Spec: ```yaml canaryAnalysis: metrics: - - name: istio_request_duration_seconds_bucket + - name: request-duration # maximum req duration P99 # milliseconds threshold: 500 interval: 1m ``` -Query: +Istio query: ```javascript histogram_quantile(0.99, @@ -460,6 +483,21 @@ histogram_quantile(0.99, ) ``` +App Mesh query: + +```javascript +histogram_quantile(0.99, + sum( + irate( + envoy_cluster_upstream_rq_time_bucket{ + kubernetes_pod_name=~"$workload", + kubernetes_namespace=~"$namespace" + }[$interval] + ) + ) by (le) +) +``` + > **Note** that the metric interval should be lower or equal to the control loop interval. ### Custom Metrics diff --git a/docs/gitbook/usage/ab-testing.md b/docs/gitbook/usage/ab-testing.md index e984e052..3014a794 100644 --- a/docs/gitbook/usage/ab-testing.md +++ b/docs/gitbook/usage/ab-testing.md @@ -80,12 +80,12 @@ spec: cookie: regex: "^(.*?;)?(type=insider)(;.*)?$" metrics: - - name: istio_requests_total + - name: request-success-rate # minimum req success rate (non 5xx responses) # percentage (0-100) threshold: 99 interval: 1m - - name: istio_request_duration_seconds_bucket + - name: request-duration # maximum req duration P99 # milliseconds threshold: 500 diff --git a/docs/gitbook/usage/appmesh-progressive-delivery.md b/docs/gitbook/usage/appmesh-progressive-delivery.md index 416671dc..02fe3c29 100644 --- a/docs/gitbook/usage/appmesh-progressive-delivery.md +++ b/docs/gitbook/usage/appmesh-progressive-delivery.md @@ -85,7 +85,7 @@ spec: stepWeight: 5 # App Mesh Prometheus checks metrics: - - name: envoy_cluster_upstream_rq + - name: request-success-rate # minimum req success rate (non 5xx responses) # percentage (0-100) threshold: 99 diff --git a/docs/gitbook/usage/progressive-delivery.md b/docs/gitbook/usage/progressive-delivery.md index c6ede76a..2bb25dcf 100644 --- a/docs/gitbook/usage/progressive-delivery.md +++ b/docs/gitbook/usage/progressive-delivery.md @@ -70,12 +70,12 @@ spec: # percentage (0-100) stepWeight: 10 metrics: - - name: istio_requests_total + - name: request-success-rate # minimum req success rate (non 5xx responses) # percentage (0-100) threshold: 99 interval: 1m - - name: istio_request_duration_seconds_bucket + - name: request-duration # maximum req duration P99 # milliseconds threshold: 500 From 662f9cba2e1d66fdb205065f84ba4db64a504bf8 Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Thu, 18 Apr 2019 14:34:25 +0300 Subject: [PATCH 4/6] Add bats tests to load tester artifacts --- artifacts/loadtester/config.yaml | 19 +++++++++++++++++++ artifacts/loadtester/deployment.yaml | 8 ++++++++ 2 files changed, 27 insertions(+) create mode 100644 artifacts/loadtester/config.yaml diff --git a/artifacts/loadtester/config.yaml b/artifacts/loadtester/config.yaml new file mode 100644 index 00000000..b9d0f568 --- /dev/null +++ b/artifacts/loadtester/config.yaml @@ -0,0 +1,19 @@ +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: flagger-loadtester-bats +data: + tests: | + #!/usr/bin/env bats + + @test "check message" { + curl -sS http://${URL} | jq -r .message | { + run cut -d $' ' -f1 + [ $output = "greetings" ] + } + } + + @test "check headers" { + curl -sS http://${URL}/headers | grep X-Request-Id + } diff --git a/artifacts/loadtester/deployment.yaml b/artifacts/loadtester/deployment.yaml index 653ef98e..8c3664dc 100644 --- a/artifacts/loadtester/deployment.yaml +++ b/artifacts/loadtester/deployment.yaml @@ -57,3 +57,11 @@ spec: securityContext: readOnlyRootFilesystem: true runAsUser: 10001 + volumeMounts: + - name: tests + mountPath: /bats + readOnly: true + volumes: + - name: tests + configMap: + name: flagger-loadtester-bats \ No newline at end of file From f60c4d60cfb7bd8901e3de224c342e82ec6919e7 Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Thu, 18 Apr 2019 14:50:26 +0300 Subject: [PATCH 5/6] Release v0.11.1 --- artifacts/flagger/deployment.yaml | 2 +- charts/flagger/Chart.yaml | 4 ++-- charts/flagger/values.yaml | 2 +- pkg/version/version.go | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/artifacts/flagger/deployment.yaml b/artifacts/flagger/deployment.yaml index 39f4462b..b0141f1d 100644 --- a/artifacts/flagger/deployment.yaml +++ b/artifacts/flagger/deployment.yaml @@ -22,7 +22,7 @@ spec: serviceAccountName: flagger containers: - name: flagger - image: weaveworks/flagger:0.11.0 + image: weaveworks/flagger:0.11.1 imagePullPolicy: IfNotPresent ports: - name: http diff --git a/charts/flagger/Chart.yaml b/charts/flagger/Chart.yaml index b0f3812d..7c58e2c3 100644 --- a/charts/flagger/Chart.yaml +++ b/charts/flagger/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v1 name: flagger -version: 0.11.0 -appVersion: 0.11.0 +version: 0.11.1 +appVersion: 0.11.1 kubeVersion: ">=1.11.0-0" engine: gotpl description: Flagger is a Kubernetes operator that automates the promotion of canary deployments using Istio routing for traffic shifting and Prometheus metrics for canary analysis. diff --git a/charts/flagger/values.yaml b/charts/flagger/values.yaml index e20d4140..d624d440 100644 --- a/charts/flagger/values.yaml +++ b/charts/flagger/values.yaml @@ -2,7 +2,7 @@ image: repository: weaveworks/flagger - tag: 0.11.0 + tag: 0.11.1 pullPolicy: IfNotPresent metricsServer: "http://prometheus:9090" diff --git a/pkg/version/version.go b/pkg/version/version.go index e2131ffa..2ae05041 100644 --- a/pkg/version/version.go +++ b/pkg/version/version.go @@ -1,4 +1,4 @@ package version -var VERSION = "0.11.0" +var VERSION = "0.11.1" var REVISION = "unknown" From 8cebc0acee4a8819c45a42920630b2c4c1949def Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Thu, 18 Apr 2019 15:40:48 +0300 Subject: [PATCH 6/6] Update changelog for v0.11.1 --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7704cd8a..9dae0295 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ All notable changes to this project are documented in this file. +## 0.11.1 (2019-04-18) + +Move Flagger and the load tester container images to Docker Hub + +#### Features + +- Add Bash Automated Testing System support to Flagger tester for running acceptance tests as pre-rollout hooks + ## 0.11.0 (2019-04-17) Adds pre/post rollout [webhooks](https://docs.flagger.app/how-it-works#webhooks)