mongodb-ephemeral-template.json 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. {
  2. "kind": "Template",
  3. "apiVersion": "v1beta3",
  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": "v1beta3",
  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": "v1beta3",
  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": true,
  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. "ports": [
  91. {
  92. "containerPort": 27017,
  93. "protocol": "TCP"
  94. }
  95. ],
  96. "env": [
  97. {
  98. "name": "MONGODB_USER",
  99. "value": "${MONGODB_USER}"
  100. },
  101. {
  102. "name": "MONGODB_PASSWORD",
  103. "value": "${MONGODB_PASSWORD}"
  104. },
  105. {
  106. "name": "MONGODB_DATABASE",
  107. "value": "${MONGODB_DATABASE}"
  108. },
  109. {
  110. "name": "MONGODB_ADMIN_PASSWORD",
  111. "value": "${MONGODB_ADMIN_PASSWORD}"
  112. }
  113. ],
  114. "resources": {},
  115. "volumeMounts": [
  116. {
  117. "name": "${DATABASE_SERVICE_NAME}-data",
  118. "mountPath": "/var/lib/mongodb/data"
  119. }
  120. ],
  121. "terminationMessagePath": "/dev/termination-log",
  122. "imagePullPolicy": "IfNotPresent",
  123. "capabilities": {},
  124. "securityContext": {
  125. "capabilities": {},
  126. "privileged": false
  127. }
  128. }
  129. ],
  130. "volumes": [
  131. {
  132. "name": "${DATABASE_SERVICE_NAME}-data",
  133. "emptyDir": {
  134. "medium": ""
  135. }
  136. }
  137. ],
  138. "restartPolicy": "Always",
  139. "dnsPolicy": "ClusterFirst"
  140. }
  141. }
  142. },
  143. "status": {}
  144. }
  145. ],
  146. "parameters": [
  147. {
  148. "name": "DATABASE_SERVICE_NAME",
  149. "description": "Database service name",
  150. "value": "mongodb"
  151. },
  152. {
  153. "name": "MONGODB_USER",
  154. "description": "Username for MongoDB user that will be used for accessing the database",
  155. "generate": "expression",
  156. "from": "user[A-Z0-9]{3}"
  157. },
  158. {
  159. "name": "MONGODB_PASSWORD",
  160. "description": "Password for the MongoDB user",
  161. "generate": "expression",
  162. "from": "[a-zA-Z0-9]{16}"
  163. },
  164. {
  165. "name": "MONGODB_DATABASE",
  166. "description": "Database name",
  167. "value": "sampledb"
  168. },
  169. {
  170. "name": "MONGODB_ADMIN_PASSWORD",
  171. "description": "Password for the database admin user",
  172. "generate": "expression",
  173. "from": "[a-zA-Z0-9]{16}"
  174. }
  175. ],
  176. "labels": {
  177. "template": "mongodb-ephemeral-template"
  178. }
  179. }