_redis.tpl 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. {{- define "redis.workload" -}}
  2. workload:
  3. redis:
  4. enabled: true
  5. primary: true
  6. type: Deployment
  7. podSpec:
  8. hostNetwork: {{ .Values.redisNetwork.hostNetwork }}
  9. securityContext:
  10. fsGroup: 1001
  11. containers:
  12. redis:
  13. enabled: true
  14. primary: true
  15. imageSelector: image
  16. securityContext:
  17. runAsUser: 1001
  18. runAsGroup: 0
  19. runAsNonRoot: false
  20. readOnlyRootFilesystem: false
  21. envFrom:
  22. - configMapRef:
  23. name: config
  24. {{ with .Values.redisConfig.additionalEnvs }}
  25. envList:
  26. {{ range $env := . }}
  27. - name: {{ $env.name }}
  28. value: {{ $env.value }}
  29. {{ end }}
  30. {{ end }}
  31. probes:
  32. {{ $args := printf "-p %v" .Values.redisNetwork.redisPort }}
  33. {{ if not .Values.redisConfig.allowEmptyPassword }}
  34. {{ $args = printf "%v -a %v" $args .Values.redisConfig.password }}
  35. {{ end }}
  36. liveness:
  37. enabled: true
  38. type: exec
  39. command:
  40. - /bin/sh
  41. - -c
  42. - |
  43. redis-cli {{ $args }} ping | grep -q PONG
  44. readiness:
  45. enabled: true
  46. type: exec
  47. command:
  48. - /bin/sh
  49. - -c
  50. - |
  51. redis-cli {{ $args }} ping | grep -q PONG
  52. startup:
  53. enabled: true
  54. type: exec
  55. command:
  56. - /bin/sh
  57. - -c
  58. - |
  59. redis-cli {{ $args }} ping | grep -q PONG
  60. initContainers:
  61. {{- include "ix.v1.common.app.permissions" (dict "containerName" "01-permissions"
  62. "UID" 1001
  63. "GID" 1001
  64. "mode" "check"
  65. "type" "init") | nindent 8 }}
  66. {{/* Service */}}
  67. service:
  68. redis:
  69. enabled: true
  70. primary: true
  71. type: NodePort
  72. targetSelector: redis
  73. ports:
  74. redis:
  75. enabled: true
  76. primary: true
  77. port: {{ .Values.redisNetwork.redisPort }}
  78. nodePort: {{ .Values.redisNetwork.redisPort }}
  79. targetSelector: redis
  80. {{/* Persistence */}}
  81. persistence:
  82. data:
  83. enabled: true
  84. type: {{ .Values.redisStorage.data.type }}
  85. datasetName: {{ .Values.redisStorage.data.datasetName | default "" }}
  86. hostPath: {{ .Values.redisStorage.data.hostPath | default "" }}
  87. targetSelector:
  88. redis:
  89. redis:
  90. mountPath: /bitnami/redis/data
  91. 01-permissions:
  92. mountPath: /mnt/directories/data
  93. tmp:
  94. enabled: true
  95. type: emptyDir
  96. targetSelector:
  97. redis:
  98. redis:
  99. mountPath: /tmp
  100. {{- end -}}