redis-ephemeral-template.json 5.6 KB

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