Advertisement
Guest User

Untitled

a guest
Nov 7th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.16 KB | None | 0 0
  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. "template.openshift.io/long-description": "This template provides a standalone MongoDB server with a database created. The database is not stored on persistent storage, so any restart of the service will result in all data being lost. The database name, username, and password are chosen via parameters when provisioning this service.",
  13. "template.openshift.io/provider-display-name": "Red Hat, Inc.",
  14. "template.openshift.io/documentation-url": "https://docs.openshift.org/latest/using_images/db_images/mongodb.html",
  15. "template.openshift.io/support-url": "https://access.redhat.com"
  16. }
  17. },
  18. "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.",
  19. "labels": {
  20. "template": "mongodb-ephemeral-template"
  21. },
  22. "objects": [
  23. {
  24. "kind": "Secret",
  25. "apiVersion": "v1",
  26. "metadata": {
  27. "name": "${DATABASE_SERVICE_NAME}",
  28. "annotations": {
  29. "template.openshift.io/expose-username": "{.data['database-user']}",
  30. "template.openshift.io/expose-password": "{.data['database-password']}",
  31. "template.openshift.io/expose-admin_password": "{.data['database-admin-password']}"
  32. }
  33. },
  34. "stringData" : {
  35. "database-user" : "${MONGODB_USER}",
  36. "database-password" : "${MONGODB_PASSWORD}",
  37. "database-admin-password" : "${MONGODB_ADMIN_PASSWORD}"
  38. }
  39. },
  40. {
  41. "kind": "Service",
  42. "apiVersion": "v1",
  43. "metadata": {
  44. "name": "${DATABASE_SERVICE_NAME}",
  45. "creationTimestamp": null,
  46. "annotations": {
  47. "template.openshift.io/expose-uri": "mongodb://{.spec.clusterIP}:{.spec.ports[?(.name==\"mongo\")].port}"
  48. }
  49. },
  50. "spec": {
  51. "ports": [
  52. {
  53. "name": "mongo",
  54. "protocol": "TCP",
  55. "port": 27017,
  56. "targetPort": 27017,
  57. "nodePort": 0
  58. }
  59. ],
  60. "selector": {
  61. "name": "${DATABASE_SERVICE_NAME}"
  62. },
  63. "type": "ClusterIP",
  64. "sessionAffinity": "None"
  65. },
  66. "status": {
  67. "loadBalancer": {}
  68. }
  69. },
  70. {
  71. "kind": "DeploymentConfig",
  72. "apiVersion": "v1",
  73. "metadata": {
  74. "name": "${DATABASE_SERVICE_NAME}",
  75. "creationTimestamp": null
  76. },
  77. "spec": {
  78. "strategy": {
  79. "type": "Recreate"
  80. },
  81. "triggers": [
  82. {
  83. "type": "ImageChange",
  84. "imageChangeParams": {
  85. "automatic": true,
  86. "containerNames": [
  87. "mongodb"
  88. ],
  89. "from": {
  90. "kind": "ImageStreamTag",
  91. "name": "mongodb:${MONGODB_VERSION}",
  92. "namespace": "${NAMESPACE}"
  93. },
  94. "lastTriggeredImage": ""
  95. }
  96. },
  97. {
  98. "type": "ConfigChange"
  99. }
  100. ],
  101. "replicas": 1,
  102. "selector": {
  103. "name": "${DATABASE_SERVICE_NAME}"
  104. },
  105. "template": {
  106. "metadata": {
  107. "creationTimestamp": null,
  108. "labels": {
  109. "name": "${DATABASE_SERVICE_NAME}"
  110. }
  111. },
  112. "spec": {
  113. "containers": [
  114. {
  115. "name": "mongodb",
  116. "image": " ",
  117. "ports": [
  118. {
  119. "containerPort": 27017,
  120. "protocol": "TCP"
  121. }
  122. ],
  123. "readinessProbe": {
  124. "timeoutSeconds": 1,
  125. "initialDelaySeconds": 3,
  126. "exec": {
  127. "command": [ "/bin/sh", "-i", "-c", "mongo 127.0.0.1:27017/$MONGODB_DATABASE -u $MONGODB_USER -p $MONGODB_PASSWORD --eval=\"quit()\""]
  128. }
  129. },
  130. "livenessProbe": {
  131. "timeoutSeconds": 1,
  132. "initialDelaySeconds": 30,
  133. "tcpSocket": {
  134. "port": 27017
  135. }
  136. },
  137. "env": [
  138. {
  139. "name": "MONGODB_USER",
  140. "valueFrom": {
  141. "secretKeyRef" : {
  142. "name" : "${DATABASE_SERVICE_NAME}",
  143. "key" : "database-user"
  144. }
  145. }
  146. },
  147. {
  148. "name": "MONGODB_PASSWORD",
  149. "valueFrom": {
  150. "secretKeyRef" : {
  151. "name" : "${DATABASE_SERVICE_NAME}",
  152. "key" : "database-password"
  153. }
  154. }
  155. },
  156. {
  157. "name": "MONGODB_ADMIN_PASSWORD",
  158. "valueFrom": {
  159. "secretKeyRef" : {
  160. "name" : "${DATABASE_SERVICE_NAME}",
  161. "key" : "database-admin-password"
  162. }
  163. }
  164. },
  165. {
  166. "name": "MONGODB_DATABASE",
  167. "value": "${MONGODB_DATABASE}"
  168. }
  169. ],
  170. "resources": {
  171. "limits": {
  172. "memory": "${MEMORY_LIMIT}"
  173. }
  174. },
  175. "volumeMounts": [
  176. {
  177. "name": "${DATABASE_SERVICE_NAME}-data",
  178. "mountPath": "/var/lib/mongodb/data"
  179. }
  180. ],
  181. "terminationMessagePath": "/dev/termination-log",
  182. "imagePullPolicy": "IfNotPresent",
  183. "capabilities": {},
  184. "securityContext": {
  185. "capabilities": {},
  186. "privileged": false
  187. }
  188. }
  189. ],
  190. "volumes": [
  191. {
  192. "name": "${DATABASE_SERVICE_NAME}-data",
  193. "emptyDir": {
  194. "medium": ""
  195. }
  196. }
  197. ],
  198. "restartPolicy": "Always",
  199. "dnsPolicy": "ClusterFirst"
  200. }
  201. }
  202. },
  203. "status": {}
  204. }
  205. ],
  206. "parameters": [
  207. {
  208. "name": "MEMORY_LIMIT",
  209. "displayName": "Memory Limit",
  210. "description": "Maximum amount of memory the container can use.",
  211. "value": "512Mi",
  212. "required": true
  213. },
  214. {
  215. "name": "NAMESPACE",
  216. "displayName": "Namespace",
  217. "description": "The OpenShift Namespace where the ImageStream resides.",
  218. "value": "openshift"
  219. },
  220. {
  221. "name": "DATABASE_SERVICE_NAME",
  222. "displayName": "Database Service Name",
  223. "description": "The name of the OpenShift Service exposed for the database.",
  224. "value": "mongodb",
  225. "required": true
  226. },
  227. {
  228. "name": "MONGODB_USER",
  229. "displayName": "MongoDB Connection Username",
  230. "description": "Username for MongoDB user that will be used for accessing the database.",
  231. "generate": "expression",
  232. "from": "user[A-Z0-9]{3}",
  233. "required": true
  234. },
  235. {
  236. "name": "MONGODB_PASSWORD",
  237. "displayName": "MongoDB Connection Password",
  238. "description": "Password for the MongoDB connection user.",
  239. "generate": "expression",
  240. "from": "[a-zA-Z0-9]{16}",
  241. "required": true
  242. },
  243. {
  244. "name": "MONGODB_DATABASE",
  245. "displayName": "MongoDB Database Name",
  246. "description": "Name of the MongoDB database accessed.",
  247. "value": "sampledb",
  248. "required": true
  249. },
  250. {
  251. "name": "MONGODB_ADMIN_PASSWORD",
  252. "displayName": "MongoDB Admin Password",
  253. "description": "Password for the database admin user.",
  254. "generate": "expression",
  255. "from": "[a-zA-Z0-9]{16}",
  256. "required": true
  257. },
  258. {
  259. "name": "MONGODB_VERSION",
  260. "displayName": "Version of MongoDB Image",
  261. "description": "Version of MongoDB image to be used (2.4, 2.6, 3.2 or latest).",
  262. "value": "3.2",
  263. "required": true
  264. }
  265. ]
  266. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement