-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopenshift-dev.yml
350 lines (350 loc) · 9.5 KB
/
openshift-dev.yml
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
apiVersion: v1
kind: Template
metadata:
name: todoapp
annotations:
description: infrastructure
objects:
# role binding (view pour le service account default: permettre d'effectuer les requetes rest concernant le deployment config)
- apiVersion: v1
kind: RoleBinding
metadata:
name: view
roleRef:
name: view
subjects:
- kind: ServiceAccount
name: default
# Secret
- apiVersion: v1
kind: Secret
metadata:
name: mongodb-write-secret
data:
user: ZGV2dXNlcg==
password: ZGV2cGFzc3dvcmQ=
admin_password: YWRtaW5wYXNzd29yZA==
# Config map
- apiVersion: v1
kind: ConfigMap
metadata:
name: mongodb-write-config-map
data:
database: eventstoredb
# job purge databases (don't use in production ! only for dev !)
# After reflexion I'll keep it but in fact it is useless because it cannot be reexecuted.
# To execute a Job I have to create a new one ...
# Also currently web console do not support job. cf. https://trello.com/c/MNqXVNHs
#- apiVersion: batch/v1
# kind: Job
# metadata:
# labels:
# app: purge-databases
# name: purge-databases
# spec:
# parallelism: 1
# completions: 1
# template:
# metadata:
# labels:
# app: purge-databases
# name: purge-databases
# spec:
# containers:
# - name: purge-eventstore-database
# env:
# - name: KUBERNETES_NAMESPACE
# valueFrom:
# fieldRef:
# apiVersion: v1
# fieldPath: metadata.namespace
# - name: MONGODB_USER
# valueFrom:
# secretKeyRef:
# name: mongodb-write-secret
# key: user
# - name: MONGODB_PASSWORD
# valueFrom:
# secretKeyRef:
# name: mongodb-write-secret
# key: password
# - name: MONGODB_ADMIN_PASSWORD
# valueFrom:
# secretKeyRef:
# name: mongodb-write-secret
# key: admin_password
# - name: MONGODB_DATABASE
# valueFrom:
# configMapKeyRef:
# name: mongodb-write-config-map
# key: database
# image: centos/mongodb-36-centos7
# command:
# - "/bin/sh"
# - "-i"
# - "-c"
# - mongo eventstore-database.$(KUBERNETES_NAMESPACE).svc:27017/$MONGODB_DATABASE -u $MONGODB_USER -p $MONGODB_PASSWORD
# --eval="db = db.getSiblingDB('$(MONGODB_DATABASE)');db.domainevents.drop();db.trackingtokens.drop();db.snapshotevents.drop();db.sagas.drop();quit()"
# - name: purge-solr
# env:
# - name: KUBERNETES_NAMESPACE
# valueFrom:
# fieldRef:
# apiVersion: v1
# fieldPath: metadata.namespace
# image: giantswarm/tiny-tools
# command: ["sh", "-c", "curl http://solr.$(KUBERNETES_NAMESPACE).svc:8983/solr/update -H 'Content-type: text/xml' --data-binary '<delete><query>*:*</query></delete>'"]
# restartPolicy: OnFailure
# mongo write event store database (version ephemere) + rest
- apiVersion: v1
kind: Route
metadata:
labels:
app: eventstore-database-rest
name: eventstore-database-rest
spec:
port:
targetPort: 3000
to:
kind: Service
name: eventstore-database
- apiVersion: v1
kind: Service
metadata:
annotations:
template.openshift.io/expose-uri: mongodb://{.spec.clusterIP}:{.spec.ports[?(.name=="mongo")].port}
labels:
app: eventstore-database
name: eventstore-database
spec:
ports:
- name: mongo
nodePort: 0
port: 27017
protocol: TCP
targetPort: 27017
- name: mongo-rest
nodePort: 0
port: 3000
protocol: TCP
targetPort: 3000
selector:
name: eventstore-database
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
- apiVersion: v1
kind: DeploymentConfig
metadata:
annotations:
template.alpha.openshift.io/wait-for-ready: 'true'
labels:
app: eventstore-database
name: eventstore-database
spec:
replicas: 1
selector:
name: eventstore-database
triggers:
- type: ConfigChange
strategy:
type: Recreate
template:
metadata:
labels:
name: eventstore-database
spec:
containers:
- capabilities: {}
env:
- name: MONGODB_USER
valueFrom:
secretKeyRef:
name: mongodb-write-secret
key: user
- name: MONGODB_PASSWORD
valueFrom:
secretKeyRef:
name: mongodb-write-secret
key: password
- name: MONGODB_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: mongodb-write-secret
key: admin_password
- name: MONGODB_DATABASE
valueFrom:
configMapKeyRef:
name: mongodb-write-config-map
key: database
image: centos/mongodb-36-centos7
imagePullPolicy: IfNotPresent
livenessProbe:
initialDelaySeconds: 30
tcpSocket:
port: 27017
timeoutSeconds: 1
name: mongodb
ports:
- containerPort: 27017
protocol: TCP
readinessProbe:
exec:
command:
- "/bin/sh"
- "-i"
- "-c"
- mongo 127.0.0.1:27017/$MONGODB_DATABASE -u $MONGODB_USER -p $MONGODB_PASSWORD
--eval="quit()"
initialDelaySeconds: 3
timeoutSeconds: 1
resources:
limits:
memory: 256Mi
securityContext:
capabilities: {}
privileged: false
terminationMessagePath: "/dev/termination-log"
volumeMounts:
- mountPath: "/var/lib/mongodb/data"
name: eventstore-database-data
- name: eventstore-database-rest
env:
- name: MONGODB_USER
valueFrom:
secretKeyRef:
name: mongodb-write-secret
key: user
- name: MONGODB_PASSWORD
valueFrom:
secretKeyRef:
name: mongodb-write-secret
key: password
- name: MONGODB_DATABASE
valueFrom:
configMapKeyRef:
name: mongodb-write-config-map
key: database
- name: ME_CONFIG_DBSTRING
value: mongodb://$(MONGODB_USER):$(MONGODB_PASSWORD)@localhost:27017/$(MONGODB_DATABASE)
- name: ME_CONFIG_READONLY
value: y
image: linuxenko/mongo-rest
ports:
- containerPort: 3000
protocol: TCP
dnsPolicy: ClusterFirst
restartPolicy: Always
volumes:
- emptyDir:
medium: ''
name: eventstore-database-data
# solr
- apiVersion: v1
kind: Service
metadata:
labels:
app: solr
name: solr
spec:
ports:
- name: 8983-tcp
port: 8983
protocol: TCP
targetPort: 8983
selector:
app: solr
sessionAffinity: None
type: ClusterIP
- apiVersion: v1
kind: Route
metadata:
labels:
app: solr
name: solr
spec:
port:
targetPort: 8983-tcp
to:
kind: Service
name: solr
- apiVersion: v1
kind: DeploymentConfig
metadata:
labels:
app: solr
name: solr
spec:
replicas: 1
selector:
app: solr
triggers:
- type: ConfigChange
strategy:
activeDeadlineSeconds: 21600
rollingParams:
intervalSeconds: 1
maxSurge: 25%
maxUnavailable: 25%
timeoutSeconds: 600
updatePeriodSeconds: 1
post:
failurePolicy: Retry
execNewPod:
containerName: tools
env:
- name: KUBERNETES_NAMESPACE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
command: ["sh", "-c", "curl -X GET -G http://solr.$(KUBERNETES_NAMESPACE).svc:8983/solr/admin/cores -d action=CREATE -d name=mycores -d collection=my_collection -d configSet=_default"]
type: Rolling
template:
metadata:
labels:
app: solr
spec:
containers:
- image: giantswarm/tiny-tools
name: tools
command:
- tail
- '-f'
- /dev/null
- image: solr:7.4.0-alpine
imagePullPolicy: Always
name: solr
ports:
- containerPort: 8983
protocol: TCP
readinessProbe:
tcpSocket:
port: 8983
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
tcpSocket:
port: 8983
initialDelaySeconds: 15
periodSeconds: 20
terminationMessagePath: "/dev/termination-log"
terminationMessagePolicy: File
volumeMounts:
- mountPath: "/opt/solr/server/solr/mycores"
name: solr-data
- mountPath: "/opt/solr/server/logs"
name: solr-log
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
volumes:
- emptyDir:
medium: ''
name: solr-data
- emptyDir:
medium: ''
name: solr-log