mariadb-ephemeral-template.json 5.0 KB

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