Skip to content

Commit 3dd5dfa

Browse files
authored
Merge pull request #594 from weaveworks/istio-source-labels
istio: Add source labels to analysis matching rules
2 parents 44cee42 + 4f299e5 commit 3dd5dfa

File tree

5 files changed

+52
-2
lines changed

5 files changed

+52
-2
lines changed

artifacts/flagger/crd.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -599,8 +599,15 @@ spec:
599599
format: string
600600
type: string
601601
regex:
602+
description: RE2 style regex-based match (https://github.com/google/re2/wiki/Syntax)
602603
format: string
603604
type: string
605+
sourceLabels:
606+
description: Applicable only when the 'mesh' gateway is included in the service.gateways list
607+
type: object
608+
additionalProperties:
609+
format: string
610+
type: string
604611
metrics:
605612
description: Metric check list for this canary
606613
type: array

charts/flagger/crds/crd.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -599,8 +599,15 @@ spec:
599599
format: string
600600
type: string
601601
regex:
602+
description: RE2 style regex-based match (https://github.com/google/re2/wiki/Syntax)
602603
format: string
603604
type: string
605+
sourceLabels:
606+
description: Applicable only when the 'mesh' gateway is included in the service.gateways list
607+
type: object
608+
additionalProperties:
609+
format: string
610+
type: string
604611
metrics:
605612
description: Metric check list for this canary
606613
type: array

docs/gitbook/usage/deployment-strategies.md

+30-1
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,34 @@ And the time it takes for a canary to be rollback when the metrics or webhook ch
159159
interval * threshold
160160
```
161161

162+
Istio example:
163+
164+
```yaml
165+
analysis:
166+
interval: 1m
167+
threshold: 10
168+
iterations: 2
169+
match:
170+
- headers:
171+
x-canary:
172+
exact: "insider"
173+
- headers:
174+
cookie:
175+
regex: "^(.*?;)?(canary=always)(;.*)?$"
176+
- sourceLabels:
177+
app.kubernetes.io/name: "scheduler"
178+
```
179+
180+
The header keys must be lowercase and use hyphen as the separator.
181+
Header values are case-sensitive and formatted as follows:
182+
- `exact: "value"` for exact string match
183+
- `prefix: "value"` for prefix-based match
184+
- `suffix: "value"` for suffix-based match
185+
- `regex: "value"` for [RE2](https://github.com/google/re2/wiki/Syntax) style regex-based match
186+
187+
Note that the `sourceLabels` match conditions are applicable only when the `mesh` gateway
188+
is included in the `canary.service.gateways` list.
189+
162190
App Mesh example:
163191

164192
```yaml
@@ -205,7 +233,8 @@ NGINX example:
205233
exact: "canary"
206234
```
207235

208-
Note that the NGINX ingress controller supports only exact matching for a single header and the cookie value is set to `always`.
236+
Note that the NGINX ingress controller supports only exact matching for cookies names where the value must be set to `always`.
237+
Starting with NGINX ingress v0.31, regex matching is supported for header values.
209238

210239
The above configurations will route users with the x-canary header or canary cookie to the canary instance during analysis:
211240

kustomize/base/flagger/crd.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -599,8 +599,15 @@ spec:
599599
format: string
600600
type: string
601601
regex:
602+
description: RE2 style regex-based match (https://github.com/google/re2/wiki/Syntax)
602603
format: string
603604
type: string
605+
sourceLabels:
606+
description: Applicable only when the 'mesh' gateway is included in the service.gateways list
607+
type: object
608+
additionalProperties:
609+
format: string
610+
type: string
604611
metrics:
605612
description: Metric check list for this canary
606613
type: array

test/e2e-istio.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
set -o errexit
44

5-
ISTIO_VER="1.5.2"
5+
ISTIO_VER="1.5.4"
66
REPO_ROOT=$(git rev-parse --show-toplevel)
77

88
echo ">>> Downloading Istio ${ISTIO_VER}"

0 commit comments

Comments
 (0)