mongodb-ephemeral-template.json 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. {
  2. "kind": "Template",
  3. "apiVersion": "v1",
  4. "metadata": {
  5. "name": "mongodb-ephemeral",
  6. "creationTimestamp": null,
  7. "annotations": {
  8. "description": "MongoDB database service, without persistent storage. WARNING: Any data stored will be lost upon pod destruction. Only use this template for testing",
  9. "iconClass": "icon-mongodb",
  10. "tags": "database,mongodb"
  11. }
  12. },
  13. "objects": [
  14. {
  15. "kind": "Service",
  16. "apiVersion": "v1",
  17. "metadata": {
  18. "name": "${DATABASE_SERVICE_NAME}",
  19. "creationTimestamp": null
  20. },
  21. "spec": {
  22. "ports": [
  23. {
  24. "name": "mongo",
  25. "protocol": "TCP",
  26. "port": 27017,
  27. "targetPort": 27017,
  28. "nodePort": 0
  29. }
  30. ],
  31. "selector": {
  32. "name": "${DATABASE_SERVICE_NAME}"
  33. },
  34. "portalIP": "",
  35. "type": "ClusterIP",
  36. "sessionAffinity": "None"
  37. },
  38. "status": {
  39. "loadBalancer": {}
  40. }
  41. },
  42. {
  43. "kind": "DeploymentConfig",
  44. "apiVersion": "v1",
  45. "metadata": {
  46. "name": "${DATABASE_SERVICE_NAME}",
  47. "creationTimestamp": null
  48. },
  49. "spec": {
  50. "strategy": {
  51. "type": "Recreate",
  52. "resources": {}
  53. },
  54. "triggers": [
  55. {
  56. "type": "ImageChange",
  57. "imageChangeParams": {
  58. "automatic": false,
  59. "containerNames": [
  60. "mongodb"
  61. ],
  62. "from": {
  63. "kind": "ImageStreamTag",
  64. "name": "mongodb:latest",
  65. "namespace": "openshift"
  66. },
  67. "lastTriggeredImage": ""
  68. }
  69. },
  70. {
  71. "type": "ConfigChange"
  72. }
  73. ],
  74. "replicas": 1,
  75. "selector": {
  76. "name": "${DATABASE_SERVICE_NAME}"
  77. },
  78. "template": {
  79. "metadata": {
  80. "creationTimestamp": null,
  81. "labels": {
  82. "name": "${DATABASE_SERVICE_NAME}"
  83. }
  84. },
  85. "spec": {
  86. "containers": [
  87. {
  88. "name": "mongodb",
  89. "image": "mongodb",
  90. "readinessProbe": {
  91. "tcpSocket":{
  92. "port": 27017
  93. },
  94. "initialDelaySeconds": 15,
  95. "timeoutSeconds": 1
  96. },
  97. "ports": [
  98. {
  99. "containerPort": 27017,
  100. "protocol": "TCP"
  101. }
  102. ],
  103. "env": [
  104. {
  105. "name": "MONGODB_USER",
  106. "value": "${MONGODB_USER}"
  107. },
  108. {
  109. "name": "MONGODB_PASSWORD",
  110. "value": "${MONGODB_PASSWORD}"
  111. },
  112. {
  113. "name": "MONGODB_DATABASE",
  114. "value": "${MONGODB_DATABASE}"
  115. },
  116. {
  117. "name": "MONGODB_ADMIN_PASSWORD",
  118. "value": "${MONGODB_ADMIN_PASSWORD}"
  119. }
  120. ],
  121. "resources": {},
  122. "volumeMounts": [
  123. {
  124. "name": "${DATABASE_SERVICE_NAME}-data",
  125. "mountPath": "/var/lib/mongodb/data"
  126. }
  127. ],
  128. "terminationMessagePath": "/dev/termination-log",
  129. "imagePullPolicy": "IfNotPresent",
  130. "capabilities": {},
  131. "securityContext": {
  132. "capabilities": {},
  133. "privileged": false
  134. }
  135. }
  136. ],
  137. "volumes": [
  138. {
  139. "name": "${DATABASE_SERVICE_NAME}-data",
  140. "emptyDir": {
  141. "medium": ""
  142. }
  143. }
  144. ],
  145. "restartPolicy": "Always",
  146. "dnsPolicy": "ClusterFirst"
  147. }
  148. }
  149. },
  150. "status": {}
  151. }
  152. ],
  153. "parameters": [
  154. {
  155. "name": "DATABASE_SERVICE_NAME",
  156. "description": "Database service name",
  157. "value": "mongodb",
  158. "required": true
  159. },
  160. {
  161. "name": "MONGODB_USER",
  162. "description": "Username for MongoDB user that will be used for accessing the database",
  163. "generate": "expression",
  164. "from": "user[A-Z0-9]{3}",
  165. "required": true
  166. },
  167. {
  168. "name": "MONGODB_PASSWORD",
  169. "description": "Password for the MongoDB user",
  170. "generate": "expression",
  171. "from": "[a-zA-Z0-9]{16}",
  172. "required": true
  173. },
  174. {
  175. "name": "MONGODB_DATABASE",
  176. "description": "Database name",
  177. "value": "sampledb",
  178. "required": true
  179. },
  180. {
  181. "name": "MONGODB_ADMIN_PASSWORD",
  182. "description": "Password for the database admin user",
  183. "generate": "expression",
  184. "from": "[a-zA-Z0-9]{16}",
  185. "required": true
  186. }
  187. ],
  188. "labels": {
  189. "template": "mongodb-ephemeral-template"
  190. }
  191. }