redis-persistent-template.json 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. {
  2. "kind": "Template",
  3. "apiVersion": "v1",
  4. "metadata": {
  5. "name": "redis-persistent",
  6. "creationTimestamp": null,
  7. "annotations": {
  8. "openshift.io/display-name": "Redis (Persistent)",
  9. "description": "Redis in-memory data structure store, with persistent storage. For more information about using this template, including OpenShift considerations, see https://github.com/sclorg/redis-container/blob/master/3.2.\n\nNOTE: You must have persistent volumes available in your cluster to use this template.",
  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-persistent-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": "PersistentVolumeClaim",
  48. "apiVersion": "v1",
  49. "metadata": {
  50. "name": "${DATABASE_SERVICE_NAME}"
  51. },
  52. "spec": {
  53. "accessModes": [
  54. "ReadWriteOnce"
  55. ],
  56. "resources": {
  57. "requests": {
  58. "storage": "${VOLUME_CAPACITY}"
  59. }
  60. }
  61. }
  62. },
  63. {
  64. "kind": "DeploymentConfig",
  65. "apiVersion": "v1",
  66. "metadata": {
  67. "name": "${DATABASE_SERVICE_NAME}",
  68. "creationTimestamp": null
  69. },
  70. "spec": {
  71. "strategy": {
  72. "type": "Recreate"
  73. },
  74. "triggers": [
  75. {
  76. "type": "ImageChange",
  77. "imageChangeParams": {
  78. "automatic": true,
  79. "containerNames": [
  80. "redis"
  81. ],
  82. "from": {
  83. "kind": "ImageStreamTag",
  84. "name": "redis:${REDIS_VERSION}",
  85. "namespace": "${NAMESPACE}"
  86. },
  87. "lastTriggeredImage": ""
  88. }
  89. },
  90. {
  91. "type": "ConfigChange"
  92. }
  93. ],
  94. "replicas": 1,
  95. "selector": {
  96. "name": "${DATABASE_SERVICE_NAME}"
  97. },
  98. "template": {
  99. "metadata": {
  100. "creationTimestamp": null,
  101. "labels": {
  102. "name": "${DATABASE_SERVICE_NAME}"
  103. }
  104. },
  105. "spec": {
  106. "containers": [
  107. {
  108. "name": "redis",
  109. "image": " ",
  110. "ports": [
  111. {
  112. "containerPort": 6379,
  113. "protocol": "TCP"
  114. }
  115. ],
  116. "readinessProbe": {
  117. "timeoutSeconds": 1,
  118. "initialDelaySeconds": 5,
  119. "exec": {
  120. "command": [ "/bin/sh", "-i", "-c", "test \"$(redis-cli -h 127.0.0.1 -a $REDIS_PASSWORD ping)\" == \"PONG\""]
  121. }
  122. },
  123. "livenessProbe": {
  124. "timeoutSeconds": 1,
  125. "initialDelaySeconds": 30,
  126. "tcpSocket": {
  127. "port": 6379
  128. }
  129. },
  130. "env": [
  131. {
  132. "name": "REDIS_PASSWORD",
  133. "value": "${REDIS_PASSWORD}"
  134. }
  135. ],
  136. "resources": {
  137. "limits": {
  138. "memory": "${MEMORY_LIMIT}"
  139. }
  140. },
  141. "volumeMounts": [
  142. {
  143. "name": "${DATABASE_SERVICE_NAME}-data",
  144. "mountPath": "/var/lib/redis/data"
  145. }
  146. ],
  147. "terminationMessagePath": "/dev/termination-log",
  148. "imagePullPolicy": "IfNotPresent",
  149. "capabilities": {},
  150. "securityContext": {
  151. "capabilities": {},
  152. "privileged": false
  153. }
  154. }
  155. ],
  156. "volumes": [
  157. {
  158. "name": "${DATABASE_SERVICE_NAME}-data",
  159. "persistentVolumeClaim": {
  160. "claimName": "${DATABASE_SERVICE_NAME}"
  161. }
  162. }
  163. ],
  164. "restartPolicy": "Always",
  165. "dnsPolicy": "ClusterFirst"
  166. }
  167. }
  168. },
  169. "status": {}
  170. }
  171. ],
  172. "parameters": [
  173. {
  174. "name": "MEMORY_LIMIT",
  175. "displayName": "Memory Limit",
  176. "description": "Maximum amount of memory the container can use.",
  177. "value": "512Mi"
  178. },
  179. {
  180. "name": "NAMESPACE",
  181. "displayName": "Namespace",
  182. "description": "The OpenShift Namespace where the ImageStream resides.",
  183. "value": "openshift"
  184. },
  185. {
  186. "name": "DATABASE_SERVICE_NAME",
  187. "displayName": "Database Service Name",
  188. "description": "The name of the OpenShift Service exposed for the database.",
  189. "value": "redis",
  190. "required": true
  191. },
  192. {
  193. "name": "REDIS_PASSWORD",
  194. "displayName": "Redis Connection Password",
  195. "description": "Password for the Redis connection user.",
  196. "generate": "expression",
  197. "from": "[a-zA-Z0-9]{16}",
  198. "required": true
  199. },
  200. {
  201. "name": "VOLUME_CAPACITY",
  202. "displayName": "Volume Capacity",
  203. "description": "Volume space available for data, e.g. 512Mi, 2Gi.",
  204. "value": "1Gi",
  205. "required": true
  206. },
  207. {
  208. "name": "REDIS_VERSION",
  209. "displayName": "Version of Redis Image",
  210. "description": "Version of Redis image to be used (3.2 or latest).",
  211. "value": "3.2",
  212. "required": true
  213. }
  214. ]
  215. }