mongodb-ephemeral-template.json 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. {
  2. "kind": "Template",
  3. "apiVersion": "v1",
  4. "metadata": {
  5. "name": "mongodb-ephemeral",
  6. "creationTimestamp": null,
  7. "annotations": {
  8. "openshift.io/display-name": "MongoDB (Ephemeral)",
  9. "description": "MongoDB database service, without persistent storage. For more information about using this template, including OpenShift considerations, see https://github.com/sclorg/mongodb-container/blob/master/3.2/README.md.\n\nWARNING: Any data stored will be lost upon pod destruction. Only use this template for testing",
  10. "iconClass": "icon-mongodb",
  11. "tags": "database,mongodb"
  12. }
  13. },
  14. "message": "The following service(s) have been created in your project: ${DATABASE_SERVICE_NAME}.\n\n Username: ${MONGODB_USER}\n Password: ${MONGODB_PASSWORD}\n Database Name: ${MONGODB_DATABASE}\n Connection URL: mongodb://${MONGODB_USER}:${MONGODB_PASSWORD}@${DATABASE_SERVICE_NAME}/${MONGODB_DATABASE}\n\nFor more information about using this template, including OpenShift considerations, see https://github.com/sclorg/mongodb-container/blob/master/3.2/README.md.",
  15. "labels": {
  16. "template": "mongodb-ephemeral-template"
  17. },
  18. "objects": [
  19. {
  20. "kind": "Service",
  21. "apiVersion": "v1",
  22. "metadata": {
  23. "name": "${DATABASE_SERVICE_NAME}",
  24. "creationTimestamp": null
  25. },
  26. "spec": {
  27. "ports": [
  28. {
  29. "name": "mongo",
  30. "protocol": "TCP",
  31. "port": 27017,
  32. "targetPort": 27017,
  33. "nodePort": 0
  34. }
  35. ],
  36. "selector": {
  37. "name": "${DATABASE_SERVICE_NAME}"
  38. },
  39. "type": "ClusterIP",
  40. "sessionAffinity": "None"
  41. },
  42. "status": {
  43. "loadBalancer": {}
  44. }
  45. },
  46. {
  47. "kind": "DeploymentConfig",
  48. "apiVersion": "v1",
  49. "metadata": {
  50. "name": "${DATABASE_SERVICE_NAME}",
  51. "creationTimestamp": null
  52. },
  53. "spec": {
  54. "strategy": {
  55. "type": "Recreate"
  56. },
  57. "triggers": [
  58. {
  59. "type": "ImageChange",
  60. "imageChangeParams": {
  61. "automatic": true,
  62. "containerNames": [
  63. "mongodb"
  64. ],
  65. "from": {
  66. "kind": "ImageStreamTag",
  67. "name": "mongodb:${MONGODB_VERSION}",
  68. "namespace": "${NAMESPACE}"
  69. },
  70. "lastTriggeredImage": ""
  71. }
  72. },
  73. {
  74. "type": "ConfigChange"
  75. }
  76. ],
  77. "replicas": 1,
  78. "selector": {
  79. "name": "${DATABASE_SERVICE_NAME}"
  80. },
  81. "template": {
  82. "metadata": {
  83. "creationTimestamp": null,
  84. "labels": {
  85. "name": "${DATABASE_SERVICE_NAME}"
  86. }
  87. },
  88. "spec": {
  89. "containers": [
  90. {
  91. "name": "mongodb",
  92. "image": " ",
  93. "ports": [
  94. {
  95. "containerPort": 27017,
  96. "protocol": "TCP"
  97. }
  98. ],
  99. "readinessProbe": {
  100. "timeoutSeconds": 1,
  101. "initialDelaySeconds": 3,
  102. "exec": {
  103. "command": [ "/bin/sh", "-i", "-c", "mongo 127.0.0.1:27017/$MONGODB_DATABASE -u $MONGODB_USER -p $MONGODB_PASSWORD --eval=\"quit()\""]
  104. }
  105. },
  106. "livenessProbe": {
  107. "timeoutSeconds": 1,
  108. "initialDelaySeconds": 30,
  109. "tcpSocket": {
  110. "port": 27017
  111. }
  112. },
  113. "env": [
  114. {
  115. "name": "MONGODB_USER",
  116. "value": "${MONGODB_USER}"
  117. },
  118. {
  119. "name": "MONGODB_PASSWORD",
  120. "value": "${MONGODB_PASSWORD}"
  121. },
  122. {
  123. "name": "MONGODB_DATABASE",
  124. "value": "${MONGODB_DATABASE}"
  125. },
  126. {
  127. "name": "MONGODB_ADMIN_PASSWORD",
  128. "value": "${MONGODB_ADMIN_PASSWORD}"
  129. }
  130. ],
  131. "resources": {
  132. "limits": {
  133. "memory": "${MEMORY_LIMIT}"
  134. }
  135. },
  136. "volumeMounts": [
  137. {
  138. "name": "${DATABASE_SERVICE_NAME}-data",
  139. "mountPath": "/var/lib/mongodb/data"
  140. }
  141. ],
  142. "terminationMessagePath": "/dev/termination-log",
  143. "imagePullPolicy": "IfNotPresent",
  144. "capabilities": {},
  145. "securityContext": {
  146. "capabilities": {},
  147. "privileged": false
  148. }
  149. }
  150. ],
  151. "volumes": [
  152. {
  153. "name": "${DATABASE_SERVICE_NAME}-data",
  154. "emptyDir": {
  155. "medium": ""
  156. }
  157. }
  158. ],
  159. "restartPolicy": "Always",
  160. "dnsPolicy": "ClusterFirst"
  161. }
  162. }
  163. },
  164. "status": {}
  165. }
  166. ],
  167. "parameters": [
  168. {
  169. "name": "MEMORY_LIMIT",
  170. "displayName": "Memory Limit",
  171. "description": "Maximum amount of memory the container can use.",
  172. "value": "512Mi"
  173. },
  174. {
  175. "name": "NAMESPACE",
  176. "displayName": "Namespace",
  177. "description": "The OpenShift Namespace where the ImageStream resides.",
  178. "value": "openshift"
  179. },
  180. {
  181. "name": "DATABASE_SERVICE_NAME",
  182. "displayName": "Database Service Name",
  183. "description": "The name of the OpenShift Service exposed for the database.",
  184. "value": "mongodb",
  185. "required": true
  186. },
  187. {
  188. "name": "MONGODB_USER",
  189. "displayName": "MongoDB Connection Username",
  190. "description": "Username for MongoDB user that will be used for accessing the database.",
  191. "generate": "expression",
  192. "from": "user[A-Z0-9]{3}",
  193. "required": true
  194. },
  195. {
  196. "name": "MONGODB_PASSWORD",
  197. "displayName": "MongoDB Connection Password",
  198. "description": "Password for the MongoDB connection user.",
  199. "generate": "expression",
  200. "from": "[a-zA-Z0-9]{16}",
  201. "required": true
  202. },
  203. {
  204. "name": "MONGODB_DATABASE",
  205. "displayName": "MongoDB Database Name",
  206. "description": "Name of the MongoDB database accessed.",
  207. "value": "sampledb",
  208. "required": true
  209. },
  210. {
  211. "name": "MONGODB_ADMIN_PASSWORD",
  212. "displayName": "MongoDB Admin Password",
  213. "description": "Password for the database admin user.",
  214. "generate": "expression",
  215. "from": "[a-zA-Z0-9]{16}",
  216. "required": true
  217. },
  218. {
  219. "name": "MONGODB_VERSION",
  220. "displayName": "Version of MongoDB Image",
  221. "description": "Version of MongoDB image to be used (2.4, 2.6, 3.2 or latest).",
  222. "value": "3.2",
  223. "required": true
  224. }
  225. ]
  226. }