forked from wkulhanek/docker-openshift-sonarqube
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsonarqube-template.yaml
301 lines (301 loc) · 7.65 KB
/
sonarqube-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
apiVersion: v1
kind: Template
metadata:
name: sonarqube
objects:
- apiVersion: "v1"
kind: "BuildConfig"
metadata:
name: "sonarqube"
spec:
source:
type: Git
git:
uri: "https://github.com/wkulhanek/docker-openshift-sonarqube"
strategy:
type: "Docker"
output:
to:
kind: "ImageStreamTag"
name: "sonarqube:latest"
triggers:
- type: ImageChange
- type: ConfigChange
- apiVersion: v1
kind: ImageStream
metadata:
labels:
app: sonarqube
name: sonarqube
spec:
tags:
- name: "latest"
annotations: null
importPolicy:
insecure: true
referencePolicy:
type: Source
triggers:
- type: ConfigChange
- kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: "${DATABASE_SERVICE_NAME}"
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: "${DATABASE_VOLUME_CAPACITY}"
- apiVersion: v1
kind: DeploymentConfig
metadata:
labels:
app: sonarqube
name: postgresql
spec:
replicas: 1
selector:
name: postgresql
strategy:
recreateParams:
timeoutSeconds: 900
resources: {}
type: Recreate
template:
metadata:
creationTimestamp: null
labels:
name: postgresql
spec:
containers:
- env:
- name: POSTGRESQL_USER
value: "${POSTGRESQL_USER}"
- name: POSTGRESQL_PASSWORD
value: "${POSTGRESQL_PASSWORD}"
- name: POSTGRESQL_DATABASE
value: "${POSTGRESQL_DATABASE}"
image: registry.access.redhat.com/rhscl/postgresql-95-rhel7@sha256:a0bfc4aa195737c802988f7c636073644d7a821061d801004277c98d776c9cbf
imagePullPolicy: IfNotPresent
livenessProbe:
failureThreshold: 3
initialDelaySeconds: 30
periodSeconds: 10
successThreshold: 1
tcpSocket:
port: 5432
timeoutSeconds: 1
name: postgresql
ports:
- containerPort: 5432
protocol: TCP
readinessProbe:
exec:
command:
- /bin/sh
- -i
- -c
- psql -h 127.0.0.1 -U $POSTGRESQL_USER -q -d $POSTGRESQL_DATABASE -c 'SELECT 1'
failureThreshold: 3
initialDelaySeconds: 5
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
resources:
limits:
memory: "${DATABASE_MEMORY_LIMIT}"
securityContext:
capabilities: {}
privileged: false
terminationMessagePath: /dev/termination-log
volumeMounts:
- mountPath: /var/lib/pgsql/data
name: postgresql-data
dnsPolicy: ClusterFirst
restartPolicy: Always
securityContext: {}
terminationGracePeriodSeconds: 30
volumes:
- name: postgresql-data
persistentVolumeClaim:
claimName: "${DATABASE_SERVICE_NAME}"
triggers:
- type: ConfigChange
test: false
- apiVersion: v1
kind: DeploymentConfig
metadata:
labels:
app: sonarqube
name: sonarqube
spec:
replicas: 1
selector:
app: sonarqube
deploymentconfig: sonarqube
strategy:
resources: {}
rollingParams:
intervalSeconds: 1
maxSurge: 25%
maxUnavailable: 25%
timeoutSeconds: 600
updatePeriodSeconds: 1
type: Rolling
template:
metadata:
annotations:
creationTimestamp: null
labels:
app: sonarqube
deploymentconfig: sonarqube
spec:
containers:
- env:
- name: SONARQUBE_JDBC_PASSWORD
value: "${POSTGRESQL_PASSWORD}"
- name: SONARQUBE_JDBC_URL
value: "jdbc:postgresql://${DATABASE_SERVICE_NAME}/${POSTGRESQL_DATABASE}"
- name: SONARQUBE_JDBC_USERNAME
value: "${POSTGRESQL_USER}"
image: sonarqube:latest
imagePullPolicy: IfNotPresent
livenessProbe:
failureThreshold: 3
httpGet:
path: /api/system/status
port: 9000
scheme: HTTP
initialDelaySeconds: 900
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 4
name: sonarqube
ports:
- containerPort: 9000
protocol: TCP
readinessProbe:
failureThreshold: 3
httpGet:
path: /api/system/status
port: 9000
scheme: HTTP
initialDelaySeconds: 120
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 4
resources:
requests:
cpu: 750m
memory: 1024Mi
terminationMessagePath: /dev/termination-log
dnsPolicy: ClusterFirst
restartPolicy: Always
resources:
limits:
memory: "${SONAR_MEMORY_LIMIT}"
securityContext: {}
terminationGracePeriodSeconds: 30
test: false
triggers:
- type: ConfigChange
- imageChangeParams:
automatic: true
containerNames:
- sonarqube
from:
kind: ImageStreamTag
name: sonarqube:latest
type: ImageChange
- kind: Service
apiVersion: v1
metadata:
name: "${DATABASE_SERVICE_NAME}"
labels:
app: sonarqube
spec:
ports:
- name: postgresql
protocol: TCP
port: 5432
targetPort: 5432
nodePort: 0
selector:
name: postgresql
type: ClusterIP
sessionAffinity: None
- apiVersion: v1
kind: Service
metadata:
annotations:
service.alpha.openshift.io/dependencies: '[{"name":"postgresql","namespace":"","kind":"Service"}]'
name: sonarqube
labels:
app: sonarqube
spec:
ports:
- name: 9000-tcp
port: 9000
protocol: TCP
targetPort: 9000
selector:
app: sonarqube
deploymentconfig: sonarqube
sessionAffinity: None
type: ClusterIP
- apiVersion: v1
kind: Route
metadata:
name: sonarqube
labels:
app: sonarqube
spec:
path: /
to:
kind: Service
name: sonarqube
port:
targetPort: 9000-tcp
parameters:
- name: DATABASE_SERVICE_NAME
displayName: Database Service Name
description: The name of the OpenShift Service exposed for the database.
value: postgresql
required: true
- name: DATABASE_MEMORY_LIMIT
displayName: Database Memory Limit
description: Maximum amount of memory the database can use.
value: 512Mi
- name: SONAR_MEMORY_LIMIT
displayName: Sonarqube Memory Limit
description: Maximum amount of memory the sonarqube can use.
value: 2Gi
- name: DATABASE_VOLUME_CAPACITY
displayName: Volume Capacity
description: Volume space available for data, e.g. 512Mi, 2Gi.
value: 1Gi
required: true
- name: POSTGRESQL_USER
displayName: PostgreSQL Connection Username
description: Username for PostgreSQL user that will be used for accessing the database.
generate: expression
from: user[A-Z0-9]{3}
value: sonar
required: true
- name: POSTGRESQL_PASSWORD
displayName: PostgreSQL Connection Password
description: Password for the PostgreSQL connection user.
generate: expression
from: "[a-zA-Z0-9]{16}"
required: true
- name: POSTGRESQL_DATABASE
displayName: PostgreSQL Database Name
description: Name of the PostgreSQL database accessed.
value: sonar
required: true
- name: POSTGRESQL_VERSION
displayName: Version of PostgreSQL Image
description: Version of PostgreSQL image to be used (9.2, 9.4, 9.5 or latest).
value: '9.5'
required: true