mongodb-ephemeral-template.json 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  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": "Secret",
  21. "apiVersion": "v1",
  22. "metadata": {
  23. "name": "${DATABASE_SERVICE_NAME}"
  24. },
  25. "stringData" : {
  26. "database-user" : "${MONGODB_USER}",
  27. "database-password" : "${MONGODB_PASSWORD}",
  28. "database-admin-password" : "${MONGODB_ADMIN_PASSWORD}"
  29. }
  30. },
  31. {
  32. "kind": "Service",
  33. "apiVersion": "v1",
  34. "metadata": {
  35. "name": "${DATABASE_SERVICE_NAME}",
  36. "creationTimestamp": null
  37. },
  38. "spec": {
  39. "ports": [
  40. {
  41. "name": "mongo",
  42. "protocol": "TCP",
  43. "port": 27017,
  44. "targetPort": 27017,
  45. "nodePort": 0
  46. }
  47. ],
  48. "selector": {
  49. "name": "${DATABASE_SERVICE_NAME}"
  50. },
  51. "type": "ClusterIP",
  52. "sessionAffinity": "None"
  53. },
  54. "status": {
  55. "loadBalancer": {}
  56. }
  57. },
  58. {
  59. "kind": "DeploymentConfig",
  60. "apiVersion": "v1",
  61. "metadata": {
  62. "name": "${DATABASE_SERVICE_NAME}",
  63. "creationTimestamp": null
  64. },
  65. "spec": {
  66. "strategy": {
  67. "type": "Recreate"
  68. },
  69. "triggers": [
  70. {
  71. "type": "ImageChange",
  72. "imageChangeParams": {
  73. "automatic": true,
  74. "containerNames": [
  75. "mongodb"
  76. ],
  77. "from": {
  78. "kind": "ImageStreamTag",
  79. "name": "mongodb:${MONGODB_VERSION}",
  80. "namespace": "${NAMESPACE}"
  81. },
  82. "lastTriggeredImage": ""
  83. }
  84. },
  85. {
  86. "type": "ConfigChange"
  87. }
  88. ],
  89. "replicas": 1,
  90. "selector": {
  91. "name": "${DATABASE_SERVICE_NAME}"
  92. },
  93. "template": {
  94. "metadata": {
  95. "creationTimestamp": null,
  96. "labels": {
  97. "name": "${DATABASE_SERVICE_NAME}"
  98. }
  99. },
  100. "spec": {
  101. "containers": [
  102. {
  103. "name": "mongodb",
  104. "image": " ",
  105. "ports": [
  106. {
  107. "containerPort": 27017,
  108. "protocol": "TCP"
  109. }
  110. ],
  111. "readinessProbe": {
  112. "timeoutSeconds": 1,
  113. "initialDelaySeconds": 3,
  114. "exec": {
  115. "command": [ "/bin/sh", "-i", "-c", "mongo 127.0.0.1:27017/$MONGODB_DATABASE -u $MONGODB_USER -p $MONGODB_PASSWORD --eval=\"quit()\""]
  116. }
  117. },
  118. "livenessProbe": {
  119. "timeoutSeconds": 1,
  120. "initialDelaySeconds": 30,
  121. "tcpSocket": {
  122. "port": 27017
  123. }
  124. },
  125. "env": [
  126. {
  127. "name": "MONGODB_USER",
  128. "valueFrom": {
  129. "secretKeyRef" : {
  130. "name" : "${DATABASE_SERVICE_NAME}",
  131. "key" : "database-user"
  132. }
  133. }
  134. },
  135. {
  136. "name": "MONGODB_PASSWORD",
  137. "valueFrom": {
  138. "secretKeyRef" : {
  139. "name" : "${DATABASE_SERVICE_NAME}",
  140. "key" : "database-password"
  141. }
  142. }
  143. },
  144. {
  145. "name": "MONGODB_ADMIN_PASSWORD",
  146. "valueFrom": {
  147. "secretKeyRef" : {
  148. "name" : "${DATABASE_SERVICE_NAME}",
  149. "key" : "database-admin-password"
  150. }
  151. }
  152. },
  153. {
  154. "name": "MONGODB_DATABASE",
  155. "value": "${MONGODB_DATABASE}"
  156. }
  157. ],
  158. "resources": {
  159. "limits": {
  160. "memory": "${MEMORY_LIMIT}"
  161. }
  162. },
  163. "volumeMounts": [
  164. {
  165. "name": "${DATABASE_SERVICE_NAME}-data",
  166. "mountPath": "/var/lib/mongodb/data"
  167. }
  168. ],
  169. "terminationMessagePath": "/dev/termination-log",
  170. "imagePullPolicy": "IfNotPresent",
  171. "capabilities": {},
  172. "securityContext": {
  173. "capabilities": {},
  174. "privileged": false
  175. }
  176. }
  177. ],
  178. "volumes": [
  179. {
  180. "name": "${DATABASE_SERVICE_NAME}-data",
  181. "emptyDir": {
  182. "medium": ""
  183. }
  184. }
  185. ],
  186. "restartPolicy": "Always",
  187. "dnsPolicy": "ClusterFirst"
  188. }
  189. }
  190. },
  191. "status": {}
  192. }
  193. ],
  194. "parameters": [
  195. {
  196. "name": "MEMORY_LIMIT",
  197. "displayName": "Memory Limit",
  198. "description": "Maximum amount of memory the container can use.",
  199. "value": "512Mi"
  200. },
  201. {
  202. "name": "NAMESPACE",
  203. "displayName": "Namespace",
  204. "description": "The OpenShift Namespace where the ImageStream resides.",
  205. "value": "openshift"
  206. },
  207. {
  208. "name": "DATABASE_SERVICE_NAME",
  209. "displayName": "Database Service Name",
  210. "description": "The name of the OpenShift Service exposed for the database.",
  211. "value": "mongodb",
  212. "required": true
  213. },
  214. {
  215. "name": "MONGODB_USER",
  216. "displayName": "MongoDB Connection Username",
  217. "description": "Username for MongoDB user that will be used for accessing the database.",
  218. "generate": "expression",
  219. "from": "user[A-Z0-9]{3}",
  220. "required": true
  221. },
  222. {
  223. "name": "MONGODB_PASSWORD",
  224. "displayName": "MongoDB Connection Password",
  225. "description": "Password for the MongoDB connection user.",
  226. "generate": "expression",
  227. "from": "[a-zA-Z0-9]{16}",
  228. "required": true
  229. },
  230. {
  231. "name": "MONGODB_DATABASE",
  232. "displayName": "MongoDB Database Name",
  233. "description": "Name of the MongoDB database accessed.",
  234. "value": "sampledb",
  235. "required": true
  236. },
  237. {
  238. "name": "MONGODB_ADMIN_PASSWORD",
  239. "displayName": "MongoDB Admin Password",
  240. "description": "Password for the database admin user.",
  241. "generate": "expression",
  242. "from": "[a-zA-Z0-9]{16}",
  243. "required": true
  244. },
  245. {
  246. "name": "MONGODB_VERSION",
  247. "displayName": "Version of MongoDB Image",
  248. "description": "Version of MongoDB image to be used (2.4, 2.6, 3.2 or latest).",
  249. "value": "3.2",
  250. "required": true
  251. }
  252. ]
  253. }