sso71-postgresql.json 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778
  1. {
  2. "kind": "Template",
  3. "apiVersion": "v1",
  4. "metadata": {
  5. "annotations": {
  6. "iconClass" : "icon-sso",
  7. "tags" : "sso,keycloak,jboss,hidden",
  8. "version": "1.4.8",
  9. "openshift.io/display-name": "Single Sign-On 7.1 + PostgreSQL (Ephemeral)",
  10. "openshift.io/provider-display-name": "Red Hat, Inc.",
  11. "description": "An example SSO 7 application with a PostgreSQL database. For more information about using this template, see https://github.com/jboss-openshift/application-templates.",
  12. "template.openshift.io/long-description": "This template defines resources needed to develop Red Hat Single Sign-On 7.1 server based deployment and deployment configuration for PostgreSQL using ephemeral (temporary) storage.",
  13. "template.openshift.io/documentation-url": "https://access.redhat.com/documentation/en/red-hat-single-sign-on/",
  14. "template.openshift.io/support-url": "https://access.redhat.com"
  15. },
  16. "name": "sso71-postgresql"
  17. },
  18. "labels": {
  19. "template": "sso71-postgresql",
  20. "xpaas": "1.4.8"
  21. },
  22. "message": "A new SSO service (using PostgreSQL) has been created in your project. The admin username/password for accessing the master realm via the SSO console is ${SSO_ADMIN_USERNAME}/${SSO_ADMIN_PASSWORD}. The username/password for accessing the PostgreSQL database \"${DB_DATABASE}\" is ${DB_USERNAME}/${DB_PASSWORD}. Please be sure to create the following secrets: \"${HTTPS_SECRET}\" containing the ${HTTPS_KEYSTORE} file used for serving secure content; \"${JGROUPS_ENCRYPT_SECRET}\" containing the ${JGROUPS_ENCRYPT_KEYSTORE} file used for securing JGroups communications; \"${SSO_TRUSTSTORE_SECRET}\" containing the ${SSO_TRUSTSTORE} file used for securing SSO requests.",
  23. "parameters": [
  24. {
  25. "displayName": "Application Name",
  26. "description": "The name for the application.",
  27. "name": "APPLICATION_NAME",
  28. "value": "sso",
  29. "required": true
  30. },
  31. {
  32. "displayName": "Custom http Route Hostname",
  33. "description": "Custom hostname for http service route. Leave blank for default hostname, e.g.: <application-name>.<project>.<default-domain-suffix>",
  34. "name": "HOSTNAME_HTTP",
  35. "value": "",
  36. "required": false
  37. },
  38. {
  39. "displayName": "Custom https Route Hostname",
  40. "description": "Custom hostname for https service route. Leave blank for default hostname, e.g.: <application-name>.<project>.<default-domain-suffix>",
  41. "name": "HOSTNAME_HTTPS",
  42. "value": "",
  43. "required": false
  44. },
  45. {
  46. "displayName": "Database JNDI Name",
  47. "description": "Database JNDI name used by application to resolve the datasource, e.g. java:/jboss/datasources/postgresql",
  48. "name": "DB_JNDI",
  49. "value": "java:jboss/datasources/KeycloakDS",
  50. "required": false
  51. },
  52. {
  53. "displayName": "Database Name",
  54. "description": "Database name",
  55. "name": "DB_DATABASE",
  56. "value": "root",
  57. "required": true
  58. },
  59. {
  60. "displayName": "Server Keystore Secret Name",
  61. "description": "The name of the secret containing the keystore file",
  62. "name": "HTTPS_SECRET",
  63. "value": "sso-app-secret",
  64. "required": false
  65. },
  66. {
  67. "displayName": "Server Keystore Filename",
  68. "description": "The name of the keystore file within the secret",
  69. "name": "HTTPS_KEYSTORE",
  70. "value": "keystore.jks",
  71. "required": false
  72. },
  73. {
  74. "displayName": "Server Keystore Type",
  75. "description": "The type of the keystore file (JKS or JCEKS)",
  76. "name": "HTTPS_KEYSTORE_TYPE",
  77. "value": "",
  78. "required": false
  79. },
  80. {
  81. "displayName": "Server Certificate Name",
  82. "description": "The name associated with the server certificate (e.g. jboss)",
  83. "name": "HTTPS_NAME",
  84. "value": "",
  85. "required": false
  86. },
  87. {
  88. "displayName": "Server Keystore Password",
  89. "description": "The password for the keystore and certificate (e.g. mykeystorepass)",
  90. "name": "HTTPS_PASSWORD",
  91. "value": "",
  92. "required": false
  93. },
  94. {
  95. "displayName": "Datasource Minimum Pool Size",
  96. "description": "Sets xa-pool/min-pool-size for the configured datasource.",
  97. "name": "DB_MIN_POOL_SIZE",
  98. "required": false
  99. },
  100. {
  101. "displayName": "Datasource Maximum Pool Size",
  102. "description": "Sets xa-pool/max-pool-size for the configured datasource.",
  103. "name": "DB_MAX_POOL_SIZE",
  104. "required": false
  105. },
  106. {
  107. "displayName": "Datasource Transaction Isolation",
  108. "description": "Sets transaction-isolation for the configured datasource.",
  109. "name": "DB_TX_ISOLATION",
  110. "required": false
  111. },
  112. {
  113. "displayName": "PostgreSQL Maximum number of connections",
  114. "description": "The maximum number of client connections allowed. This also sets the maximum number of prepared transactions.",
  115. "name": "POSTGRESQL_MAX_CONNECTIONS",
  116. "required": false
  117. },
  118. {
  119. "displayName": "PostgreSQL Shared Buffers",
  120. "description": "Configures how much memory is dedicated to PostgreSQL for caching data.",
  121. "name": "POSTGRESQL_SHARED_BUFFERS",
  122. "required": false
  123. },
  124. {
  125. "displayName": "Database Username",
  126. "description": "Database user name",
  127. "name": "DB_USERNAME",
  128. "from": "user[a-zA-Z0-9]{3}",
  129. "generate": "expression",
  130. "required": true
  131. },
  132. {
  133. "displayName": "Database Password",
  134. "description": "Database user password",
  135. "name": "DB_PASSWORD",
  136. "from": "[a-zA-Z0-9]{8}",
  137. "generate": "expression",
  138. "required": true
  139. },
  140. {
  141. "displayName": "JGroups Secret Name",
  142. "description": "The name of the secret containing the keystore file",
  143. "name": "JGROUPS_ENCRYPT_SECRET",
  144. "value": "sso-app-secret",
  145. "required": false
  146. },
  147. {
  148. "displayName": "JGroups Keystore Filename",
  149. "description": "The name of the keystore file within the secret",
  150. "name": "JGROUPS_ENCRYPT_KEYSTORE",
  151. "value": "jgroups.jceks",
  152. "required": false
  153. },
  154. {
  155. "displayName": "JGroups Certificate Name",
  156. "description": "The name associated with the server certificate (e.g. secret-key)",
  157. "name": "JGROUPS_ENCRYPT_NAME",
  158. "value": "",
  159. "required": false
  160. },
  161. {
  162. "displayName": "JGroups Keystore Password",
  163. "description": "The password for the keystore and certificate (e.g. password)",
  164. "name": "JGROUPS_ENCRYPT_PASSWORD",
  165. "value": "",
  166. "required": false
  167. },
  168. {
  169. "displayName": "JGroups Cluster Password",
  170. "description": "JGroups cluster password",
  171. "name": "JGROUPS_CLUSTER_PASSWORD",
  172. "from": "[a-zA-Z0-9]{8}",
  173. "generate": "expression",
  174. "required": true
  175. },
  176. {
  177. "displayName": "ImageStream Namespace",
  178. "description": "Namespace in which the ImageStreams for Red Hat Middleware images are installed. These ImageStreams are normally installed in the openshift namespace. You should only need to modify this if you've installed the ImageStreams in a different namespace/project.",
  179. "name": "IMAGE_STREAM_NAMESPACE",
  180. "value": "openshift",
  181. "required": true
  182. },
  183. {
  184. "displayName": "SSO Admin Username",
  185. "description": "SSO Server admin username",
  186. "name": "SSO_ADMIN_USERNAME",
  187. "from": "[a-zA-Z0-9]{8}",
  188. "generate": "expression",
  189. "required": true
  190. },
  191. {
  192. "displayName": "SSO Admin Password",
  193. "description": "SSO Server admin password",
  194. "name": "SSO_ADMIN_PASSWORD",
  195. "from": "[a-zA-Z0-9]{8}",
  196. "generate": "expression",
  197. "required": true
  198. },
  199. {
  200. "displayName": "SSO Realm",
  201. "description": "Realm to be created in the SSO server (e.g. demo).",
  202. "name": "SSO_REALM",
  203. "value": "",
  204. "required": false
  205. },
  206. {
  207. "displayName": "SSO Service Username",
  208. "description": "The username used to access the SSO service. This is used by clients to create the appliction client(s) within the specified SSO realm.",
  209. "name": "SSO_SERVICE_USERNAME",
  210. "value": "",
  211. "required": false
  212. },
  213. {
  214. "displayName": "SSO Service Password",
  215. "description": "The password for the SSO service user.",
  216. "name": "SSO_SERVICE_PASSWORD",
  217. "value": "",
  218. "required": false
  219. },
  220. {
  221. "displayName": "SSO Trust Store",
  222. "description": "The name of the truststore file within the secret (e.g. truststore.jks)",
  223. "name": "SSO_TRUSTSTORE",
  224. "value": "",
  225. "required": false
  226. },
  227. {
  228. "displayName": "SSO Trust Store Password",
  229. "description": "The password for the truststore and certificate (e.g. mykeystorepass)",
  230. "name": "SSO_TRUSTSTORE_PASSWORD",
  231. "value": "",
  232. "required": false
  233. },
  234. {
  235. "displayName": "SSO Trust Store Secret",
  236. "description": "The name of the secret containing the truststore file (e.g. truststore-secret). Used for volume secretName",
  237. "name": "SSO_TRUSTSTORE_SECRET",
  238. "value": "sso-app-secret",
  239. "required": false
  240. },
  241. {
  242. "displayName": "PostgreSQL Image Stream Tag",
  243. "description": "The tag to use for the \"postgresql\" image stream. Typically, this aligns with the major.minor version of PostgreSQL.",
  244. "name": "POSTGRESQL_IMAGE_STREAM_TAG",
  245. "value": "9.5",
  246. "required": true
  247. },
  248. {
  249. "description": "Container memory limit",
  250. "name": "MEMORY_LIMIT",
  251. "value": "1Gi",
  252. "required": false
  253. }
  254. ],
  255. "objects": [
  256. {
  257. "kind": "Service",
  258. "apiVersion": "v1",
  259. "spec": {
  260. "ports": [
  261. {
  262. "port": 8080,
  263. "targetPort": 8080
  264. }
  265. ],
  266. "selector": {
  267. "deploymentConfig": "${APPLICATION_NAME}"
  268. }
  269. },
  270. "metadata": {
  271. "name": "${APPLICATION_NAME}",
  272. "labels": {
  273. "application": "${APPLICATION_NAME}",
  274. "component": "server"
  275. },
  276. "annotations": {
  277. "description": "The web server's http port.",
  278. "service.alpha.openshift.io/dependencies": "[{\"name\": \"${APPLICATION_NAME}-postgresql\", \"kind\": \"Service\"}]"
  279. }
  280. }
  281. },
  282. {
  283. "kind": "Service",
  284. "apiVersion": "v1",
  285. "spec": {
  286. "ports": [
  287. {
  288. "port": 8443,
  289. "targetPort": 8443
  290. }
  291. ],
  292. "selector": {
  293. "deploymentConfig": "${APPLICATION_NAME}"
  294. }
  295. },
  296. "metadata": {
  297. "name": "secure-${APPLICATION_NAME}",
  298. "labels": {
  299. "application": "${APPLICATION_NAME}",
  300. "component": "server"
  301. },
  302. "annotations": {
  303. "description": "The web server's https port.",
  304. "service.alpha.openshift.io/dependencies": "[{\"name\": \"${APPLICATION_NAME}-postgresql\", \"kind\": \"Service\"}]"
  305. }
  306. }
  307. },
  308. {
  309. "kind": "Service",
  310. "apiVersion": "v1",
  311. "spec": {
  312. "ports": [
  313. {
  314. "port": 5432,
  315. "targetPort": 5432
  316. }
  317. ],
  318. "selector": {
  319. "deploymentConfig": "${APPLICATION_NAME}-postgresql"
  320. }
  321. },
  322. "metadata": {
  323. "name": "${APPLICATION_NAME}-postgresql",
  324. "labels": {
  325. "application": "${APPLICATION_NAME}",
  326. "component": "database"
  327. },
  328. "annotations": {
  329. "description": "The database server's port."
  330. }
  331. }
  332. },
  333. {
  334. "kind": "Service",
  335. "apiVersion": "v1",
  336. "spec": {
  337. "clusterIP": "None",
  338. "ports": [
  339. {
  340. "name": "ping",
  341. "port": 8888
  342. }
  343. ],
  344. "selector": {
  345. "deploymentConfig": "${APPLICATION_NAME}"
  346. }
  347. },
  348. "metadata": {
  349. "name": "${APPLICATION_NAME}-ping",
  350. "labels": {
  351. "application": "${APPLICATION_NAME}"
  352. },
  353. "annotations": {
  354. "service.alpha.kubernetes.io/tolerate-unready-endpoints": "true",
  355. "description": "The JGroups ping port for clustering."
  356. }
  357. }
  358. },
  359. {
  360. "kind": "Route",
  361. "apiVersion": "v1",
  362. "id": "${APPLICATION_NAME}-http",
  363. "metadata": {
  364. "name": "${APPLICATION_NAME}",
  365. "labels": {
  366. "application": "${APPLICATION_NAME}",
  367. "component": "server"
  368. },
  369. "annotations": {
  370. "description": "Route for application's http service."
  371. }
  372. },
  373. "spec": {
  374. "host": "${HOSTNAME_HTTP}",
  375. "to": {
  376. "name": "${APPLICATION_NAME}"
  377. }
  378. }
  379. },
  380. {
  381. "kind": "Route",
  382. "apiVersion": "v1",
  383. "id": "${APPLICATION_NAME}-https",
  384. "metadata": {
  385. "name": "secure-${APPLICATION_NAME}",
  386. "labels": {
  387. "application": "${APPLICATION_NAME}",
  388. "component": "server"
  389. },
  390. "annotations": {
  391. "description": "Route for application's https service."
  392. }
  393. },
  394. "spec": {
  395. "host": "${HOSTNAME_HTTPS}",
  396. "to": {
  397. "name": "secure-${APPLICATION_NAME}"
  398. },
  399. "tls": {
  400. "termination": "passthrough"
  401. }
  402. }
  403. },
  404. {
  405. "kind": "DeploymentConfig",
  406. "apiVersion": "v1",
  407. "metadata": {
  408. "name": "${APPLICATION_NAME}",
  409. "labels": {
  410. "application": "${APPLICATION_NAME}",
  411. "component": "server"
  412. }
  413. },
  414. "spec": {
  415. "strategy": {
  416. "type": "Recreate"
  417. },
  418. "triggers": [
  419. {
  420. "type": "ImageChange",
  421. "imageChangeParams": {
  422. "automatic": true,
  423. "containerNames": [
  424. "${APPLICATION_NAME}"
  425. ],
  426. "from": {
  427. "kind": "ImageStreamTag",
  428. "namespace": "${IMAGE_STREAM_NAMESPACE}",
  429. "name": "redhat-sso71-openshift:1.3"
  430. }
  431. }
  432. },
  433. {
  434. "type": "ConfigChange"
  435. }
  436. ],
  437. "replicas": 1,
  438. "selector": {
  439. "deploymentConfig": "${APPLICATION_NAME}"
  440. },
  441. "template": {
  442. "metadata": {
  443. "name": "${APPLICATION_NAME}",
  444. "labels": {
  445. "deploymentConfig": "${APPLICATION_NAME}",
  446. "application": "${APPLICATION_NAME}",
  447. "component": "server"
  448. }
  449. },
  450. "spec": {
  451. "terminationGracePeriodSeconds": 75,
  452. "containers": [
  453. {
  454. "name": "${APPLICATION_NAME}",
  455. "image": "${APPLICATION_NAME}",
  456. "imagePullPolicy": "Always",
  457. "resources": {
  458. "limits": {
  459. "memory": "${MEMORY_LIMIT}"
  460. }
  461. },
  462. "volumeMounts": [
  463. {
  464. "name": "eap-keystore-volume",
  465. "mountPath": "/etc/eap-secret-volume",
  466. "readOnly": true
  467. },
  468. {
  469. "name": "eap-jgroups-keystore-volume",
  470. "mountPath": "/etc/jgroups-encrypt-secret-volume",
  471. "readOnly": true
  472. },
  473. {
  474. "name": "sso-truststore-volume",
  475. "mountPath": "/etc/sso-secret-volume",
  476. "readOnly": true
  477. }
  478. ],
  479. "livenessProbe": {
  480. "exec": {
  481. "command": [
  482. "/bin/bash",
  483. "-c",
  484. "/opt/eap/bin/livenessProbe.sh"
  485. ]
  486. },
  487. "initialDelaySeconds": 60
  488. },
  489. "readinessProbe": {
  490. "exec": {
  491. "command": [
  492. "/bin/bash",
  493. "-c",
  494. "/opt/eap/bin/readinessProbe.sh"
  495. ]
  496. }
  497. },
  498. "ports": [
  499. {
  500. "name": "jolokia",
  501. "containerPort": 8778,
  502. "protocol": "TCP"
  503. },
  504. {
  505. "name": "http",
  506. "containerPort": 8080,
  507. "protocol": "TCP"
  508. },
  509. {
  510. "name": "https",
  511. "containerPort": 8443,
  512. "protocol": "TCP"
  513. },
  514. {
  515. "name": "ping",
  516. "containerPort": 8888,
  517. "protocol": "TCP"
  518. }
  519. ],
  520. "env": [
  521. {
  522. "name": "DB_SERVICE_PREFIX_MAPPING",
  523. "value": "${APPLICATION_NAME}-postgresql=DB"
  524. },
  525. {
  526. "name": "DB_JNDI",
  527. "value": "${DB_JNDI}"
  528. },
  529. {
  530. "name": "DB_USERNAME",
  531. "value": "${DB_USERNAME}"
  532. },
  533. {
  534. "name": "DB_PASSWORD",
  535. "value": "${DB_PASSWORD}"
  536. },
  537. {
  538. "name": "DB_DATABASE",
  539. "value": "${DB_DATABASE}"
  540. },
  541. {
  542. "name": "TX_DATABASE_PREFIX_MAPPING",
  543. "value": "${APPLICATION_NAME}-postgresql=DB"
  544. },
  545. {
  546. "name": "DB_MIN_POOL_SIZE",
  547. "value": "${DB_MIN_POOL_SIZE}"
  548. },
  549. {
  550. "name": "DB_MAX_POOL_SIZE",
  551. "value": "${DB_MAX_POOL_SIZE}"
  552. },
  553. {
  554. "name": "DB_TX_ISOLATION",
  555. "value": "${DB_TX_ISOLATION}"
  556. },
  557. {
  558. "name": "JGROUPS_PING_PROTOCOL",
  559. "value": "openshift.DNS_PING"
  560. },
  561. {
  562. "name": "OPENSHIFT_DNS_PING_SERVICE_NAME",
  563. "value": "${APPLICATION_NAME}-ping"
  564. },
  565. {
  566. "name": "OPENSHIFT_DNS_PING_SERVICE_PORT",
  567. "value": "8888"
  568. },
  569. {
  570. "name": "HTTPS_KEYSTORE_DIR",
  571. "value": "/etc/eap-secret-volume"
  572. },
  573. {
  574. "name": "HTTPS_KEYSTORE",
  575. "value": "${HTTPS_KEYSTORE}"
  576. },
  577. {
  578. "name": "HTTPS_KEYSTORE_TYPE",
  579. "value": "${HTTPS_KEYSTORE_TYPE}"
  580. },
  581. {
  582. "name": "HTTPS_NAME",
  583. "value": "${HTTPS_NAME}"
  584. },
  585. {
  586. "name": "HTTPS_PASSWORD",
  587. "value": "${HTTPS_PASSWORD}"
  588. },
  589. {
  590. "name": "JGROUPS_ENCRYPT_SECRET",
  591. "value": "${JGROUPS_ENCRYPT_SECRET}"
  592. },
  593. {
  594. "name": "JGROUPS_ENCRYPT_KEYSTORE_DIR",
  595. "value": "/etc/jgroups-encrypt-secret-volume"
  596. },
  597. {
  598. "name": "JGROUPS_ENCRYPT_KEYSTORE",
  599. "value": "${JGROUPS_ENCRYPT_KEYSTORE}"
  600. },
  601. {
  602. "name": "JGROUPS_ENCRYPT_NAME",
  603. "value": "${JGROUPS_ENCRYPT_NAME}"
  604. },
  605. {
  606. "name": "JGROUPS_ENCRYPT_PASSWORD",
  607. "value": "${JGROUPS_ENCRYPT_PASSWORD}"
  608. },
  609. {
  610. "name": "JGROUPS_CLUSTER_PASSWORD",
  611. "value": "${JGROUPS_CLUSTER_PASSWORD}"
  612. },
  613. {
  614. "name": "SSO_ADMIN_USERNAME",
  615. "value": "${SSO_ADMIN_USERNAME}"
  616. },
  617. {
  618. "name": "SSO_ADMIN_PASSWORD",
  619. "value": "${SSO_ADMIN_PASSWORD}"
  620. },
  621. {
  622. "name": "SSO_REALM",
  623. "value": "${SSO_REALM}"
  624. },
  625. {
  626. "name": "SSO_SERVICE_USERNAME",
  627. "value": "${SSO_SERVICE_USERNAME}"
  628. },
  629. {
  630. "name": "SSO_SERVICE_PASSWORD",
  631. "value": "${SSO_SERVICE_PASSWORD}"
  632. },
  633. {
  634. "name": "SSO_TRUSTSTORE",
  635. "value": "${SSO_TRUSTSTORE}"
  636. },
  637. {
  638. "name": "SSO_TRUSTSTORE_DIR",
  639. "value": "/etc/sso-secret-volume"
  640. },
  641. {
  642. "name": "SSO_TRUSTSTORE_PASSWORD",
  643. "value": "${SSO_TRUSTSTORE_PASSWORD}"
  644. }
  645. ]
  646. }
  647. ],
  648. "volumes": [
  649. {
  650. "name": "eap-keystore-volume",
  651. "secret": {
  652. "secretName": "${HTTPS_SECRET}"
  653. }
  654. },
  655. {
  656. "name": "eap-jgroups-keystore-volume",
  657. "secret": {
  658. "secretName": "${JGROUPS_ENCRYPT_SECRET}"
  659. }
  660. },
  661. {
  662. "name": "sso-truststore-volume",
  663. "secret": {
  664. "secretName": "${SSO_TRUSTSTORE_SECRET}"
  665. }
  666. }
  667. ]
  668. }
  669. }
  670. }
  671. },
  672. {
  673. "kind": "DeploymentConfig",
  674. "apiVersion": "v1",
  675. "metadata": {
  676. "name": "${APPLICATION_NAME}-postgresql",
  677. "labels": {
  678. "application": "${APPLICATION_NAME}",
  679. "component": "database"
  680. }
  681. },
  682. "spec": {
  683. "strategy": {
  684. "type": "Recreate"
  685. },
  686. "triggers": [
  687. {
  688. "type": "ImageChange",
  689. "imageChangeParams": {
  690. "automatic": true,
  691. "containerNames": [
  692. "${APPLICATION_NAME}-postgresql"
  693. ],
  694. "from": {
  695. "kind": "ImageStreamTag",
  696. "namespace": "${IMAGE_STREAM_NAMESPACE}",
  697. "name": "postgresql:${POSTGRESQL_IMAGE_STREAM_TAG}"
  698. }
  699. }
  700. },
  701. {
  702. "type": "ConfigChange"
  703. }
  704. ],
  705. "replicas": 1,
  706. "selector": {
  707. "deploymentConfig": "${APPLICATION_NAME}-postgresql"
  708. },
  709. "template": {
  710. "metadata": {
  711. "name": "${APPLICATION_NAME}-postgresql",
  712. "labels": {
  713. "deploymentConfig": "${APPLICATION_NAME}-postgresql",
  714. "application": "${APPLICATION_NAME}",
  715. "component": "database"
  716. }
  717. },
  718. "spec": {
  719. "terminationGracePeriodSeconds": 60,
  720. "containers": [
  721. {
  722. "name": "${APPLICATION_NAME}-postgresql",
  723. "image": "postgresql",
  724. "imagePullPolicy": "Always",
  725. "ports": [
  726. {
  727. "containerPort": 5432,
  728. "protocol": "TCP"
  729. }
  730. ],
  731. "env": [
  732. {
  733. "name": "POSTGRESQL_USER",
  734. "value": "${DB_USERNAME}"
  735. },
  736. {
  737. "name": "POSTGRESQL_PASSWORD",
  738. "value": "${DB_PASSWORD}"
  739. },
  740. {
  741. "name": "POSTGRESQL_DATABASE",
  742. "value": "${DB_DATABASE}"
  743. },
  744. {
  745. "name": "POSTGRESQL_MAX_CONNECTIONS",
  746. "value": "${POSTGRESQL_MAX_CONNECTIONS}"
  747. },
  748. {
  749. "name": "POSTGRESQL_MAX_PREPARED_TRANSACTIONS",
  750. "value": "${POSTGRESQL_MAX_CONNECTIONS}"
  751. },
  752. {
  753. "name": "POSTGRESQL_SHARED_BUFFERS",
  754. "value": "${POSTGRESQL_SHARED_BUFFERS}"
  755. }
  756. ],
  757. "volumeMounts": [
  758. {
  759. "mountPath": "/var/lib/pgsql/data",
  760. "name": "${APPLICATION_NAME}-data"
  761. }
  762. ]
  763. }
  764. ],
  765. "volumes": [
  766. {
  767. "emptyDir": {
  768. "medium": ""
  769. },
  770. "name": "${APPLICATION_NAME}-data"
  771. }
  772. ]
  773. }
  774. }
  775. }
  776. }
  777. ]
  778. }