sso71-postgresql-persistent.json 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796
  1. {
  2. "kind": "Template",
  3. "apiVersion": "v1",
  4. "metadata": {
  5. "annotations": {
  6. "iconClass" : "icon-sso",
  7. "tags" : "sso,keycloak,jboss",
  8. "version": "1.4.8",
  9. "openshift.io/display-name": "Single Sign-On 7.1 + PostgreSQL",
  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 persistence.",
  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-persistent"
  17. },
  18. "labels": {
  19. "template": "sso71-postgresql-persistent",
  20. "xpaas": "1.4.8"
  21. },
  22. "message": "A new persistent 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": "Database Volume Capacity",
  142. "description": "Size of persistent storage for database volume.",
  143. "name": "VOLUME_CAPACITY",
  144. "value": "1Gi",
  145. "required": true
  146. },
  147. {
  148. "displayName": "JGroups Secret Name",
  149. "description": "The name of the secret containing the keystore file",
  150. "name": "JGROUPS_ENCRYPT_SECRET",
  151. "value": "sso-app-secret",
  152. "required": false
  153. },
  154. {
  155. "displayName": "JGroups Keystore Filename",
  156. "description": "The name of the keystore file within the secret",
  157. "name": "JGROUPS_ENCRYPT_KEYSTORE",
  158. "value": "jgroups.jceks",
  159. "required": false
  160. },
  161. {
  162. "displayName": "JGroups Certificate Name",
  163. "description": "The name associated with the server certificate (e.g. secret-key)",
  164. "name": "JGROUPS_ENCRYPT_NAME",
  165. "value": "",
  166. "required": false
  167. },
  168. {
  169. "displayName": "JGroups Keystore Password",
  170. "description": "The password for the keystore and certificate (e.g. password)",
  171. "name": "JGROUPS_ENCRYPT_PASSWORD",
  172. "value": "",
  173. "required": false
  174. },
  175. {
  176. "displayName": "JGroups Cluster Password",
  177. "description": "JGroups cluster password",
  178. "name": "JGROUPS_CLUSTER_PASSWORD",
  179. "from": "[a-zA-Z0-9]{8}",
  180. "generate": "expression",
  181. "required": true
  182. },
  183. {
  184. "displayName": "ImageStream Namespace",
  185. "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.",
  186. "name": "IMAGE_STREAM_NAMESPACE",
  187. "value": "openshift",
  188. "required": true
  189. },
  190. {
  191. "displayName": "SSO Admin Username",
  192. "description": "SSO Server admin username",
  193. "name": "SSO_ADMIN_USERNAME",
  194. "from": "[a-zA-Z0-9]{8}",
  195. "generate": "expression",
  196. "required": true
  197. },
  198. {
  199. "displayName": "SSO Admin Password",
  200. "description": "SSO Server admin password",
  201. "name": "SSO_ADMIN_PASSWORD",
  202. "from": "[a-zA-Z0-9]{8}",
  203. "generate": "expression",
  204. "required": true
  205. },
  206. {
  207. "displayName": "SSO Realm",
  208. "description": "Realm to be created in the SSO server (e.g. demo).",
  209. "name": "SSO_REALM",
  210. "value": "",
  211. "required": false
  212. },
  213. {
  214. "displayName": "SSO Service Username",
  215. "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.",
  216. "name": "SSO_SERVICE_USERNAME",
  217. "value": "",
  218. "required": false
  219. },
  220. {
  221. "displayName": "SSO Service Password",
  222. "description": "The password for the SSO service user.",
  223. "name": "SSO_SERVICE_PASSWORD",
  224. "value": "",
  225. "required": false
  226. },
  227. {
  228. "displayName": "SSO Trust Store",
  229. "description": "The name of the truststore file within the secret (e.g. truststore.jks)",
  230. "name": "SSO_TRUSTSTORE",
  231. "value": "",
  232. "required": false
  233. },
  234. {
  235. "displayName": "SSO Trust Store Password",
  236. "description": "The password for the truststore and certificate (e.g. mykeystorepass)",
  237. "name": "SSO_TRUSTSTORE_PASSWORD",
  238. "value": "",
  239. "required": false
  240. },
  241. {
  242. "displayName": "SSO Trust Store Secret",
  243. "description": "The name of the secret containing the truststore file (e.g. truststore-secret). Used for volume secretName",
  244. "name": "SSO_TRUSTSTORE_SECRET",
  245. "value": "sso-app-secret",
  246. "required": false
  247. },
  248. {
  249. "displayName": "PostgreSQL Image Stream Tag",
  250. "description": "The tag to use for the \"postgresql\" image stream. Typically, this aligns with the major.minor version of PostgreSQL.",
  251. "name": "POSTGRESQL_IMAGE_STREAM_TAG",
  252. "value": "9.5",
  253. "required": true
  254. },
  255. {
  256. "description": "Container memory limit",
  257. "name": "MEMORY_LIMIT",
  258. "value": "1Gi",
  259. "required": false
  260. }
  261. ],
  262. "objects": [
  263. {
  264. "kind": "Service",
  265. "apiVersion": "v1",
  266. "spec": {
  267. "ports": [
  268. {
  269. "port": 8080,
  270. "targetPort": 8080
  271. }
  272. ],
  273. "selector": {
  274. "deploymentConfig": "${APPLICATION_NAME}"
  275. }
  276. },
  277. "metadata": {
  278. "name": "${APPLICATION_NAME}",
  279. "labels": {
  280. "application": "${APPLICATION_NAME}"
  281. },
  282. "annotations": {
  283. "description": "The web server's http port.",
  284. "service.alpha.openshift.io/dependencies": "[{\"name\": \"${APPLICATION_NAME}-postgresql\", \"kind\": \"Service\"}]"
  285. }
  286. }
  287. },
  288. {
  289. "kind": "Service",
  290. "apiVersion": "v1",
  291. "spec": {
  292. "ports": [
  293. {
  294. "port": 8443,
  295. "targetPort": 8443
  296. }
  297. ],
  298. "selector": {
  299. "deploymentConfig": "${APPLICATION_NAME}"
  300. }
  301. },
  302. "metadata": {
  303. "name": "secure-${APPLICATION_NAME}",
  304. "labels": {
  305. "application": "${APPLICATION_NAME}"
  306. },
  307. "annotations": {
  308. "description": "The web server's https port.",
  309. "service.alpha.openshift.io/dependencies": "[{\"name\": \"${APPLICATION_NAME}-postgresql\", \"kind\": \"Service\"}]"
  310. }
  311. }
  312. },
  313. {
  314. "kind": "Service",
  315. "apiVersion": "v1",
  316. "spec": {
  317. "ports": [
  318. {
  319. "port": 5432,
  320. "targetPort": 5432
  321. }
  322. ],
  323. "selector": {
  324. "deploymentConfig": "${APPLICATION_NAME}-postgresql"
  325. }
  326. },
  327. "metadata": {
  328. "name": "${APPLICATION_NAME}-postgresql",
  329. "labels": {
  330. "application": "${APPLICATION_NAME}"
  331. },
  332. "annotations": {
  333. "description": "The database server's port."
  334. }
  335. }
  336. },
  337. {
  338. "kind": "Service",
  339. "apiVersion": "v1",
  340. "spec": {
  341. "clusterIP": "None",
  342. "ports": [
  343. {
  344. "name": "ping",
  345. "port": 8888
  346. }
  347. ],
  348. "selector": {
  349. "deploymentConfig": "${APPLICATION_NAME}"
  350. }
  351. },
  352. "metadata": {
  353. "name": "${APPLICATION_NAME}-ping",
  354. "labels": {
  355. "application": "${APPLICATION_NAME}"
  356. },
  357. "annotations": {
  358. "service.alpha.kubernetes.io/tolerate-unready-endpoints": "true",
  359. "description": "The JGroups ping port for clustering."
  360. }
  361. }
  362. },
  363. {
  364. "kind": "Route",
  365. "apiVersion": "v1",
  366. "id": "${APPLICATION_NAME}-http",
  367. "metadata": {
  368. "name": "${APPLICATION_NAME}",
  369. "labels": {
  370. "application": "${APPLICATION_NAME}"
  371. },
  372. "annotations": {
  373. "description": "Route for application's http service."
  374. }
  375. },
  376. "spec": {
  377. "host": "${HOSTNAME_HTTP}",
  378. "to": {
  379. "name": "${APPLICATION_NAME}"
  380. }
  381. }
  382. },
  383. {
  384. "kind": "Route",
  385. "apiVersion": "v1",
  386. "id": "${APPLICATION_NAME}-https",
  387. "metadata": {
  388. "name": "secure-${APPLICATION_NAME}",
  389. "labels": {
  390. "application": "${APPLICATION_NAME}"
  391. },
  392. "annotations": {
  393. "description": "Route for application's https service."
  394. }
  395. },
  396. "spec": {
  397. "host": "${HOSTNAME_HTTPS}",
  398. "to": {
  399. "name": "secure-${APPLICATION_NAME}"
  400. },
  401. "tls": {
  402. "termination": "passthrough"
  403. }
  404. }
  405. },
  406. {
  407. "kind": "DeploymentConfig",
  408. "apiVersion": "v1",
  409. "metadata": {
  410. "name": "${APPLICATION_NAME}",
  411. "labels": {
  412. "application": "${APPLICATION_NAME}"
  413. }
  414. },
  415. "spec": {
  416. "strategy": {
  417. "type": "Recreate"
  418. },
  419. "triggers": [
  420. {
  421. "type": "ImageChange",
  422. "imageChangeParams": {
  423. "automatic": true,
  424. "containerNames": [
  425. "${APPLICATION_NAME}"
  426. ],
  427. "from": {
  428. "kind": "ImageStreamTag",
  429. "namespace": "${IMAGE_STREAM_NAMESPACE}",
  430. "name": "redhat-sso71-openshift:1.3"
  431. }
  432. }
  433. },
  434. {
  435. "type": "ConfigChange"
  436. }
  437. ],
  438. "replicas": 1,
  439. "selector": {
  440. "deploymentConfig": "${APPLICATION_NAME}"
  441. },
  442. "template": {
  443. "metadata": {
  444. "name": "${APPLICATION_NAME}",
  445. "labels": {
  446. "deploymentConfig": "${APPLICATION_NAME}",
  447. "application": "${APPLICATION_NAME}"
  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. }
  680. },
  681. "spec": {
  682. "strategy": {
  683. "type": "Recreate"
  684. },
  685. "triggers": [
  686. {
  687. "type": "ImageChange",
  688. "imageChangeParams": {
  689. "automatic": true,
  690. "containerNames": [
  691. "${APPLICATION_NAME}-postgresql"
  692. ],
  693. "from": {
  694. "kind": "ImageStreamTag",
  695. "namespace": "${IMAGE_STREAM_NAMESPACE}",
  696. "name": "postgresql:${POSTGRESQL_IMAGE_STREAM_TAG}"
  697. }
  698. }
  699. },
  700. {
  701. "type": "ConfigChange"
  702. }
  703. ],
  704. "replicas": 1,
  705. "selector": {
  706. "deploymentConfig": "${APPLICATION_NAME}-postgresql"
  707. },
  708. "template": {
  709. "metadata": {
  710. "name": "${APPLICATION_NAME}-postgresql",
  711. "labels": {
  712. "deploymentConfig": "${APPLICATION_NAME}-postgresql",
  713. "application": "${APPLICATION_NAME}"
  714. }
  715. },
  716. "spec": {
  717. "terminationGracePeriodSeconds": 60,
  718. "containers": [
  719. {
  720. "name": "${APPLICATION_NAME}-postgresql",
  721. "image": "postgresql",
  722. "imagePullPolicy": "Always",
  723. "ports": [
  724. {
  725. "containerPort": 5432,
  726. "protocol": "TCP"
  727. }
  728. ],
  729. "volumeMounts": [
  730. {
  731. "mountPath": "/var/lib/pgsql/data",
  732. "name": "${APPLICATION_NAME}-postgresql-pvol"
  733. }
  734. ],
  735. "env": [
  736. {
  737. "name": "POSTGRESQL_USER",
  738. "value": "${DB_USERNAME}"
  739. },
  740. {
  741. "name": "POSTGRESQL_PASSWORD",
  742. "value": "${DB_PASSWORD}"
  743. },
  744. {
  745. "name": "POSTGRESQL_DATABASE",
  746. "value": "${DB_DATABASE}"
  747. },
  748. {
  749. "name": "POSTGRESQL_MAX_CONNECTIONS",
  750. "value": "${POSTGRESQL_MAX_CONNECTIONS}"
  751. },
  752. {
  753. "name": "POSTGRESQL_MAX_PREPARED_TRANSACTIONS",
  754. "value": "${POSTGRESQL_MAX_CONNECTIONS}"
  755. },
  756. {
  757. "name": "POSTGRESQL_SHARED_BUFFERS",
  758. "value": "${POSTGRESQL_SHARED_BUFFERS}"
  759. }
  760. ]
  761. }
  762. ],
  763. "volumes": [
  764. {
  765. "name": "${APPLICATION_NAME}-postgresql-pvol",
  766. "persistentVolumeClaim": {
  767. "claimName": "${APPLICATION_NAME}-postgresql-claim"
  768. }
  769. }
  770. ]
  771. }
  772. }
  773. }
  774. },
  775. {
  776. "apiVersion": "v1",
  777. "kind": "PersistentVolumeClaim",
  778. "metadata": {
  779. "name": "${APPLICATION_NAME}-postgresql-claim",
  780. "labels": {
  781. "application": "${APPLICATION_NAME}"
  782. }
  783. },
  784. "spec": {
  785. "accessModes": [
  786. "ReadWriteOnce"
  787. ],
  788. "resources": {
  789. "requests": {
  790. "storage": "${VOLUME_CAPACITY}"
  791. }
  792. }
  793. }
  794. }
  795. ]
  796. }