Skip to content

Commit

Permalink
feat: add support for istio setMirror step
Browse files Browse the repository at this point in the history
Signed-off-by: zachaller <[email protected]>
  • Loading branch information
zachaller committed Jun 9, 2022
1 parent 3f5960e commit 59bdb0f
Show file tree
Hide file tree
Showing 45 changed files with 4,358 additions and 831 deletions.
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:
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

0 comments on commit 59bdb0f

Please sign in to comment.