forked from power-dev-env/acmeair-mainservice-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy-acmeair-istio.yaml
407 lines (407 loc) · 7.58 KB
/
deploy-acmeair-istio.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
###### Main Service ######
apiVersion: v1
kind: Service
metadata:
name: main
namespace: default
labels:
app: main
spec:
ports:
- port: 9080
name: http
selector:
app: main
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: main
spec:
replicas: 1
template:
metadata:
labels:
app: main
spec:
containers:
- name: main
image: IMAGE_NAME
imagePullPolicy: IfNotPresent
ports:
- containerPort: 9080
---
###### Flight Service ######
apiVersion: v1
kind: Service
metadata:
name: flight
labels:
app: flight
spec:
ports:
- port: 9080
name: http
selector:
app: flight
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: flight
spec:
replicas: 1
template:
metadata:
labels:
app: flight
spec:
containers:
- name: flight
image: IMAGE_NAME
imagePullPolicy: IfNotPresent
ports:
- containerPort: 9080
env:
- name: MONGO_HOST
value: flight-db
- name: USERNAME
value: admin
- name: PASSWORD
value: password
- name: SECURE_SERVICE_CALLS
value: 'true'
---
###### Booking Service ######
apiVersion: v1
kind: Service
metadata:
name: booking
labels:
app: booking
spec:
ports:
- port: 9080
name: http
selector:
app: booking
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: booking
spec:
replicas: 1
template:
metadata:
labels:
app: booking
spec:
containers:
- env:
- name: JVM_ARGS
value: "-Dcom.acmeair.client.CustomerClient/mp-rest/url=http://customer:9080/customer -Dcom.acmeair.client.FlightClient/mp-rest/url=http://flight:9080/flight -Dmp.jwt.verify.publickey.location=http://auth:9080/auth/getJwk"
- name: MONGO_HOST
value: booking-db
- name: USERNAME
value: admin
- name: PASSWORD
value: password
- name: TRACK_REWARD_MILES
value: 'true'
- name: SECURE_SERVICE_CALLS
value: 'true'
name: booking
image: IMAGE_NAME
imagePullPolicy: IfNotPresent
ports:
- containerPort: 9080
---
###### Customer Service ######
apiVersion: v1
kind: Service
metadata:
name: customer
labels:
app: customer
spec:
ports:
- port: 9080
name: http
selector:
app: customer
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: customer
spec:
replicas: 1
template:
metadata:
labels:
app: customer
spec:
containers:
- name: customer
image: IMAGE_NAME
imagePullPolicy: IfNotPresent
ports:
- containerPort: 9080
env:
- name: JVM_ARGS
value: "-Dmp.jwt.verify.publickey.location=http://auth:9080/auth/getJwk"
- name: MONGO_HOST
value: customer-db
- name: USERNAME
value: admin
- name: PASSWORD
value: password
- name: SECURE_SERVICE_CALLS
value: 'true'
---
###### Auth Service ######
apiVersion: v1
kind: Service
metadata:
name: auth
labels:
app: auth
spec:
ports:
- port: 9080
name: http
selector:
app: auth
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: auth
spec:
replicas: 1
template:
metadata:
labels:
app: auth
spec:
containers:
- env:
- name: JVM_ARGS
value: "-Dcom.acmeair.client.CustomerClient/mp-rest/url=http://customer:9080/customer"
name: auth
image: IMAGE_NAME
imagePullPolicy: IfNotPresent
ports:
- containerPort: 9080
---
##### Flight Database #####
apiVersion: v1
kind: Service
metadata:
creationTimestamp: null
labels:
service: flight-db
app: flight-db
name: flight-db
spec:
ports:
- name: "27017"
port: 27017
protocol: TCP
targetPort: 27017
selector:
service: flight-db
app: flight-db
status:
loadBalancer: {}
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
creationTimestamp: null
name: flight-db
spec:
replicas: 1
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
service: flight-db
app: flight-db
spec:
containers:
- image: mongo
name: flight-db
ports:
- containerPort: 27017
protocol: TCP
resources: {}
restartPolicy: Always
status: {}
---
##### Booking Database #####
apiVersion: v1
kind: Service
metadata:
creationTimestamp: null
labels:
service: booking-db
app: booking-db
name: booking-db
spec:
ports:
- name: "27017"
port: 27017
protocol: TCP
targetPort: 27017
selector:
service: booking-db
app: booking-db
status:
loadBalancer: {}
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
creationTimestamp: null
name: booking-db
spec:
replicas: 1
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
service: booking-db
app: booking-db
spec:
containers:
- image: mongo
name: booking-db
ports:
- containerPort: 27017
protocol: TCP
resources: {}
restartPolicy: Always
status: {}
---
##### Customer Database #####
apiVersion: v1
kind: Service
metadata:
creationTimestamp: null
labels:
service: customer-db
app: customer-db
name: customer-db
spec:
ports:
- name: "27017"
port: 27017
protocol: TCP
targetPort: 27017
selector:
service: customer-db
app: customer-db
status:
loadBalancer: {}
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
creationTimestamp: null
name: customer-db
spec:
replicas: 1
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
service: customer-db
app: customer-db
spec:
containers:
- image: mongo
name: customer-db
ports:
- containerPort: 27017
protocol: TCP
resources: {}
restartPolicy: Always
status: {}
---
##################################################################
# Gateway
##################################################################
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: acmeair-gateway
spec:
selector:
istio: ingressgateway # use istio default controller
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "*"
---
###################################################################
# Virtual Services
###################################################################
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: acmeair
spec:
hosts:
- "*"
gateways:
- acmeair-gateway
http:
- match:
- uri:
prefix: /flight
route:
- destination:
port:
number: 9080
host: flight
- match:
- uri:
prefix: /booking
route:
- destination:
port:
number: 9080
host: booking
- match:
- uri:
prefix: /customer
route:
- destination:
port:
number: 9080
host: customer
- match:
- uri:
prefix: /auth
route:
- destination:
port:
number: 9080
host: auth
- match:
- uri:
prefix: /acmeair
route:
- destination:
port:
number: 9080
host: main
---