From 44d7e96e9601cb969e4388657b1ab72cd32e7c15 Mon Sep 17 00:00:00 2001 From: stefanprodan <stefan.prodan@gmail.com> Date: Thu, 28 Feb 2019 00:02:01 +0200 Subject: [PATCH 1/5] Add timeout and retries fields to Canary CRD --- artifacts/flagger/crd.yaml | 2 ++ charts/flagger/templates/crd.yaml | 2 ++ pkg/apis/flagger/v1alpha3/types.go | 2 ++ pkg/apis/flagger/v1alpha3/zz_generated.deepcopy.go | 5 +++++ 4 files changed, 11 insertions(+) diff --git a/artifacts/flagger/crd.yaml b/artifacts/flagger/crd.yaml index b101d7be4..c628d5770 100644 --- a/artifacts/flagger/crd.yaml +++ b/artifacts/flagger/crd.yaml @@ -73,6 +73,8 @@ spec: properties: port: type: number + timeout: + type: string skipAnalysis: type: boolean canaryAnalysis: diff --git a/charts/flagger/templates/crd.yaml b/charts/flagger/templates/crd.yaml index 5e3c40a33..efd880e69 100644 --- a/charts/flagger/templates/crd.yaml +++ b/charts/flagger/templates/crd.yaml @@ -74,6 +74,8 @@ spec: properties: port: type: number + timeout: + type: string skipAnalysis: type: boolean canaryAnalysis: diff --git a/pkg/apis/flagger/v1alpha3/types.go b/pkg/apis/flagger/v1alpha3/types.go index f6bead856..0690695cd 100755 --- a/pkg/apis/flagger/v1alpha3/types.go +++ b/pkg/apis/flagger/v1alpha3/types.go @@ -114,6 +114,8 @@ type CanaryService struct { Hosts []string `json:"hosts"` Match []istiov1alpha3.HTTPMatchRequest `json:"match,omitempty"` Rewrite *istiov1alpha3.HTTPRewrite `json:"rewrite,omitempty"` + Timeout string `json:"timeout,omitempty"` + Retries *istiov1alpha3.HTTPRetry `json:"retries,omitempty"` } // CanaryAnalysis is used to describe how the analysis should be done diff --git a/pkg/apis/flagger/v1alpha3/zz_generated.deepcopy.go b/pkg/apis/flagger/v1alpha3/zz_generated.deepcopy.go index 23ff1c582..bded64e49 100644 --- a/pkg/apis/flagger/v1alpha3/zz_generated.deepcopy.go +++ b/pkg/apis/flagger/v1alpha3/zz_generated.deepcopy.go @@ -156,6 +156,11 @@ func (in *CanaryService) DeepCopyInto(out *CanaryService) { *out = new(istiov1alpha3.HTTPRewrite) **out = **in } + if in.Retries != nil { + in, out := &in.Retries, &out.Retries + *out = new(istiov1alpha3.HTTPRetry) + **out = **in + } return } From 6db8b96f72e92ce07d70d6091f2b4d8111dc683b Mon Sep 17 00:00:00 2001 From: stefanprodan <stefan.prodan@gmail.com> Date: Thu, 28 Feb 2019 00:02:48 +0200 Subject: [PATCH 2/5] Add timeout and retries example to docs --- README.md | 16 +++++++++------- docs/gitbook/how-it-works.md | 14 ++++++++++---- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index d02bbab2d..62570fd03 100644 --- a/README.md +++ b/README.md @@ -89,25 +89,27 @@ spec: apiVersion: autoscaling/v2beta1 kind: HorizontalPodAutoscaler name: podinfo - service: - # container port - port: 9898 # Istio gateways (optional) gateways: - public-gateway.istio-system.svc.cluster.local # Istio virtual service host names (optional) hosts: - podinfo.example.com - # Istio virtual service HTTP match conditions (optional) + # HTTP match conditions (optional) match: - uri: prefix: / - # Istio virtual service HTTP rewrite (optional) + # HTTP rewrite (optional) rewrite: uri: / - # for emergency cases when you want to ship changes - # in production without analysing the canary (default false) + # timeout for HTTP requests (optional) + timeout: 5s + # retry policy when a HTTP request fails (optional) + retries: + attempts: 3 + # promote the canary without analysing it (default false) skipAnalysis: false + # define the canary analysis timing and KPIs canaryAnalysis: # schedule interval (default 60s) interval: 1m diff --git a/docs/gitbook/how-it-works.md b/docs/gitbook/how-it-works.md index 927d1bf51..7ce445097 100644 --- a/docs/gitbook/how-it-works.md +++ b/docs/gitbook/how-it-works.md @@ -39,16 +39,22 @@ spec: # Istio virtual service host names (optional) hosts: - podinfo.example.com - # Istio virtual service HTTP match conditions (optional) + # HTTP match conditions (optional) match: - uri: prefix: / - # Istio virtual service HTTP rewrite (optional) + # HTTP rewrite (optional) rewrite: uri: / - # for emergency cases when you want to ship changes - # in production without analysing the canary + # timeout for HTTP requests (optional) + timeout: 5s + # retry policy when a HTTP request fails (optional) + retries: + attempts: 3 + perTryTimeout: 3s + # promote the canary without analysing it (default false) skipAnalysis: false + # define the canary analysis timing and KPIs canaryAnalysis: # schedule interval (default 60s) interval: 1m From e322ba0065c5639fc76e058cd361570bede0dc44 Mon Sep 17 00:00:00 2001 From: stefanprodan <stefan.prodan@gmail.com> Date: Thu, 28 Feb 2019 00:05:40 +0200 Subject: [PATCH 3/5] Add timeout and retries to router --- pkg/controller/router.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/controller/router.go b/pkg/controller/router.go index 869f2c071..6d07ff491 100644 --- a/pkg/controller/router.go +++ b/pkg/controller/router.go @@ -195,6 +195,8 @@ func (c *CanaryRouter) syncVirtualService(cd *flaggerv1.Canary) error { { Match: cd.Spec.Service.Match, Rewrite: cd.Spec.Service.Rewrite, + Timeout: cd.Spec.Service.Timeout, + Retries: cd.Spec.Service.Retries, Route: route, }, }, @@ -309,6 +311,8 @@ func (c *CanaryRouter) SetRoutes( { Match: cd.Spec.Service.Match, Rewrite: cd.Spec.Service.Rewrite, + Timeout: cd.Spec.Service.Timeout, + Retries: cd.Spec.Service.Retries, Route: []istiov1alpha3.DestinationWeight{primary, canary}, }, } From 395234d7c81c0d93be076cbd01b1643bf6973585 Mon Sep 17 00:00:00 2001 From: stefanprodan <stefan.prodan@gmail.com> Date: Thu, 28 Feb 2019 00:33:47 +0200 Subject: [PATCH 4/5] Add promql custom check to readme --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 62570fd03..0cc58d4ee 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,9 @@ spec: apiVersion: autoscaling/v2beta1 kind: HorizontalPodAutoscaler name: podinfo + service: + # container port + port: 9898 # Istio gateways (optional) gateways: - public-gateway.istio-system.svc.cluster.local @@ -123,6 +126,7 @@ spec: stepWeight: 5 # Istio Prometheus checks metrics: + # builtin Istio checks - name: istio_requests_total # minimum req success rate (non 5xx responses) # percentage (0-100) @@ -133,6 +137,16 @@ spec: # 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 From 90c71ec18fb185a775cd49f31722a49b7ea3b1f6 Mon Sep 17 00:00:00 2001 From: stefanprodan <stefan.prodan@gmail.com> Date: Thu, 28 Feb 2019 15:09:24 +0200 Subject: [PATCH 5/5] Update roadmap with alternatives to Istio --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0cc58d4ee..cae925bc4 100644 --- a/README.md +++ b/README.md @@ -160,8 +160,8 @@ For more details on how the canary analysis and promotion works please [read the ### Roadmap -* Extend the validation mechanism to support other metrics than HTTP success rate and latency * Add A/B testing capabilities using fixed routing based on HTTP headers and cookies match conditions +* Integrate with other service mesh technologies like AWS AppMesh and 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