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

feat: Adds support for Istio traffic mirroring #2074

Merged
merged 27 commits into from
Jun 29, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
0c2bd01
feat: Add support for istio traffic mirroring steps
zachaller Jun 9, 2022
0515c38
bump e2e timeout
zachaller Jun 9, 2022
b29a967
Remove unintended change
zachaller Jun 9, 2022
5237209
Cleaner events
zachaller Jun 10, 2022
2f79dca
Add docs for mirror and fix up header routing
zachaller Jun 14, 2022
b10d7eb
small doc changes
zachaller Jun 14, 2022
b94c03c
Add example
zachaller Jun 14, 2022
23adb0f
Fix types and change example
zachaller Jun 14, 2022
ff87eda
Remove unused type
zachaller Jun 15, 2022
4e906ea
Docs change
zachaller Jun 15, 2022
34bd404
Fix PR comments
zachaller Jun 16, 2022
b8695f1
Check for >=
zachaller Jun 23, 2022
d63b3a3
Remove unused function
zachaller Jun 24, 2022
64ef5ea
Merge branch 'master' of https://github.com/argoproj/argo-rollouts in…
zachaller Jun 24, 2022
5733dc8
codegen
zachaller Jun 24, 2022
40753b3
Add better error logging
zachaller Jun 28, 2022
e9af4e3
a few more error msgs
zachaller Jun 28, 2022
a32da8a
fix comments
zachaller Jun 28, 2022
7d28995
typo
zachaller Jun 28, 2022
345d81a
fix logic error
zachaller Jun 29, 2022
ac2a425
redo header logic
zachaller Jun 29, 2022
d58a3b7
cleanup
zachaller Jun 29, 2022
8893571
Fix issue with keeping route weight updated when no routes
zachaller Jun 29, 2022
c768700
cleanup routes when promiting with last step being a pause
zachaller Jun 29, 2022
ff6fb0d
fix bug with promote and last step is a pause
zachaller Jun 29, 2022
7b7fec5
Fix tests
zachaller Jun 29, 2022
5f237bd
fix typo
zachaller Jun 29, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ DEV_IMAGE=false
E2E_INSTANCE_ID ?= argo-rollouts-e2e
E2E_TEST_OPTIONS ?=
E2E_PARALLEL ?= 4
E2E_WAIT_TIMEOUT ?= 90
E2E_WAIT_TIMEOUT ?= 120

override LDFLAGS += \
-X ${PACKAGE}/utils/version.version=${VERSION} \
Expand Down
58 changes: 49 additions & 9 deletions docs/features/specification.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,19 +268,52 @@ spec:
# Setting header based route will send all 100 traffic to the canary for the requests
# O with a specified header, in this case request header "version":"2"
# (supported only with trafficRouting, for Istio only at the moment)
- setHeaderRouting:
- setHeaderRoute:
# Name of the route that will be created by argo rollouts this must also be configured
# in spec.strategy.canary.trafficRouting.managedRoutes
name: "header-route-1"
# The matching rules for the header route, if this is missing it acts as a removal of the route.
match:
# headerName The name of the header to apply the match rules to.
- headerName: "version"
# headerValue must contain exactly one field of exact, regex, or prefix. Not all traffic routers support
# all types
headerValue:
# Exact will only match if the header value is exactly the same
exact: "2"

# Sets header based route with specified header values using regex as a value
# Could be used 'headerValue' or 'headerRegex' one of that values
- setHeaderRouting:
match:
- headerName: "version"
headerValue:
# Will match the rule if the regular expression matches
regex: "2.0.(.*)"
# prefix will be a prefix match of the header value
prefix: "2.0"

# Sets up a mirror/shadow based route with the specified match rules
# The traffic will be mirrored at the configured percentage to the canary service
# during the rollout
# (supported only with trafficRouting, for Istio only at the moment)
- setMirrorRoute:
# Name of the route that will be created by argo rollouts this must also be configured
# in spec.strategy.canary.trafficRouting.managedRoutes
name: "header-route-1"
# The percentage of the matched traffic to mirror to the canary
percentage: 100
# The matching rules for the header route, if this is missing it acts as a removal of the route.
# All conditions inside a single match block have AND semantics, while the list of match blocks have OR semantics.
# Each type within a match (method, path, headers) must have one and only one match type (exact, regex, prefix)
# Not all match types (exact, regex, prefix) will be supported by all traffic routers.
match:
- method: # What HTTP method to match
exact: "GET"
regex: "P.*"
prefix: "POST"
path: # What HTTP url paths to match.
exact: "/test"
regex: ""/test/.*"
prefix: ""/"
headers:
agent-1b: # What HTTP header name to use in the match.
exact: "firefox"
regex: "firefox2(.*)"
prefix: "firefox"

# an inline analysis step
- analysis:
Expand Down Expand Up @@ -311,7 +344,14 @@ spec:
# will achieve traffic split via a weighted replica counts between
# the canary and stable ReplicaSet.
trafficRouting:

