This repository has been archived by the owner on Dec 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
discovery_template.yaml
475 lines (475 loc) · 14.5 KB
/
discovery_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
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
apiVersion: template.openshift.io/v1
kind: Template
labels:
template: discovery
metadata:
name: discovery
annotations:
description: The Discovery Server application
tags: discovery
objects:
- apiVersion: v1
kind: ServiceAccount
imagePullSecrets:
- name: discovery-pull-secret
metadata:
name: ${DISCOVERY_SA_NAME}
- apiVersion: v1
kind: Secret
metadata:
name: discovery-secrets
data:
django-secret-key: ${DJANGO_SECRET_KEY}
server-password: ${DISCOVERY_SERVER_PASSWORD}
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: discovery-data-volume-claim
spec:
accessModes:
- ReadWriteMany
volumeMode: Filesystem
resources:
requests:
storage: 8Gi
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: discovery-log-volume-claim
spec:
accessModes:
- ReadWriteMany
volumeMode: Filesystem
resources:
requests:
storage: 4Gi
- apiVersion: v1
kind: Service
metadata:
name: discovery-server
spec:
selector:
app: discovery-server
deployment: discovery-server
ports:
- port: ${{DISCOVERY_SERVER_PORT}}
protocol: TCP
targetPort: ${{DISCOVERY_SERVER_PORT}}
type: ClusterIP
internalTrafficPolicy: Cluster
ipFamilites:
- IPv4
- apiVersion: v1
kind: Service
metadata:
name: discovery-redis
spec:
selector:
app: discovery-redis
deployment: discovery-redis
ports:
- port: ${{DISCOVERY_REDIS_PORT}}
protocol: TCP
targetPort: ${{DISCOVERY_REDIS_PORT}}
type: ClusterIP
internalTrafficPolicy: Cluster
ipFamilites:
- IPv4
- apiVersion: v1
kind: Service
metadata:
name: discovery-db
spec:
selector:
app: discovery-db
deployment: discovery-db
ports:
- port: ${{DISCOVERY_DBMS_PORT}}
protocol: TCP
targetPort: ${{DISCOVERY_DBMS_PORT}}
type: ClusterIP
internalTrafficPolicy: Cluster
ipFamilites:
- IPv4
- apiVersion: route.openshift.io/v1
kind: Route
metadata:
name: discovery-server
spec:
host: ${APPLICATION_DOMAIN}
port:
targetPort: ${{DISCOVERY_SERVER_PORT}}
tls:
termination: passthrough
insecureEdgeTerminationPolicy: None
to:
kind: Service
name: discovery-server
weight: 100
wildcardPolicy: None
status:
ingress:
- conditions:
host: ${APPLICATION_DOMAIN}
wildcardPolicy: None
- apiVersion: apps/v1
kind: Deployment
metadata:
name: discovery-server
spec:
replicas: 1
selector:
matchLabels:
app: discovery-server
strategy:
type: Recreate
template:
metadata:
labels:
app: discovery-server
deployment: discovery-server
spec:
containers:
- name: discovery-server
image: ${DISCOVERY_SERVER_IMAGE}
imagePullPolicy: Always
serviceAccount: ${DISCOVERY_SA_NAME}
serviceAccountName: ${DISCOVERY_SA_NAME}
ports:
- containerPort: ${{DISCOVERY_SERVER_PORT}}
protocol: TCP
securityContext:
runAsNonRoot: true
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
seccompProfile:
type: "RuntimeDefault"
livenessProbe:
exec:
command:
- /bin/sh
- -c
- 'ps axo command | grep -v grep | grep gunicorn'
failureThreshold: 3
initialDelaySeconds: 5
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
readinessProbe:
httpGet:
path: /api/v1/status/
port: ${{DISCOVERY_SERVER_PORT}}
scheme: HTTPS
httpHeaders:
- name: Host
value: "discovery-server.${DISCOVERY_NAMESPACE}.svc.cluster.local"
failureThreshold: 5
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
volumeMounts:
- mountPath: /var/data
name: discovery-data-volume-claim
- mountPath: /var/log
name: discovery-log-volume-claim
env:
- name: ANSIBLE_REMOTE_TMP
value: "${ANSIBLE_REMOTE_TMP}"
- name: ANSIBLE_LOCAL_TEMP
value: "${ANSIBLE_LOCAL_TEMP}"
- name: ANSIBLE_LOG_LEVEL
value: "3"
- name: DJANGO_SECRET_PATH
value: "${DJANGO_SECRET_PATH}"
- name: DJANGO_SECRET_KEY
valueFrom:
secretKeyRef:
key: django-secret-key
name: discovery-secrets
- name: QPC_DBMS
value: "postgres"
- name: QPC_DBMS_DATABASE
value: "qpc"
- name: QPC_DBMS_HOST
value: "discovery-db.${DISCOVERY_NAMESPACE}.svc.cluster.local"
- name: QPC_DBMS_PASSWORD
value: "qpc"
- name: QPC_DBMS_PORT
value: "${DISCOVERY_DBMS_PORT}"
- name: QPC_DBMS_USER
value: "qpc"
- name: QPC_SERVER_PORT
value: "${DISCOVERY_SERVER_PORT}"
- name: QPC_SERVER_TIMEOUT
value: "5"
- name: QPC_SERVER_USERNAME
value: "${DISCOVERY_SERVER_USERNAME}"
- name: QPC_SERVER_PASSWORD
valueFrom:
secretKeyRef:
key: server-password
name: discovery-secrets
- name: NETWORK_CONNECT_JOB_TIMEOUT
value: "6"
- name: NETWORK_INSPECT_JOB_TIMEOUT
value: "600"
- name: QPC_DEBUGPY
value: "1"
- name: QPC_LOG_ALL_ENV_VARS_AT_STARTUP
value: "False"
- name: REDIS_HOST
value: "discovery-redis.${DISCOVERY_NAMESPACE}.svc.cluster.local"
- name: REDIS_PASSWORD
value: "qpc"
imagePullSecrets:
- name: discovery-pull-secret
restartPolicy: Always
volumes:
- name: discovery-data-volume-claim
persistentVolumeClaim:
claimName: discovery-data-volume-claim
- name: discovery-log-volume-claim
persistentVolumeClaim:
claimName: discovery-log-volume-claim
triggers:
- type: ConfigChange
- apiVersion: apps/v1
kind: Deployment
metadata:
name: discovery-celery-worker
spec:
replicas: "${{DISCOVERY_CELERY_WORKER_MINIMUM_REPLICA_COUNT}}"
selector:
matchLabels:
app: discovery-celery-worker
strategy:
type: Recreate
template:
metadata:
labels:
app: discovery-celery-worker
deployment: discovery-celery-worker
spec:
containers:
- name: discovery-celery-worker
image: ${DISCOVERY_SERVER_IMAGE}
imagePullPolicy: Always
serviceAccount: ${DISCOVERY_SA_NAME}
serviceAccountName: ${DISCOVERY_SA_NAME}
command: [ "/bin/sh", "-c", "/deploy/entrypoint_celery_worker.sh" ]
securityContext:
runAsNonRoot: true
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
seccompProfile:
type: "RuntimeDefault"
volumeMounts:
- mountPath: /var/data
name: discovery-data-volume-claim
- mountPath: /var/log
name: discovery-log-volume-claim
env:
- name: ANSIBLE_REMOTE_TMP
value: "${ANSIBLE_REMOTE_TMP}"
- name: ANSIBLE_LOCAL_TEMP
value: "${ANSIBLE_LOCAL_TEMP}"
- name: DJANGO_SECRET_PATH
value: "${DJANGO_SECRET_PATH}"
- name: DJANGO_SECRET_KEY
valueFrom:
secretKeyRef:
key: django-secret-key
name: discovery-secrets
- name: REDIS_HOST
value: "discovery-redis.${DISCOVERY_NAMESPACE}.svc.cluster.local"
- name: REDIS_PASSWORD
value: "qpc"
imagePullSecrets:
- name: discovery-pull-secret
restartPolicy: Always
volumes:
- name: discovery-data-volume-claim
persistentVolumeClaim:
claimName: discovery-data-volume-claim
- name: discovery-log-volume-claim
persistentVolumeClaim:
claimName: discovery-log-volume-claim
triggers:
- type: ConfigChange
- apiVersion: apps/v1
kind: Deployment
metadata:
name: discovery-db
spec:
replicas: 1
selector:
matchLabels:
app: discovery-db
strategy:
type: Recreate
template:
metadata:
labels:
app: discovery-db
deployment: discovery-db
spec:
containers:
- name: discovery-db
image: registry.redhat.io/rhel8/postgresql-12
imagePullPolicy: Always
serviceAccount: ${DISCOVERY_SA_NAME}
serviceAccountName: ${DISCOVERY_SA_NAME}
securityContext:
runAsNonRoot: true
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
seccompProfile:
type: "RuntimeDefault"
volumeMounts:
- mountPath: /var/lib/pgsql/data
name: discovery-data-volume-claim
ports:
- containerPort: ${{DISCOVERY_DBMS_PORT}}
protocol: TCP
readinessProbe:
exec:
command: [ "/bin/pg_isready", "-U", "postgres" ]
failureThreshold: 3
initialDelaySeconds: 30
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 45
env:
- name: POSTGRESQL_USER
value: "qpc"
- name: POSTGRESQL_PASSWORD
value: "qpc"
- name: POSTGRESQL_DATABASE
value: "qpc"
imagePullSecrets:
- name: discovery-pull-secret
volumes:
- name: discovery-data-volume-claim
persistentVolumeClaim:
claimName: discovery-data-volume-claim
restartPolicy: Always
triggers:
- type: ConfigChange
- apiVersion: apps/v1
kind: Deployment
metadata:
name: discovery-redis
spec:
replicas: 1
selector:
matchLabels:
app: discovery-redis
strategy:
type: Recreate
template:
metadata:
labels:
app: discovery-redis
deployment: discovery-redis
spec:
containers:
- name: discovery-redis
image: registry.redhat.io/rhel9/redis-6
imagePullPolicy: Always
serviceAccount: ${DISCOVERY_SA_NAME}
serviceAccountName: ${DISCOVERY_SA_NAME}
securityContext:
runAsNonRoot: true
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
seccompProfile:
type: "RuntimeDefault"
ports:
- containerPort: ${{DISCOVERY_REDIS_PORT}}
protocol: TCP
livenessProbe:
tcpSocket:
port: ${{DISCOVERY_REDIS_PORT}}
initialDelaySeconds: 30
timeoutSeconds: 5
periodSeconds: 5
failureThreshold: 5
successThreshold: 1
readinessProbe:
exec:
command:
- redis-cli
- ping
initialDelaySeconds: 20
timeoutSeconds: 5
periodSeconds: 3
env:
- name: REDIS_PASSWORD
value: "qpc"
imagePullSecrets:
- name: discovery-pull-secret
restartPolicy: Always
triggers:
- type: ConfigChange
parameters:
- name: DISCOVERY_NAMESPACE
displayName: Discovery Project namespace
description: This is the OpenShift project namespace where Discovery is getting installed.
value: "discovery"
- name: APPLICATION_DOMAIN
displayName: Application Hostname
description: This is the externally accessible URL for the Discovery server.
value: "discovery-server-discovery.apps-crc.testing"
- name: ANSIBLE_REMOTE_TMP
displayName: Path for the Ansible Remote Temp directory.
description: This is the path for the ansible remote temp directory (overrides /.ansible/tmp).
value: "/var/data/tmp/ansible/remote"
- name: ANSIBLE_LOCAL_TEMP
displayName: Path for the Ansible Local Temp directory.
description: This is the path for the ansible temp directory (overrides /.ansible/tmp).
value: "/var/data/tmp/ansible/local"
- name: DJANGO_SECRET_PATH
displayName: Path for the Django secret
description: This is the path for the Django secret
value: "/var/data/secret.txt"
- name: DJANGO_SECRET_KEY
displayName: Django secret key
description: This is the Django App Secret key
value: "ZGV2ZWxvcG1lbnQK"
- name: DISCOVERY_SERVER_IMAGE
displayName: Container image for the Discovery server.
description: This is the image for the Discovery server.
value: "quay.io/quipucords/quipucords:latest"
- name: DISCOVERY_SERVER_USERNAME
displayName: Discovery server admin user account.
description: This is the admin user account for the Discovery server.
value: "admin"
- name: DISCOVERY_SERVER_PASSWORD
displayName: Discovery server admin password.
description: This is the password for the admin user account of the Discovery server.
value: ""
- name: DISCOVERY_SA_NAME
displayName: Discovery Service Account Name
description: This is the name for the Discovery Service Account.
value: "discovery-sa"
- name: DISCOVERY_CELERY_WORKER_MINIMUM_REPLICA_COUNT
displayName: Discovery Celery Worker Minimum Replica Count
description: This is the starting number of Celery workers replicas requested.
value: '3'
- name: DISCOVERY_SERVER_PORT
displayName: Discovery Server SSL Port (API/UI)
description: This is the SSL port for the quipucords server.
value: "8443"
- name: DISCOVERY_REDIS_PORT
displayName: Discovery Redis Port
description: This is the port for the quipucords redis server.
value: "6379"
- name: DISCOVERY_DBMS_PORT
displayName: Discovery PostgresQL Database Port
description: This is the port for the quipucords postgresql database.
value: "5432"