redis-persistent-template.json 7.0 KB

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