miq-template.yaml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566
  1. ---
  2. path: /tmp/miq-template-out
  3. data:
  4. apiVersion: v1
  5. kind: Template
  6. labels:
  7. template: manageiq
  8. metadata:
  9. name: manageiq
  10. annotations:
  11. description: "ManageIQ appliance with persistent storage"
  12. tags: "instant-app,manageiq,miq"
  13. iconClass: "icon-rails"
  14. objects:
  15. - apiVersion: v1
  16. kind: Secret
  17. metadata:
  18. name: "${NAME}-secrets"
  19. stringData:
  20. pg-password: "${DATABASE_PASSWORD}"
  21. - apiVersion: v1
  22. kind: Service
  23. metadata:
  24. annotations:
  25. description: "Exposes and load balances ManageIQ pods"
  26. service.alpha.openshift.io/dependencies: '[{"name":"${DATABASE_SERVICE_NAME}","namespace":"","kind":"Service"},{"name":"${MEMCACHED_SERVICE_NAME}","namespace":"","kind":"Service"}]'
  27. name: ${NAME}
  28. spec:
  29. clusterIP: None
  30. ports:
  31. - name: http
  32. port: 80
  33. protocol: TCP
  34. targetPort: 80
  35. - name: https
  36. port: 443
  37. protocol: TCP
  38. targetPort: 443
  39. selector:
  40. name: ${NAME}
  41. - apiVersion: v1
  42. kind: Route
  43. metadata:
  44. name: ${NAME}
  45. spec:
  46. host: ${APPLICATION_DOMAIN}
  47. port:
  48. targetPort: https
  49. tls:
  50. termination: passthrough
  51. to:
  52. kind: Service
  53. name: ${NAME}
  54. - apiVersion: v1
  55. kind: ImageStream
  56. metadata:
  57. name: miq-app
  58. annotations:
  59. description: "Keeps track of the ManageIQ image changes"
  60. spec:
  61. dockerImageRepository: "${APPLICATION_IMG_NAME}"
  62. - apiVersion: v1
  63. kind: ImageStream
  64. metadata:
  65. name: miq-postgresql
  66. annotations:
  67. description: "Keeps track of the PostgreSQL image changes"
  68. spec:
  69. dockerImageRepository: "${POSTGRESQL_IMG_NAME}"
  70. - apiVersion: v1
  71. kind: ImageStream
  72. metadata:
  73. name: miq-memcached
  74. annotations:
  75. description: "Keeps track of the Memcached image changes"
  76. spec:
  77. dockerImageRepository: "${MEMCACHED_IMG_NAME}"
  78. - apiVersion: v1
  79. kind: PersistentVolumeClaim
  80. metadata:
  81. name: "${NAME}-${DATABASE_SERVICE_NAME}"
  82. spec:
  83. accessModes:
  84. - ReadWriteOnce
  85. resources:
  86. requests:
  87. storage: ${DATABASE_VOLUME_CAPACITY}
  88. - apiVersion: v1
  89. kind: PersistentVolumeClaim
  90. metadata:
  91. name: "${NAME}-region"
  92. spec:
  93. accessModes:
  94. - ReadWriteOnce
  95. resources:
  96. requests:
  97. storage: ${APPLICATION_REGION_VOLUME_CAPACITY}
  98. - apiVersion: apps/v1beta1
  99. kind: "StatefulSet"
  100. metadata:
  101. name: ${NAME}
  102. annotations:
  103. description: "Defines how to deploy the ManageIQ appliance"
  104. spec:
  105. serviceName: "${NAME}"
  106. replicas: "${APPLICATION_REPLICA_COUNT}"
  107. template:
  108. metadata:
  109. labels:
  110. name: ${NAME}
  111. name: ${NAME}
  112. spec:
  113. containers:
  114. - name: manageiq
  115. image: "${APPLICATION_IMG_NAME}:${APPLICATION_IMG_TAG}"
  116. livenessProbe:
  117. tcpSocket:
  118. port: 443
  119. initialDelaySeconds: 480
  120. timeoutSeconds: 3
  121. readinessProbe:
  122. httpGet:
  123. path: /
  124. port: 443
  125. scheme: HTTPS
  126. initialDelaySeconds: 200
  127. timeoutSeconds: 3
  128. ports:
  129. - containerPort: 80
  130. protocol: TCP
  131. - containerPort: 443
  132. protocol: TCP
  133. securityContext:
  134. privileged: true
  135. volumeMounts:
  136. -
  137. name: "${NAME}-server"
  138. mountPath: "/persistent"
  139. -
  140. name: "${NAME}-region"
  141. mountPath: "/persistent-region"
  142. env:
  143. -
  144. name: "APPLICATION_INIT_DELAY"
  145. value: "${APPLICATION_INIT_DELAY}"
  146. -
  147. name: "DATABASE_SERVICE_NAME"
  148. value: "${DATABASE_SERVICE_NAME}"
  149. -
  150. name: "DATABASE_REGION"
  151. value: "${DATABASE_REGION}"
  152. -
  153. name: "MEMCACHED_SERVICE_NAME"
  154. value: "${MEMCACHED_SERVICE_NAME}"
  155. -
  156. name: "POSTGRESQL_USER"
  157. value: "${DATABASE_USER}"
  158. -
  159. name: "POSTGRESQL_PASSWORD"
  160. valueFrom:
  161. secretKeyRef:
  162. name: "${NAME}-secrets"
  163. key: "pg-password"
  164. -
  165. name: "POSTGRESQL_DATABASE"
  166. value: "${DATABASE_NAME}"
  167. -
  168. name: "POSTGRESQL_MAX_CONNECTIONS"
  169. value: "${POSTGRESQL_MAX_CONNECTIONS}"
  170. -
  171. name: "POSTGRESQL_SHARED_BUFFERS"
  172. value: "${POSTGRESQL_SHARED_BUFFERS}"
  173. resources:
  174. requests:
  175. memory: "${APPLICATION_MEM_REQ}"
  176. cpu: "${APPLICATION_CPU_REQ}"
  177. limits:
  178. memory: "${APPLICATION_MEM_LIMIT}"
  179. lifecycle:
  180. preStop:
  181. exec:
  182. command:
  183. - /opt/manageiq/container-scripts/sync-pv-data
  184. volumes:
  185. -
  186. name: "${NAME}-region"
  187. persistentVolumeClaim:
  188. claimName: ${NAME}-region
  189. volumeClaimTemplates:
  190. - metadata:
  191. name: "${NAME}-server"
  192. annotations:
  193. # Uncomment this if using dynamic volume provisioning.
  194. # https://docs.openshift.org/latest/install_config/persistent_storage/dynamically_provisioning_pvs.html
  195. # volume.alpha.kubernetes.io/storage-class: anything
  196. spec:
  197. accessModes: [ ReadWriteOnce ]
  198. resources:
  199. requests:
  200. storage: "${APPLICATION_VOLUME_CAPACITY}"
  201. - apiVersion: v1
  202. kind: "Service"
  203. metadata:
  204. name: "${MEMCACHED_SERVICE_NAME}"
  205. annotations:
  206. description: "Exposes the memcached server"
  207. spec:
  208. ports:
  209. -
  210. name: "memcached"
  211. port: 11211
  212. targetPort: 11211
  213. selector:
  214. name: "${MEMCACHED_SERVICE_NAME}"
  215. - apiVersion: v1
  216. kind: "DeploymentConfig"
  217. metadata:
  218. name: "${MEMCACHED_SERVICE_NAME}"
  219. annotations:
  220. description: "Defines how to deploy memcached"
  221. spec:
  222. strategy:
  223. type: "Recreate"
  224. triggers:
  225. -
  226. type: "ImageChange"
  227. imageChangeParams:
  228. automatic: true
  229. containerNames:
  230. - "memcached"
  231. from:
  232. kind: "ImageStreamTag"
  233. name: "miq-memcached:${MEMCACHED_IMG_TAG}"
  234. -
  235. type: "ConfigChange"
  236. replicas: 1
  237. selector:
  238. name: "${MEMCACHED_SERVICE_NAME}"
  239. template:
  240. metadata:
  241. name: "${MEMCACHED_SERVICE_NAME}"
  242. labels:
  243. name: "${MEMCACHED_SERVICE_NAME}"
  244. spec:
  245. volumes: []
  246. containers:
  247. -
  248. name: "memcached"
  249. image: "${MEMCACHED_IMG_NAME}:${MEMCACHED_IMG_TAG}"
  250. ports:
  251. -
  252. containerPort: 11211
  253. readinessProbe:
  254. timeoutSeconds: 1
  255. initialDelaySeconds: 5
  256. tcpSocket:
  257. port: 11211
  258. livenessProbe:
  259. timeoutSeconds: 1
  260. initialDelaySeconds: 30
  261. tcpSocket:
  262. port: 11211
  263. volumeMounts: []
  264. env:
  265. -
  266. name: "MEMCACHED_MAX_MEMORY"
  267. value: "${MEMCACHED_MAX_MEMORY}"
  268. -
  269. name: "MEMCACHED_MAX_CONNECTIONS"
  270. value: "${MEMCACHED_MAX_CONNECTIONS}"
  271. -
  272. name: "MEMCACHED_SLAB_PAGE_SIZE"
  273. value: "${MEMCACHED_SLAB_PAGE_SIZE}"
  274. resources:
  275. requests:
  276. memory: "${MEMCACHED_MEM_REQ}"
  277. cpu: "${MEMCACHED_CPU_REQ}"
  278. limits:
  279. memory: "${MEMCACHED_MEM_LIMIT}"
  280. - apiVersion: v1
  281. kind: "Service"
  282. metadata:
  283. name: "${DATABASE_SERVICE_NAME}"
  284. annotations:
  285. description: "Exposes the database server"
  286. spec:
  287. ports:
  288. -
  289. name: "postgresql"
  290. port: 5432
  291. targetPort: 5432
  292. selector:
  293. name: "${DATABASE_SERVICE_NAME}"
  294. - apiVersion: v1
  295. kind: "DeploymentConfig"
  296. metadata:
  297. name: "${DATABASE_SERVICE_NAME}"
  298. annotations:
  299. description: "Defines how to deploy the database"
  300. spec:
  301. strategy:
  302. type: "Recreate"
  303. triggers:
  304. -
  305. type: "ImageChange"
  306. imageChangeParams:
  307. automatic: true
  308. containerNames:
  309. - "postgresql"
  310. from:
  311. kind: "ImageStreamTag"
  312. name: "miq-postgresql:${POSTGRESQL_IMG_TAG}"
  313. -
  314. type: "ConfigChange"
  315. replicas: 1
  316. selector:
  317. name: "${DATABASE_SERVICE_NAME}"
  318. template:
  319. metadata:
  320. name: "${DATABASE_SERVICE_NAME}"
  321. labels:
  322. name: "${DATABASE_SERVICE_NAME}"
  323. spec:
  324. volumes:
  325. -
  326. name: "miq-pgdb-volume"
  327. persistentVolumeClaim:
  328. claimName: "${NAME}-${DATABASE_SERVICE_NAME}"
  329. containers:
  330. -
  331. name: "postgresql"
  332. image: "${POSTGRESQL_IMG_NAME}:${POSTGRESQL_IMG_TAG}"
  333. ports:
  334. -
  335. containerPort: 5432
  336. readinessProbe:
  337. timeoutSeconds: 1
  338. initialDelaySeconds: 15
  339. exec:
  340. command:
  341. - "/bin/sh"
  342. - "-i"
  343. - "-c"
  344. - "psql -h 127.0.0.1 -U ${POSTGRESQL_USER} -q -d ${POSTGRESQL_DATABASE} -c 'SELECT 1'"
  345. livenessProbe:
  346. timeoutSeconds: 1
  347. initialDelaySeconds: 60
  348. tcpSocket:
  349. port: 5432
  350. volumeMounts:
  351. -
  352. name: "miq-pgdb-volume"
  353. mountPath: "/var/lib/pgsql/data"
  354. env:
  355. -
  356. name: "POSTGRESQL_USER"
  357. value: "${DATABASE_USER}"
  358. -
  359. name: "POSTGRESQL_PASSWORD"
  360. valueFrom:
  361. secretKeyRef:
  362. name: "${NAME}-secrets"
  363. key: "pg-password"
  364. -
  365. name: "POSTGRESQL_DATABASE"
  366. value: "${DATABASE_NAME}"
  367. -
  368. name: "POSTGRESQL_MAX_CONNECTIONS"
  369. value: "${POSTGRESQL_MAX_CONNECTIONS}"
  370. -
  371. name: "POSTGRESQL_SHARED_BUFFERS"
  372. value: "${POSTGRESQL_SHARED_BUFFERS}"
  373. resources:
  374. requests:
  375. memory: "${POSTGRESQL_MEM_REQ}"
  376. cpu: "${POSTGRESQL_CPU_REQ}"
  377. limits:
  378. memory: "${POSTGRESQL_MEM_LIMIT}"
  379. parameters:
  380. -
  381. name: "NAME"
  382. displayName: Name
  383. required: true
  384. description: "The name assigned to all of the frontend objects defined in this template."
  385. value: manageiq
  386. -
  387. name: "DATABASE_SERVICE_NAME"
  388. displayName: "PostgreSQL Service Name"
  389. required: true
  390. description: "The name of the OpenShift Service exposed for the PostgreSQL container."
  391. value: "postgresql"
  392. -
  393. name: "DATABASE_USER"
  394. displayName: "PostgreSQL User"
  395. required: true
  396. description: "PostgreSQL user that will access the database."
  397. value: "root"
  398. -
  399. name: "DATABASE_PASSWORD"
  400. displayName: "PostgreSQL Password"
  401. required: true
  402. description: "Password for the PostgreSQL user."
  403. from: "[a-zA-Z0-9]{8}"
  404. generate: expression
  405. -
  406. name: "DATABASE_NAME"
  407. required: true
  408. displayName: "PostgreSQL Database Name"
  409. description: "Name of the PostgreSQL database accessed."
  410. value: "vmdb_production"
  411. -
  412. name: "DATABASE_REGION"
  413. required: true
  414. displayName: "Application Database Region"
  415. description: "Database region that will be used for application."
  416. value: "0"
  417. -
  418. name: "MEMCACHED_SERVICE_NAME"
  419. required: true
  420. displayName: "Memcached Service Name"
  421. description: "The name of the OpenShift Service exposed for the Memcached container."
  422. value: "memcached"
  423. -
  424. name: "MEMCACHED_MAX_MEMORY"
  425. displayName: "Memcached Max Memory"
  426. description: "Memcached maximum memory for memcached object storage in MB."
  427. value: "64"
  428. -
  429. name: "MEMCACHED_MAX_CONNECTIONS"
  430. displayName: "Memcached Max Connections"
  431. description: "Memcached maximum number of connections allowed."
  432. value: "1024"
  433. -
  434. name: "MEMCACHED_SLAB_PAGE_SIZE"
  435. displayName: "Memcached Slab Page Size"
  436. description: "Memcached size of each slab page."
  437. value: "1m"
  438. -
  439. name: "POSTGRESQL_MAX_CONNECTIONS"
  440. displayName: "PostgreSQL Max Connections"
  441. description: "PostgreSQL maximum number of database connections allowed."
  442. value: "100"
  443. -
  444. name: "POSTGRESQL_SHARED_BUFFERS"
  445. displayName: "PostgreSQL Shared Buffer Amount"
  446. description: "Amount of memory dedicated for PostgreSQL shared memory buffers."
  447. value: "256MB"
  448. -
  449. name: "APPLICATION_CPU_REQ"
  450. displayName: "Application Min CPU Requested"
  451. required: true
  452. description: "Minimum amount of CPU time the Application container will need (expressed in millicores)."
  453. value: "1000m"
  454. -
  455. name: "POSTGRESQL_CPU_REQ"
  456. displayName: "PostgreSQL Min CPU Requested"
  457. required: true
  458. description: "Minimum amount of CPU time the PostgreSQL container will need (expressed in millicores)."
  459. value: "500m"
  460. -
  461. name: "MEMCACHED_CPU_REQ"
  462. displayName: "Memcached Min CPU Requested"
  463. required: true
  464. description: "Minimum amount of CPU time the Memcached container will need (expressed in millicores)."
  465. value: "200m"
  466. -
  467. name: "APPLICATION_MEM_REQ"
  468. displayName: "Application Min RAM Requested"
  469. required: true
  470. description: "Minimum amount of memory the Application container will need."
  471. value: "6144Mi"
  472. -
  473. name: "POSTGRESQL_MEM_REQ"
  474. displayName: "PostgreSQL Min RAM Requested"
  475. required: true
  476. description: "Minimum amount of memory the PostgreSQL container will need."
  477. value: "1024Mi"
  478. -
  479. name: "MEMCACHED_MEM_REQ"
  480. displayName: "Memcached Min RAM Requested"
  481. required: true
  482. description: "Minimum amount of memory the Memcached container will need."
  483. value: "64Mi"
  484. -
  485. name: "APPLICATION_MEM_LIMIT"
  486. displayName: "Application Max RAM Limit"
  487. required: true
  488. description: "Maximum amount of memory the Application container can consume."
  489. value: "16384Mi"
  490. -
  491. name: "POSTGRESQL_MEM_LIMIT"
  492. displayName: "PostgreSQL Max RAM Limit"
  493. required: true
  494. description: "Maximum amount of memory the PostgreSQL container can consume."
  495. value: "8192Mi"
  496. -
  497. name: "MEMCACHED_MEM_LIMIT"
  498. displayName: "Memcached Max RAM Limit"
  499. required: true
  500. description: "Maximum amount of memory the Memcached container can consume."
  501. value: "256Mi"
  502. -
  503. name: "POSTGRESQL_IMG_NAME"
  504. displayName: "PostgreSQL Image Name"
  505. description: "This is the PostgreSQL image name requested to deploy."
  506. value: "docker.io/manageiq/manageiq-pods"
  507. -
  508. name: "POSTGRESQL_IMG_TAG"
  509. displayName: "PostgreSQL Image Tag"
  510. description: "This is the PostgreSQL image tag/version requested to deploy."
  511. value: "postgresql-latest-fine"
  512. -
  513. name: "MEMCACHED_IMG_NAME"
  514. displayName: "Memcached Image Name"
  515. description: "This is the Memcached image name requested to deploy."
  516. value: "docker.io/manageiq/manageiq-pods"
  517. -
  518. name: "MEMCACHED_IMG_TAG"
  519. displayName: "Memcached Image Tag"
  520. description: "This is the Memcached image tag/version requested to deploy."
  521. value: "memcached-latest-fine"
  522. -
  523. name: "APPLICATION_IMG_NAME"
  524. displayName: "Application Image Name"
  525. description: "This is the Application image name requested to deploy."
  526. value: "docker.io/manageiq/manageiq-pods"
  527. -
  528. name: "APPLICATION_IMG_TAG"
  529. displayName: "Application Image Tag"
  530. description: "This is the Application image tag/version requested to deploy."
  531. value: "app-latest-fine"
  532. -
  533. name: "APPLICATION_DOMAIN"
  534. displayName: "Application Hostname"
  535. description: "The exposed hostname that will route to the application service, if left blank a value will be defaulted."
  536. value: ""
  537. -
  538. name: "APPLICATION_REPLICA_COUNT"
  539. displayName: "Application Replica Count"
  540. description: "This is the number of Application replicas requested to deploy."
  541. value: "1"
  542. -
  543. name: "APPLICATION_INIT_DELAY"
  544. displayName: "Application Init Delay"
  545. required: true
  546. description: "Delay in seconds before we attempt to initialize the application."
  547. value: "15"
  548. -
  549. name: "APPLICATION_VOLUME_CAPACITY"
  550. displayName: "Application Volume Capacity"
  551. required: true
  552. description: "Volume space available for application data."
  553. value: "5Gi"
  554. -
  555. name: "APPLICATION_REGION_VOLUME_CAPACITY"
  556. displayName: "Application Region Volume Capacity"
  557. required: true
  558. description: "Volume space available for region application data."
  559. value: "5Gi"
  560. -
  561. name: "DATABASE_VOLUME_CAPACITY"
  562. displayName: "Database Volume Capacity"
  563. required: true
  564. description: "Volume space available for database."
  565. value: "15Gi"