Skip to content

Commit 0f47796

Browse files
authored
docs: experiment step with traffic routing (argoproj#1469)
* docs: experiment step with traffic routing Signed-off-by: khhirani <[email protected]>
1 parent 7c54090 commit 0f47796

File tree

3 files changed

+235
-0
lines changed

3 files changed

+235
-0
lines changed

docs/features/experiment.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,3 +194,54 @@ necessary metrics queries, using the `{{templates.baseline.podTemplateHash}}` an
194194
Rollout. This is despite the fact that the PodSpec are the same. This is intentional behavior,
195195
in order to allow the metrics of the Experiment's pods to be delineated and queried separately
196196
from the metrics of the Rollout pods.
197+
198+
199+
200+
## Weighted Experiment Step with Traffic Routing
201+
!!! important
202+
Available since v1.1
203+
204+
A Rollout using the Canary strategy along with Traffic Routing can
205+
split traffic to an experiment stack in a fine-grained manner. When
206+
Traffic Routing is enabled, the Rollout Experiment step allows
207+
traffic to be shifted to experiment pods.
208+
209+
!!! note
210+
This feature is currently available only for the SMI and ALB Traffic Routers.
211+
212+
```yaml
213+
apiVersion: argoproj.io/v1alpha1
214+
kind: Rollout
215+
metadata:
216+
name: guestbook
217+
labels:
218+
app: guestbook
219+
spec:
220+
...
221+
strategy:
222+
canary:
223+
trafficRouting:
224+
alb:
225+
ingress: ingress
226+
...
227+
steps:
228+
- experiment:
229+
duration: 1h
230+
templates:
231+
- name: experiment-baseline
232+
specRef: stable
233+
weight: 5
234+
- name: experiment-canary
235+
specRef: canary
236+
weight: 5
237+
```
238+
239+
In the above example, during an update, the first step would start
240+
a baseline vs. canary experiment. When pods are ready (Experiment enters
241+
Running phase), the rollout would direct 5% of traffic to `experiment-canary` and 5%
242+
to `experiment-baseline`, leaving the remaining 90% of traffic to the old stack.
243+
244+
!!! note
245+
When a weighted experiment step with traffic routing is used, a
246+
service is auto-created for each experiment template. The traffic routers use
247+
this service to send traffic to the experiment pods.
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: alb-rollout-root
5+
spec:
6+
type: NodePort
7+
ports:
8+
- port: 80
9+
targetPort: http
10+
protocol: TCP
11+
name: http
12+
selector:
13+
app: alb-rollout
14+
---
15+
apiVersion: v1
16+
kind: Service
17+
metadata:
18+
name: alb-rollout-canary
19+
spec:
20+
type: NodePort
21+
ports:
22+
- port: 80
23+
targetPort: http
24+
protocol: TCP
25+
name: http
26+
selector:
27+
app: alb-rollout
28+
---
29+
apiVersion: v1
30+
kind: Service
31+
metadata:
32+
name: alb-rollout-stable
33+
spec:
34+
type: NodePort
35+
ports:
36+
- port: 80
37+
targetPort: http
38+
protocol: TCP
39+
name: http
40+
selector:
41+
app: alb-rollout
42+
---
43+
apiVersion: networking.k8s.io/v1beta1
44+
kind: Ingress
45+
metadata:
46+
name: alb-rollout-ingress
47+
annotations:
48+
kubernetes.io/ingress.class: alb
49+
spec:
50+
rules:
51+
- http:
52+
paths:
53+
- path: /*
54+
backend:
55+
serviceName: alb-rollout-root
56+
servicePort: use-annotation
57+
---
58+
apiVersion: argoproj.io/v1alpha1
59+
kind: Rollout
60+
metadata:
61+
name: alb-rollout
62+
spec:
63+
selector:
64+
matchLabels:
65+
app: alb-rollout
66+
template:
67+
metadata:
68+
labels:
69+
app: alb-rollout
70+
spec:
71+
containers:
72+
- name: alb-rollout
73+
image: argoproj/rollouts-demo:blue
74+
ports:
75+
- name: http
76+
containerPort: 80
77+
protocol: TCP
78+
resources:
79+
requests:
80+
memory: 16Mi
81+
cpu: 5m
82+
strategy:
83+
canary:
84+
canaryService: alb-rollout-canary
85+
stableService: alb-rollout-stable
86+
trafficRouting:
87+
alb:
88+
ingress: alb-rollout-ingress
89+
rootService: alb-rollout-root
90+
servicePort: 80
91+
steps:
92+
- setWeight: 10
93+
- experiment:
94+
templates:
95+
- name: experiment-alb
96+
specRef: canary
97+
weight: 20
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: rollout-smi-experiment-canary
5+
spec:
6+
ports:
7+
- port: 80
8+
targetPort: http
9+
protocol: TCP
10+
name: http
11+
selector:
12+
app: rollout-smi-experiment
13+
# This selector will be updated with the pod-template-hash of the canary ReplicaSet. e.g.:
14+
# rollouts-pod-template-hash: 7bf84f9696
15+
---
16+
apiVersion: v1
17+
kind: Service
18+
metadata:
19+
name: rollout-smi-experiment-stable
20+
spec:
21+
ports:
22+
- port: 80
23+
targetPort: http
24+
protocol: TCP
25+
name: http
26+
selector:
27+
app: rollout-smi-experiment
28+
# This selector will be updated with the pod-template-hash of the stable ReplicaSet. e.g.:
29+
# rollouts-pod-template-hash: 789746c88d
30+
---
31+
apiVersion: networking.k8s.io/v1beta1
32+
kind: Ingress
33+
metadata:
34+
name: rollout-smi-experiment-stable
35+
annotations:
36+
kubernetes.io/ingress.class: nginx
37+
spec:
38+
rules:
39+
- host: rollout-smi-experiment.local
40+
http:
41+
paths:
42+
- path: /
43+
backend:
44+
# Reference to a Service name, also specified in the Rollout spec.strategy.canary.stableService field
45+
serviceName: rollout-smi-experiment-stable
46+
servicePort: 80
47+
---
48+
apiVersion: argoproj.io/v1alpha1
49+
kind: Rollout
50+
metadata:
51+
name: rollout-smi-experiment
52+
spec:
53+
replicas: 1
54+
strategy:
55+
canary:
56+
canaryService: rollout-smi-experiment-canary
57+
stableService: rollout-smi-experiment-stable
58+
trafficRouting:
59+
smi:
60+
trafficSplitName: rollout-smi-experiment-trafficsplit
61+
steps:
62+
- setWeight: 5
63+
- experiment:
64+
templates:
65+
- name: experiment-smi
66+
specRef: canary
67+
weight: 5
68+
revisionHistoryLimit: 2
69+
selector:
70+
matchLabels:
71+
app: rollout-smi-experiment
72+
template:
73+
metadata:
74+
labels:
75+
app: rollout-smi-experiment
76+
spec:
77+
containers:
78+
- name: rollout-smi-experiment
79+
image: argoproj/rollouts-demo:blue
80+
ports:
81+
- name: http
82+
containerPort: 80
83+
protocol: TCP
84+
resources:
85+
requests:
86+
memory: 16Mi
87+
cpu: 5m

0 commit comments

Comments
 (0)