redis-ephemeral-template.json 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. {
  2. "kind": "Template",
  3. "apiVersion": "v1",
  4. "metadata": {
  5. "name": "redis-ephemeral",
  6. "creationTimestamp": null,
  7. "annotations": {
  8. "openshift.io/display-name": "Redis (Ephemeral)",
  9. "description": "Redis in-memory data structure store, without persistent storage. For more information about using this template, including OpenShift considerations, see https://github.com/sclorg/redis-container/blob/master/3.2.\n\nWARNING: Any data stored will be lost upon pod destruction. Only use this template for testing",
  10. "iconClass": "icon-redis",
  11. "tags": "database,redis",
  12. "template.openshift.io/long-description": "This template provides a standalone Redis server. The data is not stored on persistent storage, so any restart of the service will result in all data being lost.",
  13. "template.openshift.io/provider-display-name": "Red Hat, Inc.",
  14. "template.openshift.io/documentation-url": "https://github.com/sclorg/redis-container/tree/master/3.2",
  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 Password: ${REDIS_PASSWORD}\n Connection URL: redis://${DATABASE_SERVICE_NAME}:6379/\n\nFor more information about using this template, including OpenShift considerations, see https://github.com/sclorg/redis-container/blob/master/3.2.",
  19. "labels": {
  20. "template": "redis-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-password": "{.data['database-password']}"
  30. }
  31. },
  32. "stringData" : {
  33. "database-password" : "${REDIS_PASSWORD}"
  34. }
  35. },
  36. {
  37. "kind": "Service",
  38. "apiVersion": "v1",
  39. "metadata": {
  40. "name": "${DATABASE_SERVICE_NAME}",
  41. "creationTimestamp": null,
  42. "annotations": {
  43. "template.openshift.io/expose-uri": "redis://{.spec.clusterIP}:{.spec.ports[?(.name==\"redis\")].port}"
  44. }
  45. },
  46. "spec": {
  47. "ports": [
  48. {
  49. "name": "redis",
  50. "protocol": "TCP",
  51. "port": 6379,
  52. "targetPort": 6379,
  53. "nodePort": 0
  54. }
  55. ],
  56. "selector": {
  57. "name": "${DATABASE_SERVICE_NAME}"
  58. },
  59. "type": "ClusterIP",
  60. "sessionAffinity": "None"
  61. },
  62. "status": {
  63. "loadBalancer": {}
  64. }
  65. },
  66. {
  67. "kind": "DeploymentConfig",
  68. "apiVersion": "v1",
  69. "metadata": {
  70. "name": "${DATABASE_SERVICE_NAME}",
  71. "creationTimestamp": null
  72. },
  73. "spec": {
  74. "strategy": {
  75. "type": "Recreate"
  76. },
  77. "triggers": [
  78. {
  79. "type": "ImageChange",
  80. "imageChangeParams": {
  81. "automatic": true,
  82. "containerNames": [
  83. "redis"
  84. ],
  85. "from": {
  86. "kind": "ImageStreamTag",
  87. "name": "redis:${REDIS_VERSION}",
  88. "namespace": "${NAMESPACE}"
  89. },
  90. "lastTriggeredImage": ""
  91. }
  92. },
  93. {
  94. "type": "ConfigChange"
  95. }
  96. ],
  97. "replicas": 1,
  98. "selector": {
  99. "name": "${DATABASE_SERVICE_NAME}"
  100. },
  101. "template": {
  102. "metadata": {
  103. "creationTimestamp": null,
  104. "labels": {
  105. "name": "${DATABASE_SERVICE_NAME}"
  106. }
  107. },
  108. "spec": {
  109. "containers": [
  110. {
  111. "name": "redis",
  112. "image": " ",
  113. "ports": [
  114. {
  115. "containerPort": 6379,
  116. "protocol": "TCP"
  117. }
  118. ],
  119. "readinessProbe": {
  120. "timeoutSeconds": 1,
  121. "initialDelaySeconds": 5,
  122. "exec": {
  123. "command": [ "/bin/sh", "-i", "-c", "test \"$(redis-cli -h 127.0.0.1 -a $REDIS_PASSWORD ping)\" == \"PONG\""]
  124. }
  125. },
  126. "livenessProbe": {
  127. "timeoutSeconds": 1,
  128. "initialDelaySeconds": 30,
  129. "tcpSocket": {
  130. "port": 6379
  131. }
  132. },
  133. "env": [
  134. {
  135. "name": "REDIS_PASSWORD",
  136. "valueFrom": {
  137. "secretKeyRef" : {
  138. "name" : "${DATABASE_SERVICE_NAME}",
  139. "key" : "database-password"
  140. }
  141. }
  142. }
  143. ],
  144. "resources": {
  145. "limits": {
  146. "memory": "${MEMORY_LIMIT}"
  147. }
  148. },
  149. "volumeMounts": [
  150. {
  151. "name": "${DATABASE_SERVICE_NAME}-data",
  152. "mountPath": "/var/lib/redis/data"
  153. }
  154. ],
  155. "terminationMessagePath": "/dev/termination-log",
  156. "imagePullPolicy": "IfNotPresent",
  157. "capabilities": {},
  158. "securityContext": {
  159. "capabilities": {},
  160. "privileged": false
  161. }
  162. }
  163. ],
  164. "volumes": [
  165. {
  166. "name": "${DATABASE_SERVICE_NAME}-data",
  167. "emptyDir": {
  168. "medium": ""
  169. }
  170. }
  171. ],
  172. "restartPolicy": "Always",
  173. "dnsPolicy": "ClusterFirst"
  174. }
  175. }
  176. },
  177. "status": {}
  178. }
  179. ],
  180. "parameters": [
  181. {
  182. "name": "MEMORY_LIMIT",
  183. "displayName": "Memory Limit",
  184. "description": "Maximum amount of memory the container can use.",
  185. "value": "512Mi",
  186. "required": true
  187. },
  188. {
  189. "name": "NAMESPACE",
  190. "displayName": "Namespace",
  191. "description": "The OpenShift Namespace where the ImageStream resides.",
  192. "value": "openshift"
  193. },
  194. {
  195. "name": "DATABASE_SERVICE_NAME",
  196. "displayName": "Database Service Name",
  197. "description": "The name of the OpenShift Service exposed for the database.",
  198. "value": "redis",
  199. "required": true
  200. },
  201. {
  202. "name": "REDIS_PASSWORD",
  203. "displayName": "Redis Connection Password",
  204. "description": "Password for the Redis connection user.",
  205. "generate": "expression",
  206. "from": "[a-zA-Z0-9]{16}",
  207. "required": true
  208. },
  209. {
  210. "name": "REDIS_VERSION",
  211. "displayName": "Version of Redis Image",
  212. "description": "Version of Redis image to be used (3.2 or latest).",
  213. "value": "3.2",
  214. "required": true
  215. }
  216. ]
  217. }