cfme-template.yaml 14 KB

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