redis-persistent-template.json 6.6 KB

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