You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This means that you cannot predict which requests from a single user will go the canary pods and which will go to the stable pods. This can be a big issue if the rollout represents an end-user application with a web based interface.
14
+
15
+
For example, if the new version has different colors on the web page buttons or different elements, a single user might see a different graphical interface each time they request the page.
16
+
17
+
To overcome this issue you can get full control over which requests go to the canary pods by using a special [HTTP header](https://datatracker.ietf.org/doc/html/rfc2616#section-4.2). This instructs Argo Rollouts to always sends requests to the canary pods if this special header is present.
Therefore you have the power to direct specific users to the canary instead of just random requests. There are several ways to inject custom headers in your network calls
22
+
23
+
1. Several network products (load balancers, proxies, firewalls etc.) can inject and process HTTP headers
24
+
1. You can have the application itself inject HTTP headers on its own requests
25
+
1. You can instruct other applications that call the canary application to use HTTP headers when they communicate with it.
The end result is that instead of having random requests go to canary pods, you can now decide exactly which users will see the canary pods.
30
+
7
31
## Using a custom header with a single route
8
32
33
+
!!! important
34
+
Your [Gateway API provider](https://gateway-api.sigs.k8s.io/implementations/) must also support Header based routing before you can activate it in a Rollout manifest.
35
+
9
36
Here is an example of a rollout that uses headers
10
37
for the canary:
11
38
@@ -68,11 +95,19 @@ spec:
68
95
protocol: TCP
69
96
```
70
97
98
+
This manifest instructs Argo Rollouts to do the following:
99
+
100
+
1. Create 2 **brand new** HTTP routes called `canary-route1` and `canary-route2`
101
+
1. The first route will be created on the fly when the canary is at 10% traffic. The second when the canary is at 50% traffic.
102
+
1. These routes will be cloned/copied from the provided `argo-rollouts-http-route`
103
+
1. Both of these 2 routes will always point to the canary pods
104
+
1. All requests with an HTTP header `X-Canary-start: ten-per-cent` will be sent to the first route while all requests with an http header `X-Canary-middle:half-traffic` will be sent to the second route
105
+
71
106
Notice that the route names used for headers in `setHeaderRoute` must also be defined in the `managedRoutes` block as well.
72
107
73
-
Now when the canary reaches 10% an extra route will be created that uses the `X-Canary-start` header with value `ten-per-cent`
108
+
Now when the canary reaches 10% an extra route will be created that uses the `X-Canary-start` header with value `ten-per-cent`. When the canary reaches 50% a different header route will be created. At the end of the canary all header routes are discarded.
74
109
75
-
When the canary reaches 50% a different header route will be created. At the end of the canary all header routes are discarded.
110
+
These smart routes will be created by Argo Rollouts and will be destroyed automatically when the rollout has finished. In your manifests you only need to provide the `argo-rollouts-http-route` definition. See also the [HTTP routing](https://gateway-api.sigs.k8s.io/guides/http-routing/) documentation.
76
111
77
112
## Using multiple routes with headers
78
113
@@ -147,4 +182,8 @@ spec:
147
182
```
148
183
149
184
With the `useHeaderRoutes` variable you can decide which routes
150
-
will honor the custom headers.
185
+
will honor the custom headers.
186
+
187
+
## Full example with Header based routing and Argo Rollouts
188
+
189
+
For a complete example with header based routing see our [LinkerD example](https://github.com/argoproj-labs/rollouts-plugin-trafficrouter-gatewayapi/tree/main/examples/linkerd-header-based).
0 commit comments