|
1 | 1 | {{- if and (or .Values.etrip.use_redis .Values.etripng.enabled) (eq .Values.etrip.redis_flavour "vanilla") -}} |
| 2 | +{{/* The config file, if required */}} |
| 3 | +{{- if .Values.redis.config }} |
| 4 | +apiVersion: v1 |
| 5 | +kind: ConfigMap |
| 6 | +metadata: |
| 7 | + name: {{ .Release.Name }}-redis-config |
| 8 | + namespace: {{ .Release.Namespace }} |
| 9 | + labels: |
| 10 | + {{- include "labels" . | nindent 4 }} |
| 11 | + app.kubernetes.io/component: redis |
| 12 | +data: |
| 13 | + redis.conf: |- |
| 14 | + {{- range $key, $value := .Values.redis.config }} |
| 15 | + {{ $key }} {{ $value }} |
| 16 | + {{- end }} |
| 17 | +--- |
| 18 | +{{- end }} |
| 19 | +{{/* The deployment */}} |
2 | 20 | apiVersion: apps/v1 |
3 | 21 | kind: Deployment |
4 | 22 | metadata: |
|
33 | 51 | command: |
34 | 52 | - /bin/sh |
35 | 53 | - -c |
36 | | - - redis-server --bind 0.0.0.0 --requirepass $REDISCLI_AUTH {{ range $key, $value := .Values.redis.config }}--{{ $key }} {{ $value | quote }} {{ end }} |
| 54 | + - redis-server --bind 0.0.0.0 --requirepass $REDISCLI_AUTH {{ if .Values.redis.config }}/etc/redis/redis.conf{{ end }} |
37 | 55 | image: {{ .Values.redis.image.name }}:{{ .Values.redis.image.tag }} |
38 | 56 | imagePullPolicy: {{ .Values.redis.image.pullPolicy }} |
39 | 57 | env: |
|
48 | 66 | protocol: TCP |
49 | 67 | resources: |
50 | 68 | {{- toYaml .Values.resources.redis | nindent 10 }} |
| 69 | + # we mount the config file |
| 70 | + {{- if .Values.redis.config }} |
| 71 | + volumeMounts: |
| 72 | + - name: redis-config |
| 73 | + mountPath: /etc/redis |
| 74 | + readOnly: true |
| 75 | + {{- end }} |
51 | 76 | {{- /* monitoring sidecar */}} |
52 | 77 | {{- if .Values.redis.monitoring.enabled }} |
53 | 78 | - name: redis-exporter |
|
66 | 91 | resources: |
67 | 92 | {{- toYaml .Values.resources.redis_monitor | nindent 10 }} |
68 | 93 | {{- end }} |
| 94 | + {{- if .Values.redis.config }} |
| 95 | + volumes: |
| 96 | + - name: redis-config |
| 97 | + configMap: |
| 98 | + name: {{ .Release.Name }}-redis-config |
| 99 | + {{- end }} |
69 | 100 | --- |
70 | | -# podMonitor |
| 101 | +{{/* The PodMonitor for Redis monitoring */}} |
71 | 102 | {{- if .Values.redis.monitoring.enabled }} |
72 | 103 | apiVersion: monitoring.coreos.com/v1 |
73 | 104 | kind: PodMonitor |
|
89 | 120 | app.kubernetes.io/component: redis |
90 | 121 | {{- end }} |
91 | 122 | --- |
| 123 | +{{/* The Service for Redis */}} |
92 | 124 | apiVersion: v1 |
93 | 125 | kind: Service |
94 | 126 | metadata: |
|
0 commit comments