redis-persistent-template.json 7.3 KB

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