-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrollout.yaml
130 lines (123 loc) · 4.16 KB
/
rollout.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: nr-rollouts-demo
spec:
revisionHistoryLimit: 1
selector:
matchLabels:
app: nr-rollouts-demo
template:
metadata:
annotations:
sidecar.istio.io/inject: "true"
labels:
app: nr-rollouts-demo
spec:
containers:
- name: nr-rollouts-demo
image: edmocosta/nr-rollouts-demo:blue
ports:
- name: http
containerPort: 8080
protocol: TCP
resources:
requests:
memory: 32Mi
cpu: 5m
env:
- name: "NEW_RELIC_LICENSE_KEY"
valueFrom:
secretKeyRef:
name: newrelic
key: license-key
strategy:
canary:
stableService: nr-rollouts-demo-stable
canaryService: nr-rollouts-demo-canary
trafficRouting:
istio:
virtualService:
name: nr-rollouts-demo-virtualservice
routes:
- primary
analysis:
templates:
- templateName: newrelic-transaction-error-percentage-background
args:
- name: app-name
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: canary-pod-hash
valueFrom:
podTemplateHashValue: Latest
steps:
# First, we only redirect 3% of our application traffic to the canary. This amount is only an example
# and should be carefully defined according to your application characteristics. Too small values can
# lead to insufficient traffic to spot problems out. Bigger values can affect customers if the canary is
# completely broken.
- setWeight: 5
- pause: { duration: 60s }
- setWeight: 15
- pause: { duration: 60s }
- setWeight: 20
- pause: { duration: 60s }
- setWeight: 30
- pause: { duration: 120s }
# At this step, if the background analysis didn't report any failure, we will check our canary
# golden-signals (AI anomalies and incidents) opened since the deployment started (5 minutes ago).
- analysis:
templates:
- templateName: newrelic-golden-signals
args:
- name: app-name
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: since
value: "5 minutes ago"
- setWeight: 50
- pause: { duration: 120s }
- analysis:
templates:
- templateName: newrelic-golden-signals
args:
- name: app-name
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: since
value: "7 minutes ago"
- setWeight: 70
- pause: { duration: 120s }
- analysis:
templates:
- templateName: newrelic-golden-signals
args:
- name: app-name
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: since
value: "9 minutes ago"
- setWeight: 90
- pause: { duration: 120s }
# Finally, with 90% of the traffic being handled by the canary, we will check the golden-signals and
# also the HTTP error percentage reported during the WHOLE deployment time (11 minutes ago).
- analysis:
templates:
- templateName: newrelic-transaction-error-percentage
- templateName: newrelic-golden-signals
args:
- name: app-name
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: canary-pod-hash
valueFrom:
podTemplateHashValue: Latest
- name: since
value: "11 minutes ago"
# No more steps here means that the canary succeeded and will be automatically promoted to stable
# If you want to pause the canary here promote it manually, just add pause{} step with no duration.