sso71-mysql-persistent.json 34 KB

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