Skip to content

Commit 1cbf7ff

Browse files
committed
add example
Signed-off-by: Dylan Schlager <[email protected]>
1 parent dd80a9f commit 1cbf7ff

File tree

8 files changed

+569
-0
lines changed

8 files changed

+569
-0
lines changed

examples/traefik-header-based/README.md

+422
Large diffs are not rendered by default.
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: argo-rollouts-canary-service
5+
spec:
6+
ports:
7+
- port: 80
8+
targetPort: http
9+
protocol: TCP
10+
name: http
11+
selector:
12+
app: rollouts-demo
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRoleBinding
3+
metadata:
4+
name: gateway-admin-rollouts
5+
roleRef:
6+
apiGroup: rbac.authorization.k8s.io
7+
kind: ClusterRole
8+
name: gateway-controller-role
9+
subjects:
10+
- namespace: argo-rollouts
11+
kind: ServiceAccount
12+
name: argo-rollouts
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRole
3+
metadata:
4+
name: gateway-controller-role
5+
namespace: argo-rollouts
6+
rules:
7+
- apiGroups:
8+
- "*"
9+
resources:
10+
- "*"
11+
verbs:
12+
- "*"
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: gateway.networking.k8s.io/v1
2+
kind: Gateway
3+
metadata:
4+
name: traefik-gateway
5+
spec:
6+
gatewayClassName: traefik
7+
listeners:
8+
- protocol: HTTP
9+
name: web
10+
port: 8000 # Default endpoint for Helm chart
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: gateway.networking.k8s.io/v1
2+
kind: HTTPRoute
3+
metadata:
4+
name: argo-rollouts-http-route
5+
spec:
6+
parentRefs:
7+
- name: traefik-gateway
8+
namespace: default
9+
rules:
10+
- backendRefs:
11+
- name: argo-rollouts-stable-service
12+
port: 80
13+
- name: argo-rollouts-canary-service
14+
port: 80
+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
apiVersion: argoproj.io/v1alpha1
2+
kind: Rollout
3+
metadata:
4+
name: rollouts-demo
5+
spec:
6+
replicas: 5
7+
strategy:
8+
canary:
9+
canaryService: argo-rollouts-canary-service # our created canary service
10+
stableService: argo-rollouts-stable-service # our created stable service
11+
trafficRouting:
12+
managedRoutes:
13+
- name: rollouts-demo-canary-internal
14+
- name: rollouts-demo-canary-beta-customers
15+
plugins:
16+
argoproj-labs/gatewayAPI:
17+
httpRoutes:
18+
- name: argo-rollouts-http-route # our created httproute
19+
useHeaderRoutes: true
20+
namespace: default # namespace where this rollout resides
21+
steps:
22+
- setCanaryScale:
23+
weight: 1 # Scale pods equivalent to 1% of the total number of pods
24+
- setHeaderRoute:
25+
match:
26+
- headerName: X-Canary-Candidate
27+
headerValue:
28+
exact: internal
29+
name: rollouts-demo-canary-internal
30+
- pause: {} # Run synthetics tests or manual validation from internal users
31+
- setHeaderRoute:
32+
match:
33+
- headerName: X-Canary-Candidate
34+
headerValue:
35+
exact: beta-customers
36+
name: rollouts-demo-canary-beta-customers
37+
- pause: {} # Run analysis or manual validation from beta customers
38+
- setCanaryScale:
39+
weight: 30 # Prepare for real customer traffic
40+
- setWeight: 30
41+
- setCanaryScale:
42+
matchTrafficWeight: true # Allow pods to scale with setWeight steps
43+
- pause: { duration: 10 }
44+
- setWeight: 40
45+
- pause: { duration: 10 }
46+
- setWeight: 60
47+
- pause: { duration: 10 }
48+
- setWeight: 80
49+
- pause: { duration: 10 }
50+
- setWeight: 100
51+
- setHeaderRoute:
52+
name: rollouts-demo-canary-internal # Remove internal traffic route
53+
- setHeaderRoute:
54+
name: rollouts-demo-canary-beta-customers # Remove beta-customers traffic route
55+
- pause: {} # Final sanity check on 100% traffic
56+
revisionHistoryLimit: 2
57+
selector:
58+
matchLabels:
59+
app: rollouts-demo
60+
template:
61+
metadata:
62+
labels:
63+
app: rollouts-demo
64+
spec:
65+
containers:
66+
- name: rollouts-demo
67+
image: argoproj/rollouts-demo:red
68+
ports:
69+
- name: http
70+
containerPort: 8080
71+
protocol: TCP
72+
resources:
73+
requests:
74+
memory: 32Mi
75+
cpu: 5m
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: argo-rollouts-stable-service
5+
spec:
6+
ports:
7+
- port: 80
8+
targetPort: http
9+
protocol: TCP
10+
name: http
11+
selector:
12+
app: rollouts-demo

0 commit comments

Comments
 (0)