diff --git a/helm-guestbook/templates/cluster_analysis.yaml b/helm-guestbook/templates/cluster_analysis.yaml new file mode 100644 index 0000000..57973ad --- /dev/null +++ b/helm-guestbook/templates/cluster_analysis.yaml @@ -0,0 +1,22 @@ +apiVersion: argoproj.io/v1alpha1 +kind: ClusterAnalysisTemplate +metadata: + name: success-rate +spec: + args: + - name: service-name + - name: prometheus-port + value: 9090 + metrics: + - name: success-rate + successCondition: result[0] >= 0.95 + provider: + prometheus: + address: "http://a0179abbebc504fe1a02cc2868d10d20-1436141555.us-east-2.elb.amazonaws.com:{{args.prometheus-port}}" + query: | + sum(irate( + istio_requests_total{reporter="source",destination_service=~"{{args.service-name}}",response_code!~"5.*"}[5m] + )) / + sum(irate( + istio_requests_total{reporter="source",destination_service=~"{{args.service-name}}"}[5m] + )) \ No newline at end of file diff --git a/helm-guestbook/templates/rollout.yaml b/helm-guestbook/templates/rollout.yaml index 90ca085..6631b8d 100644 --- a/helm-guestbook/templates/rollout.yaml +++ b/helm-guestbook/templates/rollout.yaml @@ -54,18 +54,25 @@ spec: minReadySeconds: 30 strategy: canary: #Indicates that the rollout should use the Canary strategy + analysis: + templates: + - templateName: success-rate + startingStep: 2 # delay starting analysis run until setWeight: 40% + args: + - name: service-name + value: {{ template "helm-guestbook.fullname" . }} maxSurge: "25%" maxUnavailable: 0 canaryService: guestbook-canary-service stableService: {{ template "helm-guestbook.fullname" . }} steps: - - setWeight: 10 + - setWeight: 20 - pause: duration: 1m # 1 minute - - setWeight: 20 + - setWeight: 40 - pause: duration: 1m # 1 minute - - setWeight: 50 + - setWeight: 60 - pause: duration: 1m # 1 minute - setWeight: 80