cfme-template.yaml 16 KB

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