summaryrefslogtreecommitdiffstats
path: root/roles/openshift_cfme/files/miq-template.yaml
blob: 8f0d2af384ac5e143113565d33e6955db38083d0 (plain)
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
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
---
path: /tmp/miq-template-out
data:
  apiVersion: v1
  kind: Template
  labels:
    template: manageiq
  metadata:
    name: manageiq
    annotations:
      description: "ManageIQ appliance with persistent storage"
      tags: "instant-app,manageiq,miq"
      iconClass: "icon-rails"
  objects:
  - apiVersion: v1
    kind: Secret
    metadata:
      name: "${NAME}-secrets"
    stringData:
      pg-password: "${DATABASE_PASSWORD}"
  - apiVersion: v1
    kind: Service
    metadata:
      annotations:
        description: "Exposes and load balances ManageIQ pods"
        service.alpha.openshift.io/dependencies: '[{"name":"${DATABASE_SERVICE_NAME}","namespace":"","kind":"Service"},{"name":"${MEMCACHED_SERVICE_NAME}","namespace":"","kind":"Service"}]'
      name: ${NAME}
    spec:
      clusterIP: None
      ports:
      - name: http
        port: 80
        protocol: TCP
        targetPort: 80
      - name: https
        port: 443
        protocol: TCP
        targetPort: 443
      selector:
        name: ${NAME}
  - apiVersion: v1
    kind: Route
    metadata:
      name: ${NAME}
    spec:
      host: ${APPLICATION_DOMAIN}
      port:
        targetPort: https
      tls:
        termination: passthrough
      to:
        kind: Service
        name: ${NAME}
  - apiVersion: v1
    kind: ImageStream
    metadata:
      name: miq-app
      annotations:
        description: "Keeps track of the ManageIQ image changes"
    spec:
      dockerImageRepository: "${APPLICATION_IMG_NAME}"
  - apiVersion: v1
    kind: ImageStream
    metadata:
      name: miq-postgresql
      annotations:
        description: "Keeps track of the PostgreSQL image changes"
    spec:
      dockerImageRepository: "${POSTGRESQL_IMG_NAME}"
  - apiVersion: v1
    kind: ImageStream
    metadata:
      name: miq-memcached
      annotations:
        description: "Keeps track of the Memcached image changes"
    spec:
      dockerImageRepository: "${MEMCACHED_IMG_NAME}"
  - apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      name: "${NAME}-${DATABASE_SERVICE_NAME}"
    spec:
      accessModes:
        - ReadWriteOnce
      resources:
        requests:
          storage: ${DATABASE_VOLUME_CAPACITY}
  - apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      name: "${NAME}-region"
    spec:
      accessModes:
        - ReadWriteOnce
      resources:
        requests:
          storage: ${APPLICATION_REGION_VOLUME_CAPACITY}
  - apiVersion: apps/v1beta1
    kind: "StatefulSet"
    metadata:
      name: ${NAME}
      annotations:
        description: "Defines how to deploy the ManageIQ appliance"
    spec:
      serviceName: "${NAME}"
      replicas: "${APPLICATION_REPLICA_COUNT}"
      template:
        metadata:
          labels:
            name: ${NAME}
          name: ${NAME}
        spec:
          containers:
          - name: manageiq
            image: "${APPLICATION_IMG_NAME}:${APPLICATION_IMG_TAG}"
            livenessProbe:
              tcpSocket:
                port: 443
              initialDelaySeconds: 480
              timeoutSeconds: 3
            readinessProbe:
              httpGet:
                path: /
                port: 443
                scheme: HTTPS
              initialDelaySeconds: 200
              timeoutSeconds: 3
            ports:
            - containerPort: 80
              protocol: TCP
            - containerPort: 443
              protocol: TCP
            securityContext:
              privileged: true
            volumeMounts:
                -
                  name: "${NAME}-server"
                  mountPath: "/persistent"
                -
                  name: "${NAME}-region"
                  mountPath: "/persistent-region"
            env:
              -
                name: "APPLICATION_INIT_DELAY"
                value: "${APPLICATION_INIT_DELAY}"
              -
                name: "DATABASE_SERVICE_NAME"
                value: "${DATABASE_SERVICE_NAME}"
              -
                name: "DATABASE_REGION"
                value: "${DATABASE_REGION}"
              -
                name: "MEMCACHED_SERVICE_NAME"
                value: "${MEMCACHED_SERVICE_NAME}"
              -
                name: "POSTGRESQL_USER"
                value: "${DATABASE_USER}"
              -
                name: "POSTGRESQL_PASSWORD"
                valueFrom:
                  secretKeyRef:
                    name: "${NAME}-secrets"
                    key: "pg-password"
              -
                name: "POSTGRESQL_DATABASE"
                value: "${DATABASE_NAME}"
              -
                name: "POSTGRESQL_MAX_CONNECTIONS"
                value: "${POSTGRESQL_MAX_CONNECTIONS}"
              -
                name: "POSTGRESQL_SHARED_BUFFERS"
                value: "${POSTGRESQL_SHARED_BUFFERS}"
            resources:
              requests:
                memory: "${APPLICATION_MEM_REQ}"
                cpu: "${APPLICATION_CPU_REQ}"
              limits:
                memory: "${APPLICATION_MEM_LIMIT}"
            lifecycle:
              preStop:
                exec:
                  command:
                    - /opt/manageiq/container-scripts/sync-pv-data
          volumes:
           -
             name: "${NAME}-region"
             persistentVolumeClaim:
               claimName: ${NAME}-region
      volumeClaimTemplates:
        - metadata:
            name: "${NAME}-server"
            annotations:
              # Uncomment this if using dynamic volume provisioning.
              # https://docs.openshift.org/latest/install_config/persistent_storage/dynamically_provisioning_pvs.html
              # volume.alpha.kubernetes.io/storage-class: anything
          spec:
            accessModes: [ ReadWriteOnce ]
            resources:
              requests:
                storage: "${APPLICATION_VOLUME_CAPACITY}"
  - apiVersion: v1
    kind: "Service"
    metadata:
      name: "${MEMCACHED_SERVICE_NAME}"
      annotations:
        description: "Exposes the memcached server"
    spec:
      ports:
        -
          name: "memcached"
          port: 11211
          targetPort: 11211
      selector:
        name: "${MEMCACHED_SERVICE_NAME}"
  - apiVersion: v1
    kind: "DeploymentConfig"
    metadata:
      name: "${MEMCACHED_SERVICE_NAME}"
      annotations:
        description: "Defines how to deploy memcached"
    spec:
      strategy:
        type: "Recreate"
      triggers:
        -
          type: "ImageChange"
          imageChangeParams:
            automatic: true
            containerNames:
              - "memcached"
            from:
              kind: "ImageStreamTag"
              name: "miq-memcached:${MEMCACHED_IMG_TAG}"
        -
          type: "ConfigChange"
      replicas: 1
      selector:
        name: "${MEMCACHED_SERVICE_NAME}"
      template:
        metadata:
          name: "${MEMCACHED_SERVICE_NAME}"
          labels:
            name: "${MEMCACHED_SERVICE_NAME}"
        spec:
          volumes: []
          containers:
            -
              name: "memcached"
              image: "${MEMCACHED_IMG_NAME}:${MEMCACHED_IMG_TAG}"
              ports:
                -
                  containerPort: 11211
              readinessProbe:
                timeoutSeconds: 1
                initialDelaySeconds: 5
                tcpSocket:
                  port: 11211
              livenessProbe:
                timeoutSeconds: 1
                initialDelaySeconds: 30
                tcpSocket:
                  port: 11211
              volumeMounts: []
              env:
                -
                  name: "MEMCACHED_MAX_MEMORY"
                  value: "${MEMCACHED_MAX_MEMORY}"
                -
                  name: "MEMCACHED_MAX_CONNECTIONS"
                  value: "${MEMCACHED_MAX_CONNECTIONS}"
                -
                  name: "MEMCACHED_SLAB_PAGE_SIZE"
                  value: "${MEMCACHED_SLAB_PAGE_SIZE}"
              resources:
                requests:
                  memory: "${MEMCACHED_MEM_REQ}"
                  cpu: "${MEMCACHED_CPU_REQ}"
                limits:
                  memory: "${MEMCACHED_MEM_LIMIT}"
  - apiVersion: v1
    kind: "Service"
    metadata:
      name: "${DATABASE_SERVICE_NAME}"
      annotations:
        description: "Exposes the database server"
    spec:
      ports:
        -
          name: "postgresql"
          port: 5432
          targetPort: 5432
      selector:
        name: "${DATABASE_SERVICE_NAME}"
  - apiVersion: v1
    kind: "DeploymentConfig"
    metadata:
      name: "${DATABASE_SERVICE_NAME}"
      annotations:
        description: "Defines how to deploy the database"
    spec:
      strategy:
        type: "Recreate"
      triggers:
        -
          type: "ImageChange"
          imageChangeParams:
            automatic: true
            containerNames:
              - "postgresql"
            from:
              kind: "ImageStreamTag"
              name: "miq-postgresql:${POSTGRESQL_IMG_TAG}"
        -
          type: "ConfigChange"
      replicas: 1
      selector:
        name: "${DATABASE_SERVICE_NAME}"
      template:
        metadata:
          name: "${DATABASE_SERVICE_NAME}"
          labels:
            name: "${DATABASE_SERVICE_NAME}"
        spec:
          volumes:
            -
              name: "miq-pgdb-volume"
              persistentVolumeClaim:
                claimName: "${NAME}-${DATABASE_SERVICE_NAME}"
          containers:
            -
              name: "postgresql"
              image: "${POSTGRESQL_IMG_NAME}:${POSTGRESQL_IMG_TAG}"
              ports:
                -
                  containerPort: 5432
              readinessProbe:
                timeoutSeconds: 1
                initialDelaySeconds: 15
                exec:
                  command:
                    - "/bin/sh"
                    - "-i"
                    - "-c"
                    - "psql -h 127.0.0.1 -U ${POSTGRESQL_USER} -q -d ${POSTGRESQL_DATABASE} -c 'SELECT 1'"
              livenessProbe:
                timeoutSeconds: 1
                initialDelaySeconds: 60
                tcpSocket:
                  port: 5432
              volumeMounts:
                -
                  name: "miq-pgdb-volume"
                  mountPath: "/var/lib/pgsql/data"
              env:
                -
                  name: "POSTGRESQL_USER"
                  value: "${DATABASE_USER}"
                -
                  name: "POSTGRESQL_PASSWORD"
                  valueFrom:
                    secretKeyRef:
                      name: "${NAME}-secrets"
                      key: "pg-password"
                -
                  name: "POSTGRESQL_DATABASE"
                  value: "${DATABASE_NAME}"
                -
                  name: "POSTGRESQL_MAX_CONNECTIONS"
                  value: "${POSTGRESQL_MAX_CONNECTIONS}"
                -
                  name: "POSTGRESQL_SHARED_BUFFERS"
                  value: "${POSTGRESQL_SHARED_BUFFERS}"
              resources:
                requests:
                  memory: "${POSTGRESQL_MEM_REQ}"
                  cpu: "${POSTGRESQL_CPU_REQ}"
                limits:
                  memory: "${POSTGRESQL_MEM_LIMIT}"

  parameters:
    -
      name: "NAME"
      displayName: Name
      required: true
      description: "The name assigned to all of the frontend objects defined in this template."
      value: manageiq
    -
      name: "DATABASE_SERVICE_NAME"
      displayName: "PostgreSQL Service Name"
      required: true
      description: "The name of the OpenShift Service exposed for the PostgreSQL container."
      value: "postgresql"
    -
      name: "DATABASE_USER"
      displayName: "PostgreSQL User"
      required: true
      description: "PostgreSQL user that will access the database."
      value: "root"
    -
      name: "DATABASE_PASSWORD"
      displayName: "PostgreSQL Password"
      required: true
      description: "Password for the PostgreSQL user."
      from: "[a-zA-Z0-9]{8}"
      generate: expression
    -
      name: "DATABASE_NAME"
      required: true
      displayName: "PostgreSQL Database Name"
      description: "Name of the PostgreSQL database accessed."
      value: "vmdb_production"
    -
      name: "DATABASE_REGION"
      required: true
      displayName: "Application Database Region"
      description: "Database region that will be used for application."
      value: "0"
    -
      name: "MEMCACHED_SERVICE_NAME"
      required: true
      displayName: "Memcached Service Name"
      description: "The name of the OpenShift Service exposed for the Memcached container."
      value: "memcached"
    -
      name: "MEMCACHED_MAX_MEMORY"
      displayName: "Memcached Max Memory"
      description: "Memcached maximum memory for memcached object storage in MB."
      value: "64"
    -
      name: "MEMCACHED_MAX_CONNECTIONS"
      displayName: "Memcached Max Connections"
      description: "Memcached maximum number of connections allowed."
      value: "1024"
    -
      name: "MEMCACHED_SLAB_PAGE_SIZE"
      displayName: "Memcached Slab Page Size"
      description: "Memcached size of each slab page."
      value: "1m"
    -
      name: "POSTGRESQL_MAX_CONNECTIONS"
      displayName: "PostgreSQL Max Connections"
      description: "PostgreSQL maximum number of database connections allowed."
      value: "100"
    -
      name: "POSTGRESQL_SHARED_BUFFERS"
      displayName: "PostgreSQL Shared Buffer Amount"
      description: "Amount of memory dedicated for PostgreSQL shared memory buffers."
      value: "256MB"
    -
      name: "APPLICATION_CPU_REQ"
      displayName: "Application Min CPU Requested"
      required: true
      description: "Minimum amount of CPU time the Application container will need (expressed in millicores)."
      value: "1000m"
    -
      name: "POSTGRESQL_CPU_REQ"
      displayName: "PostgreSQL Min CPU Requested"
      required: true
      description: "Minimum amount of CPU time the PostgreSQL container will need (expressed in millicores)."
      value: "500m"
    -
      name: "MEMCACHED_CPU_REQ"
      displayName: "Memcached Min CPU Requested"
      required: true
      description: "Minimum amount of CPU time the Memcached container will need (expressed in millicores)."
      value: "200m"
    -
      name: "APPLICATION_MEM_REQ"
      displayName: "Application Min RAM Requested"
      required: true
      description: "Minimum amount of memory the Application container will need."
      value: "6144Mi"
    -
      name: "POSTGRESQL_MEM_REQ"
      displayName: "PostgreSQL Min RAM Requested"
      required: true
      description: "Minimum amount of memory the PostgreSQL container will need."
      value: "1024Mi"
    -
      name: "MEMCACHED_MEM_REQ"
      displayName: "Memcached Min RAM Requested"
      required: true
      description: "Minimum amount of memory the Memcached container will need."
      value: "64Mi"
    -
      name: "APPLICATION_MEM_LIMIT"
      displayName: "Application Max RAM Limit"
      required: true
      description: "Maximum amount of memory the Application container can consume."
      value: "16384Mi"
    -
      name: "POSTGRESQL_MEM_LIMIT"
      displayName: "PostgreSQL Max RAM Limit"
      required: true
      description: "Maximum amount of memory the PostgreSQL container can consume."
      value: "8192Mi"
    -
      name: "MEMCACHED_MEM_LIMIT"
      displayName: "Memcached Max RAM Limit"
      required: true
      description: "Maximum amount of memory the Memcached container can consume."
      value: "256Mi"
    -
      name: "POSTGRESQL_IMG_NAME"
      displayName: "PostgreSQL Image Name"
      description: "This is the PostgreSQL image name requested to deploy."
      value: "docker.io/manageiq/manageiq-pods"
    -
      name: "POSTGRESQL_IMG_TAG"
      displayName: "PostgreSQL Image Tag"
      description: "This is the PostgreSQL image tag/version requested to deploy."
      value: "postgresql-latest-fine"
    -
      name: "MEMCACHED_IMG_NAME"
      displayName: "Memcached Image Name"
      description: "This is the Memcached image name requested to deploy."
      value: "docker.io/manageiq/manageiq-pods"
    -
      name: "MEMCACHED_IMG_TAG"
      displayName: "Memcached Image Tag"
      description: "This is the Memcached image tag/version requested to deploy."
      value: "memcached-latest-fine"
    -
      name: "APPLICATION_IMG_NAME"
      displayName: "Application Image Name"
      description: "This is the Application image name requested to deploy."
      value: "docker.io/manageiq/manageiq-pods"
    -
      name: "APPLICATION_IMG_TAG"
      displayName: "Application Image Tag"
      description: "This is the Application image tag/version requested to deploy."
      value: "app-latest-fine"
    -
      name: "APPLICATION_DOMAIN"
      displayName: "Application Hostname"
      description: "The exposed hostname that will route to the application service, if left blank a value will be defaulted."
      value: ""
    -
      name: "APPLICATION_REPLICA_COUNT"
      displayName: "Application Replica Count"
      description: "This is the number of Application replicas requested to deploy."
      value: "1"
    -
      name: "APPLICATION_INIT_DELAY"
      displayName: "Application Init Delay"
      required: true
      description: "Delay in seconds before we attempt to initialize the application."
      value: "15"
    -
      name: "APPLICATION_VOLUME_CAPACITY"
      displayName: "Application Volume Capacity"
      required: true
      description: "Volume space available for application data."
      value: "5Gi"
    -
      name: "APPLICATION_REGION_VOLUME_CAPACITY"
      displayName: "Application Region Volume Capacity"
      required: true
      description: "Volume space available for region application data."
      value: "5Gi"
    -
      name: "DATABASE_VOLUME_CAPACITY"
      displayName: "Database Volume Capacity"
      required: true
      description: "Volume space available for database."
      value: "15Gi"