redis-ephemeral-template.json 6.5 KB

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