redis-ephemeral-template.json 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  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": "Service",
  25. "apiVersion": "v1",
  26. "metadata": {
  27. "name": "${DATABASE_SERVICE_NAME}",
  28. "creationTimestamp": null
  29. },
  30. "spec": {
  31. "ports": [
  32. {
  33. "name": "redis",
  34. "protocol": "TCP",
  35. "port": 6379,
  36. "targetPort": 6379,
  37. "nodePort": 0
  38. }
  39. ],
  40. "selector": {
  41. "name": "${DATABASE_SERVICE_NAME}"
  42. },
  43. "type": "ClusterIP",
  44. "sessionAffinity": "None"
  45. },
  46. "status": {
  47. "loadBalancer": {}
  48. }
  49. },
  50. {
  51. "kind": "DeploymentConfig",
  52. "apiVersion": "v1",
  53. "metadata": {
  54. "name": "${DATABASE_SERVICE_NAME}",
  55. "creationTimestamp": null
  56. },
  57. "spec": {
  58. "strategy": {
  59. "type": "Recreate"
  60. },
  61. "triggers": [
  62. {
  63. "type": "ImageChange",
  64. "imageChangeParams": {
  65. "automatic": true,
  66. "containerNames": [
  67. "redis"
  68. ],
  69. "from": {
  70. "kind": "ImageStreamTag",
  71. "name": "redis:${REDIS_VERSION}",
  72. "namespace": "${NAMESPACE}"
  73. },
  74. "lastTriggeredImage": ""
  75. }
  76. },
  77. {
  78. "type": "ConfigChange"
  79. }
  80. ],
  81. "replicas": 1,
  82. "selector": {
  83. "name": "${DATABASE_SERVICE_NAME}"
  84. },
  85. "template": {
  86. "metadata": {
  87. "creationTimestamp": null,
  88. "labels": {
  89. "name": "${DATABASE_SERVICE_NAME}"
  90. }
  91. },
  92. "spec": {
  93. "containers": [
  94. {
  95. "name": "redis",
  96. "image": " ",
  97. "ports": [
  98. {
  99. "containerPort": 6379,
  100. "protocol": "TCP"
  101. }
  102. ],
  103. "readinessProbe": {
  104. "timeoutSeconds": 1,
  105. "initialDelaySeconds": 5,
  106. "exec": {
  107. "command": [ "/bin/sh", "-i", "-c", "test \"$(redis-cli -h 127.0.0.1 -a $REDIS_PASSWORD ping)\" == \"PONG\""]
  108. }
  109. },
  110. "livenessProbe": {
  111. "timeoutSeconds": 1,
  112. "initialDelaySeconds": 30,
  113. "tcpSocket": {
  114. "port": 6379
  115. }
  116. },
  117. "env": [
  118. {
  119. "name": "REDIS_PASSWORD",
  120. "value": "${REDIS_PASSWORD}"
  121. }
  122. ],
  123. "resources": {
  124. "limits": {
  125. "memory": "${MEMORY_LIMIT}"
  126. }
  127. },
  128. "volumeMounts": [
  129. {
  130. "name": "${DATABASE_SERVICE_NAME}-data",
  131. "mountPath": "/var/lib/redis/data"
  132. }
  133. ],
  134. "terminationMessagePath": "/dev/termination-log",
  135. "imagePullPolicy": "IfNotPresent",
  136. "capabilities": {},
  137. "securityContext": {
  138. "capabilities": {},
  139. "privileged": false
  140. }
  141. }
  142. ],
  143. "volumes": [
  144. {
  145. "name": "${DATABASE_SERVICE_NAME}-data",
  146. "emptyDir": {
  147. "medium": ""
  148. }
  149. }
  150. ],
  151. "restartPolicy": "Always",
  152. "dnsPolicy": "ClusterFirst"
  153. }
  154. }
  155. },
  156. "status": {}
  157. }
  158. ],
  159. "parameters": [
  160. {
  161. "name": "MEMORY_LIMIT",
  162. "displayName": "Memory Limit",
  163. "description": "Maximum amount of memory the container can use.",
  164. "value": "512Mi",
  165. "required": true
  166. },
  167. {
  168. "name": "NAMESPACE",
  169. "displayName": "Namespace",
  170. "description": "The OpenShift Namespace where the ImageStream resides.",
  171. "value": "openshift"
  172. },
  173. {
  174. "name": "DATABASE_SERVICE_NAME",
  175. "displayName": "Database Service Name",
  176. "description": "The name of the OpenShift Service exposed for the database.",
  177. "value": "redis",
  178. "required": true
  179. },
  180. {
  181. "name": "REDIS_PASSWORD",
  182. "displayName": "Redis Connection Password",
  183. "description": "Password for the Redis connection user.",
  184. "generate": "expression",
  185. "from": "[a-zA-Z0-9]{16}",
  186. "required": true
  187. },
  188. {
  189. "name": "REDIS_VERSION",
  190. "displayName": "Version of Redis Image",
  191. "description": "Version of Redis image to be used (3.2 or latest).",
  192. "value": "3.2",
  193. "required": true
  194. }
  195. ]
  196. }