# This is a list of routes that Argo Rollouts has the rights to manage it is currently only required for
# setMirrorRoute and setHeaderRoute. The order of managedRoutes array also sets the precedence of the route
# in the traffic router. Argo Rollouts will place these routes in the order specified above any routes already
# defined in the used traffic router if something exists. The names here must match the names from the
# setHeaderRoute and setMirrorRoute steps.
managedRoutes:
- name: set-header
- name: mirror-route
# Istio traffic routing configuration
istio:
# Either virtualService or virtualServices can be configured.
Expand Down
12 changes: 8 additions & 4 deletions docs/features/traffic-management/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ Since the traffic is controlled independently by the Service Mesh resources, the
## Traffic routing based on a header values for Canary

Argo Rollouts has ability to send all traffic to the canary-service based on a http request header value. Right now it's implemented for the Istio only.
The step for the header based traffic routing `setHeaderRouting` has a list of matchers for the header.
The step for the header based traffic routing `setHeaderRoute` has a list of matchers for the header.
Should be specified the `headerName` - name of the header and a value.
The value could be one of 3 `exact` - specify the exact header value, `regex` - value in a regex format, `prefix` - the prefix of the value could be provided.

To disable header based traffic routing just need to specify empty `setHeaderRouting`.
To disable header based traffic routing just need to specify empty `setHeaderRoute` with the name of the route.

Example:

Expand All @@ -69,13 +69,16 @@ spec:
canary:
canaryService: canary-service
stableService: stable-service
managedRoutes:
- name: set-header-1
trafficRouting:
istio:
virtualService:
name: rollouts-demo-vsvc
steps:
- setWeight: 20
- setHeaderRouting: # enable header based traffic routing where
- setHeaderRoute: # enable header based traffic routing where
name: "set-header-1"
match:
- headerName: Custom-Header1 # Custom-Header1=Mozilla
headerValue:
Expand All @@ -87,5 +90,6 @@ spec:
headerValue:
regex: Mozilla(.*)
- pause: {}
- setHeaderRouting: {} # disable header based traffic routing
- setHeaderRouting:
name: "set-header-1" # disable header based traffic routing
```
59 changes: 58 additions & 1 deletion manifests/crds/rollout-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ spec:
format: int32
type: integer
type: object
setHeaderRouting:
setHeaderRoute:
leoluz marked this conversation as resolved.
Show resolved Hide resolved
properties:
match:
items:
Expand All @@ -614,6 +614,52 @@ spec:
- headerValue
type: object
type: array
name:
type: string
type: object
setMirrorRoute:
properties:
match:
items:
properties:
headers:
additionalProperties:
properties:
exact:
type: string
prefix:
type: string
regex:
type: string
type: object
type: object
method:
properties:
exact:
type: string
prefix:
type: string
regex:
type: string
type: object
path:
properties:
exact:
type: string
prefix:
type: string
regex:
type: string
type: object
type: object
type: array
name:
type: string
percentage:
format: int32
type: integer
required:
- name
type: object
setWeight:
format: int32
Expand Down Expand Up @@ -755,6 +801,17 @@ spec:
type: object
type: array
type: object
managedRoutes:
items:
properties:
canaryRoute:
type: boolean
name:
type: string
required:
- name
type: object
type: array
nginx:
properties:
additionalIngressAnnotations:
Expand Down
59 changes: 58 additions & 1 deletion manifests/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11561,7 +11561,7 @@ spec:
format: int32
type: integer
type: object
setHeaderRouting:
setHeaderRoute:
properties:
match:
items:
Expand All @@ -11582,6 +11582,52 @@ spec:
- headerValue
type: object
type: array
name:
type: string
type: object
setMirrorRoute:
properties:
match:
items:
properties:
headers:
additionalProperties:
properties:
exact:
type: string
prefix:
type: string
regex:
type: string
type: object
type: object
method:
properties:
exact:
type: string
prefix:
type: string
regex:
type: string
type: object
path:
properties:
exact:
type: string
prefix:
type: string
regex:
type: string
type: object
type: object
type: array
name:
type: string
percentage:
format: int32
type: integer
required:
- name
type: object
setWeight:
format: int32
Expand Down Expand Up @@ -11723,6 +11769,17 @@ spec:
type: object
type: array
type: object
managedRoutes:
items:
properties:
canaryRoute:
type: boolean
name:
type: string
required:
- name
type: object
type: array
nginx:
properties:
additionalIngressAnnotations:
Expand Down
59 changes: 58 additions & 1 deletion manifests/namespace-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11561,7 +11561,7 @@ spec:
format: int32
type: integer
type: object
setHeaderRouting:
setHeaderRoute:
properties:
match:
items:
Expand All @@ -11582,6 +11582,52 @@ spec:
- headerValue
type: object
type: array
name:
type: string
type: object
setMirrorRoute:
properties:
match:
items:
properties:
headers:
additionalProperties:
properties:
exact:
type: string
prefix:
type: string
regex:
type: string
type: object
type: object
method:
properties:
exact:
type: string
prefix:
type: string
regex:
type: string
type: object
path:
properties:
exact:
type: string
prefix:
type: string
regex:
type: string
type: object
type: object
type: array
name:
type: string
percentage:
format: int32
type: integer
required:
- name
type: object
setWeight:
format: int32
Expand Down Expand Up @@ -11723,6 +11769,17 @@ spec:
type: object
type: array
type: object
managedRoutes:
items:
properties:
canaryRoute:
type: boolean
name:
type: string
required:
- name
type: object
type: array
nginx:
properties:
additionalIngressAnnotations:
Expand Down
Loading