-
Notifications
You must be signed in to change notification settings - Fork 18
/
openshift-template.yaml
388 lines (379 loc) · 13.3 KB
/
openshift-template.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
apiVersion: v1
kind: Template
metadata:
name: daytrader-template
labels:
app: daytrader
objects:
- apiVersion: v1
kind: ServiceAccount
metadata:
name: eap-service-account
secrets:
- name: eap-app-secret
- apiVersion: v1
data:
jgroups.jceks: zs7OzgAAAAIAAAABAAAAAwAKc2VjcmV0LWtleQAAAVDQhuHmrO0ABXNyADNjb20uc3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qGSIb3DQEBCwUAA4IBAQCFJQeVl+7XD9Is6lGHPgOr8Ep8pSHwCBY+95C4I7KPYapXB+U9gi9bKvVElfDD+IMPfqg2hRuFCnW3MQId/6QU+/c7+fwOnqE0oi6xo8nl7qx48Y/Ih3jXo3q7JON6CfrJHMSw47+gYi8c66S6EOePi2aGySQNBwqop85kEUhDEl6eGAAEo66+BrCUjwPNK3R5mGtx38FM54OibLkmDMS8pFfBN7qQ1C35JUdFDDJcNEBZ1WGIbkLxyIFsogJa1x6j235Fst9MASxeu5+xO3/WVHcLHQAZqJ/xZadEJAg2+YkPEhsrIEoFhRr3Hg13ECqD1W6aSW5kE5wPoWjru1gNUXYHaE8+iikx9yyc8V8V4CG63qk=
kind: Secret
metadata:
annotations:
description: Default HTTPS keystore (keystore.jks) with name 'jboss' and password
'mykeystorepass' and JGoups keystore (jgroups.jceks) with name 'secret-key'
and password 'password'
name: eap-app-secret
type: Opaque
- apiVersion: v1
kind: ImageStream
metadata:
name: web
spec:
tags:
- name: latest
- apiVersion: v1
kind: BuildConfig
metadata:
name: web
spec:
output:
to:
kind: ImageStreamTag
name: web:latest
runPolicy: Serial
source:
git:
uri: ${SOURCE_REPOSITORY_URL}
ref: ${SOURCE_REPOSITORY_REF}
type: Git
strategy:
sourceStrategy:
env:
- name: MAVEN_MIRROR_URL
value: ${MAVEN_MIRROR_URL}
- name: ARTIFACT_DIR
value: javaee6/assemblies/daytrader-ear/target
from:
kind: ImageStreamTag
name: jboss-eap70-openshift:1.4
namespace: openshift
type: Source
triggers:
- imageChange: {}
type: ImageChange
- type: ConfigChange
- apiVersion: v1
kind: DeploymentConfig
metadata:
name: web
labels:
application: web
spec:
replicas: 1
selector:
deploymentConfig: web
strategy:
resources: {}
rollingParams:
intervalSeconds: 1
maxSurge: 25%
maxUnavailable: 25%
timeoutSeconds: 600
updatePeriodSeconds: 1
type: Rolling
template:
metadata:
labels:
deploymentConfig: web
application: web
spec:
containers:
- env:
- name: DB_SERVICE_PREFIX_MAPPING
value: web-mysql=DB
- name: DB_JNDI
value: java:/jdbc/TradeDataSource
- name: DB_USERNAME
value: daytrader
- name: DB_PASSWORD
value: daytrader
- name: DB_DATABASE
value: tradedb
- name: TX_DATABASE_PREFIX_MAPPING
value: web-mysql=DB
- name: DB_MIN_POOL_SIZE
- name: DB_MAX_POOL_SIZE
- name: DB_TX_ISOLATION
- name: OPENSHIFT_KUBE_PING_LABELS
value: application=web
- name: OPENSHIFT_KUBE_PING_NAMESPACE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
- name: HORNETQ_CLUSTER_PASSWORD
value: ${HORNETQ_CLUSTER_PASSWORD}
- name: HORNETQ_QUEUES
value: TradeBrokerQueue
- name: HORNETQ_TOPICS
value: TradeStreamerTopic
- name: JGROUPS_ENCRYPT_SECRET
value: eap-app-secret
- name: JGROUPS_ENCRYPT_KEYSTORE_DIR
value: /etc/jgroups-encrypt-secret-volume
- name: JGROUPS_ENCRYPT_KEYSTORE
value: jgroups.jceks
- name: JGROUPS_ENCRYPT_NAME
value: secret-key
- name: JGROUPS_ENCRYPT_PASSWORD
value: password
- name: JGROUPS_CLUSTER_PASSWORD
value: ${JGROUPS_CLUSTER_PASSWORD}
- name: TIMER_SERVICE_DATA_STORE
value: web-mysql
- name: AUTO_DEPLOY_EXPLODED
value: "false"
image: web
imagePullPolicy: Always
livenessProbe:
failureThreshold: 3
httpGet:
path: /
port: 8080
scheme: HTTP
initialDelaySeconds: 20
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
name: web
ports:
- containerPort: 8778
name: jolokia
protocol: TCP
- containerPort: 8080
name: http
protocol: TCP
- containerPort: 8443
name: https
protocol: TCP
- containerPort: 8888
name: ping
protocol: TCP
readinessProbe:
failureThreshold: 3
httpGet:
path: /
port: 8080
scheme: HTTP
initialDelaySeconds: 20
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
resources: {}
terminationMessagePath: /dev/termination-log
volumeMounts:
- mountPath: /etc/eap-secret-volume
name: eap-keystore-volume
readOnly: true
- mountPath: /etc/jgroups-encrypt-secret-volume
name: eap-jgroups-keystore-volume
readOnly: true
dnsPolicy: ClusterFirst
restartPolicy: Always
securityContext: {}
serviceAccount: eap-service-account
serviceAccountName: eap-service-account
terminationGracePeriodSeconds: 60
volumes:
- name: eap-keystore-volume
secret:
defaultMode: 420
secretName: eap-app-secret
- name: eap-jgroups-keystore-volume
secret:
defaultMode: 420
secretName: eap-app-secret
test: false
triggers:
- imageChangeParams:
automatic: true
containerNames:
- web
from:
kind: ImageStreamTag
name: web:latest
type: ImageChange
- type: ConfigChange
status: {}
- apiVersion: v1
kind: DeploymentConfig
metadata:
name: mysql
spec:
replicas: 1
selector:
deploymentConfig: mysql
strategy:
recreateParams:
timeoutSeconds: 600
resources: {}
type: Recreate
template:
metadata:
labels:
deploymentConfig: mysql
spec:
containers:
- env:
- name: MYSQL_USER
value: daytrader
- name: MYSQL_PASSWORD
value: daytrader
- name: MYSQL_DATABASE
value: tradedb
- name: MYSQL_LOWER_CASE_TABLE_NAMES
value: "1"
image: centos/mysql-56-centos7
imagePullPolicy: Always
name: mysql
ports:
- containerPort: 3306
protocol: TCP
resources: {}
terminationMessagePath: /dev/termination-log
volumeMounts:
- mountPath: /var/lib/mysql/data
name: web-mysql-pvol
dnsPolicy: ClusterFirst
restartPolicy: Always
securityContext: {}
terminationGracePeriodSeconds: 60
volumes:
- name: web-mysql-pvol
persistentVolumeClaim:
claimName: web-mysql-claim
test: false
triggers:
- imageChangeParams:
automatic: true
containerNames:
- mysql
from:
kind: ImageStreamTag
name: mysql:latest
namespace: openshift
type: ImageChange
- type: ConfigChange
status: {}
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: web-mysql-claim
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
- apiVersion: v1
kind: Service
metadata:
annotations:
description: The web server's http port.
name: web
spec:
ports:
- port: 8080
protocol: TCP
targetPort: 8080
selector:
deploymentConfig: web
sessionAffinity: None
type: ClusterIP
- apiVersion: v1
kind: Service
metadata:
annotations:
description: The database server's port.
name: web-mysql
spec:
ports:
- port: 3306
protocol: TCP
targetPort: 3306
selector:
deploymentConfig: mysql
sessionAffinity: None
type: ClusterIP
- apiVersion: v1
kind: Route
metadata:
annotations:
description: Route for application's http service.
labels:
name: web
spec:
to:
kind: Service
name: web
weight: 100
wildcardPolicy: None
## pipeline
- apiVersion: v1
kind: BuildConfig
metadata:
labels:
build: daytrader-pipeline
name: daytrader-pipeline
annotations:
pipeline.alpha.openshift.io/uses: '[{"name": "web", "kind": "BuildConfig"},{"name": "web", "kind": "DeploymentConfig"}]'
spec:
runPolicy: Serial
strategy:
jenkinsPipelineStrategy:
jenkinsfile: |-
node ('maven') {
stage 'Build'
sleep 5
stage 'Run Tests in DEV'
sleep 4
stage 'Deploy to TEST'
sleep 4
stage 'Run Tests in TEST'
sleep 5
}
node {
stage 'Deploy to PROD (Not Live)'
sleep 6
stage 'Smoke Tests in PROD (Not Live)'
sleep 10
}
stage 'Approve Go Live'
timeout(time:30, unit:'MINUTES') {
input message:'Go Live in Production?'
}
node {
stage 'Go Live'
openshiftDeploy(deploymentConfig: 'web')
}
type: JenkinsPipeline
parameters:
- description: Maven mirror url. If nexus is deployed locally, use nexus url (e.g. http://nexus.ci:8081/content/groups/public/)
displayName: Maven mirror url
name: MAVEN_MIRROR_URL
- description: HornetQ cluster admin password
from: '[a-zA-Z0-9]{8}'
generate: expression
name: HORNETQ_CLUSTER_PASSWORD
required: true
- description: JGroups cluster password
from: '[a-zA-Z0-9]{8}'
generate: expression
name: JGROUPS_CLUSTER_PASSWORD
required: true
- description: Git source URI for application
name: SOURCE_REPOSITORY_URL
required: true
value: https://github.com/jamesfalkner/jboss-daytrader
- description: Git branch/tag reference
name: SOURCE_REPOSITORY_REF
value: "master"