mariadb-ephemeral-template.json 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. {
  2. "kind": "Template",
  3. "apiVersion": "v1",
  4. "metadata": {
  5. "name": "mariadb-ephemeral",
  6. "annotations": {
  7. "openshift.io/display-name": "MariaDB (Ephemeral)",
  8. "description": "MariaDB database service, without persistent storage. For more information about using this template, including OpenShift considerations, see https://github.com/sclorg/mariadb-container/blob/master/10.1/README.md.\n\nWARNING: Any data stored will be lost upon pod destruction. Only use this template for testing",
  9. "iconClass": "icon-mariadb",
  10. "tags": "database,mariadb"
  11. }
  12. },
  13. "message": "The following service(s) have been created in your project: ${DATABASE_SERVICE_NAME}.\n\n Username: ${MYSQL_USER}\n Password: ${MYSQL_PASSWORD}\n Database Name: ${MYSQL_DATABASE}\n Connection URL: mysql://${DATABASE_SERVICE_NAME}:3306/\n\nFor more information about using this template, including OpenShift considerations, see https://github.com/sclorg/mariadb-container/blob/master/10.1/README.md.",
  14. "labels": {
  15. "template": "mariadb-persistent-template"
  16. },
  17. "objects": [
  18. {
  19. "kind": "Service",
  20. "apiVersion": "v1",
  21. "metadata": {
  22. "name": "${DATABASE_SERVICE_NAME}"
  23. },
  24. "spec": {
  25. "ports": [
  26. {
  27. "name": "mariadb",
  28. "port": 3306
  29. }
  30. ],
  31. "selector": {
  32. "name": "${DATABASE_SERVICE_NAME}"
  33. }
  34. }
  35. },
  36. {
  37. "kind": "DeploymentConfig",
  38. "apiVersion": "v1",
  39. "metadata": {
  40. "name": "${DATABASE_SERVICE_NAME}"
  41. },
  42. "spec": {
  43. "strategy": {
  44. "type": "Recreate"
  45. },
  46. "triggers": [
  47. {
  48. "type": "ImageChange",
  49. "imageChangeParams": {
  50. "automatic": true,
  51. "containerNames": [
  52. "mariadb"
  53. ],
  54. "from": {
  55. "kind": "ImageStreamTag",
  56. "name": "mariadb:10.1",
  57. "namespace": "${NAMESPACE}"
  58. }
  59. }
  60. },
  61. {
  62. "type": "ConfigChange"
  63. }
  64. ],
  65. "replicas": 1,
  66. "selector": {
  67. "name": "${DATABASE_SERVICE_NAME}"
  68. },
  69. "template": {
  70. "metadata": {
  71. "labels": {
  72. "name": "${DATABASE_SERVICE_NAME}"
  73. }
  74. },
  75. "spec": {
  76. "containers": [
  77. {
  78. "name": "mariadb",
  79. "image": " ",
  80. "ports": [
  81. {
  82. "containerPort": 3306
  83. }
  84. ],
  85. "readinessProbe": {
  86. "timeoutSeconds": 1,
  87. "initialDelaySeconds": 5,
  88. "exec": {
  89. "command": [ "/bin/sh", "-i", "-c",
  90. "MYSQL_PWD=\"$MYSQL_PASSWORD\" mysql -h 127.0.0.1 -u $MYSQL_USER -D $MYSQL_DATABASE -e 'SELECT 1'"]
  91. }
  92. },
  93. "livenessProbe": {
  94. "timeoutSeconds": 1,
  95. "initialDelaySeconds": 30,
  96. "tcpSocket": {
  97. "port": 3306
  98. }
  99. },
  100. "env": [
  101. {
  102. "name": "MYSQL_USER",
  103. "value": "${MYSQL_USER}"
  104. },
  105. {
  106. "name": "MYSQL_PASSWORD",
  107. "value": "${MYSQL_PASSWORD}"
  108. },
  109. {
  110. "name": "MYSQL_DATABASE",
  111. "value": "${MYSQL_DATABASE}"
  112. }
  113. ],
  114. "resources": {
  115. "limits": {
  116. "memory": "${MEMORY_LIMIT}"
  117. }
  118. },
  119. "volumeMounts": [
  120. {
  121. "name": "${DATABASE_SERVICE_NAME}-data",
  122. "mountPath": "/var/lib/mysql/data"
  123. }
  124. ],
  125. "imagePullPolicy": "IfNotPresent"
  126. }
  127. ],
  128. "volumes": [
  129. {
  130. "name": "${DATABASE_SERVICE_NAME}-data",
  131. "emptyDir": {
  132. "medium": ""
  133. }
  134. }
  135. ]
  136. }
  137. }
  138. }
  139. }
  140. ],
  141. "parameters": [
  142. {
  143. "name": "MEMORY_LIMIT",
  144. "displayName": "Memory Limit",
  145. "description": "Maximum amount of memory the container can use.",
  146. "value": "512Mi",
  147. "required": true
  148. },
  149. {
  150. "name": "NAMESPACE",
  151. "displayName": "Namespace",
  152. "description": "The OpenShift Namespace where the ImageStream resides.",
  153. "value": "openshift"
  154. },
  155. {
  156. "name": "DATABASE_SERVICE_NAME",
  157. "displayName": "Database Service Name",
  158. "description": "The name of the OpenShift Service exposed for the database.",
  159. "value": "mariadb",
  160. "required": true
  161. },
  162. {
  163. "name": "MYSQL_USER",
  164. "displayName": "MariaDB Connection Username",
  165. "description": "Username for MariaDB user that will be used for accessing the database.",
  166. "generate": "expression",
  167. "from": "user[A-Z0-9]{3}",
  168. "required": true
  169. },
  170. {
  171. "name": "MYSQL_PASSWORD",
  172. "displayName": "MariaDB Connection Password",
  173. "description": "Password for the MariaDB connection user.",
  174. "generate": "expression",
  175. "from": "[a-zA-Z0-9]{16}",
  176. "required": true
  177. },
  178. {
  179. "name": "MYSQL_DATABASE",
  180. "displayName": "MariaDB Database Name",
  181. "description": "Name of the MariaDB database accessed.",
  182. "value": "sampledb",
  183. "required": true
  184. }
  185. ]
  186. }