Skip to content

Commit 336f736

Browse files
authored
Additional redis configuration options (#134)
1 parent 69df639 commit 336f736

11 files changed

+194
-1
lines changed

templates/_helpers.tpl

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,36 @@ Get the redis secret.
171171
{{- end -}}
172172
{{- end -}}
173173

174+
{{/*
175+
Get the redis secret (sidekiq).
176+
*/}}
177+
{{- define "mastodon.redis.sidekiq.secretName" -}}
178+
{{- if .Values.redis.sidekiq.auth.existingSecret }}
179+
{{- printf "%s" (tpl .Values.redis.sidekiq.auth.existingSecret $) -}}
180+
{{- else if .Values.redis.auth.existingSecret }}
181+
{{- printf "%s" (tpl .Values.redis.auth.existingSecret $) -}}
182+
{{- else if .Values.redis.existingSecret }}
183+
{{- printf "%s" (tpl .Values.redis.existingSecret $) -}}
184+
{{- else -}}
185+
{{- printf "%s-redis" (tpl .Release.Name $) -}}
186+
{{- end -}}
187+
{{- end -}}
188+
189+
{{/*
190+
Get the redis secret (cache).
191+
*/}}
192+
{{- define "mastodon.redis.cache.secretName" -}}
193+
{{- if .Values.redis.cache.auth.existingSecret }}
194+
{{- printf "%s" (tpl .Values.redis.cache.auth.existingSecret $) -}}
195+
{{- else if .Values.redis.auth.existingSecret }}
196+
{{- printf "%s" (tpl .Values.redis.auth.existingSecret $) -}}
197+
{{- else if .Values.redis.existingSecret }}
198+
{{- printf "%s" (tpl .Values.redis.existingSecret $) -}}
199+
{{- else -}}
200+
{{- printf "%s-redis" (tpl .Release.Name $) -}}
201+
{{- end -}}
202+
{{- end -}}
203+
174204
{{/*
175205
Return true if a mastodon secret object should be created
176206
*/}}

templates/configmap-env.yaml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,30 @@ data:
7272
REDIS_HOST: {{ required "When the redis chart is disabled .Values.redis.hostname is required" .Values.redis.hostname }}
7373
{{- end }}
7474
REDIS_PORT: {{ .Values.redis.port | default "6379" | quote }}
75+
{{- if .Values.redis.sidekiq.enabled }}
76+
{{- if .Values.redis.sidekiq.hostname }}
77+
SIDEKIQ_REDIS_HOST: {{ .Values.redis.sidekiq.hostname }}
78+
{{- else }}
79+
SIDEKIQ_REDIS_HOST: {{ .Values.redis.hostname }}
80+
{{- end }}
81+
{{- if .Values.redis.sidekiq.port }}
82+
SIDEKIQ_REDIS_PORT: {{ .Values.redis.sidekiq.port | quote }}
83+
{{- else }}
84+
SIDEKIQ_REDIS_PORT: {{ .Values.redis.port | default "6379" | quote }}
85+
{{- end }}
86+
{{- end }}
87+
{{- if .Values.redis.cache.enabled }}
88+
{{- if .Values.redis.cache.hostname }}
89+
CACHE_REDIS_HOST: {{ .Values.redis.cache.hostname }}
90+
{{- else }}
91+
CACHE_REDIS_HOST: {{ .Values.redis.hostname}}
92+
{{- end }}
93+
{{- if .Values.redis.cache.port }}
94+
CACHE_REDIS_PORT: {{ .Values.redis.cache.port | quote }}
95+
{{- else }}
96+
CACHE_REDIS_PORT: {{ .Values.redis.port | default "6379" | quote }}
97+
{{- end }}
98+
{{- end }}
7599
{{- if .Values.mastodon.s3.enabled }}
76100
S3_BUCKET: {{ .Values.mastodon.s3.bucket }}
77101
S3_ENABLED: "true"
@@ -389,4 +413,3 @@ data:
389413
{{- with .Values.timezone }}
390414
TZ: {{ . | quote }}
391415
{{- end }}
392-

templates/cronjob-media-remove.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,20 @@ spec:
6565
secretKeyRef:
6666
name: {{ template "mastodon.redis.secretName" . }}
6767
key: redis-password
68+
{{- if and .Values.redis.sidekiq.enabled .Values.redis.sidekiq.auth.existingSecret }}
69+
- name: "SIDEKIQ_REDIS_PASSWORD"
70+
valueFrom:
71+
secretKeyRef:
72+
name: {{ template "mastodon.redis.sidekiq.secretName" . }}
73+
key: redis-password
74+
{{- end }}
75+
{{- if and .Values.redis.cache.enabled .Values.redis.cache.auth.existingSecret }}
76+
- name: "CACHE_REDIS_PASSWORD"
77+
valueFrom:
78+
secretKeyRef:
79+
name: {{ template "mastodon.redis.cache.secretName" . }}
80+
key: redis-password
81+
{{- end }}
6882
{{- if and .Values.elasticsearch.existingSecret (or .Values.elasticsearch.enabled .Values.elasticsearch.hostname) }}
6983
- name: "ES_PASS"
7084
valueFrom:

templates/deployment-sidekiq.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,20 @@ spec:
126126
secretKeyRef:
127127
name: {{ template "mastodon.redis.secretName" $context }}
128128
key: redis-password
129+
{{- if and $context.Values.redis.sidekiq.enabled $context.Values.redis.sidekiq.auth.existingSecret }}
130+
- name: "SIDEKIQ_REDIS_PASSWORD"
131+
valueFrom:
132+
secretKeyRef:
133+
name: {{ template "mastodon.redis.sidekiq.secretName" $context }}
134+
key: redis-password
135+
{{- end }}
136+
{{- if and $context.Values.redis.cache.enabled $context.Values.redis.cache.auth.existingSecret }}
137+
- name: "CACHE_REDIS_PASSWORD"
138+
valueFrom:
139+
secretKeyRef:
140+
name: {{ template "mastodon.redis.cache.secretName" $context }}
141+
key: redis-password
142+
{{- end }}
129143
{{- if and $context.Values.elasticsearch.existingSecret (or $context.Values.elasticsearch.enabled $context.Values.elasticsearch.hostname) }}
130144
- name: "ES_PASS"
131145
valueFrom:

templates/deployment-streaming.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,20 @@ spec:
103103
secretKeyRef:
104104
name: {{ template "mastodon.redis.secretName" . }}
105105
key: redis-password
106+
{{- if and .Values.redis.sidekiq.enabled .Values.redis.sidekiq.auth.existingSecret }}
107+
- name: "SIDEKIQ_REDIS_PASSWORD"
108+
valueFrom:
109+
secretKeyRef:
110+
name: {{ template "mastodon.redis.sidekiq.secretName" . }}
111+
key: redis-password
112+
{{- end }}
113+
{{- if and .Values.redis.cache.enabled .Values.redis.cache.auth.existingSecret }}
114+
- name: "CACHE_REDIS_PASSWORD"
115+
valueFrom:
116+
secretKeyRef:
117+
name: {{ template "mastodon.redis.cache.secretName" . }}
118+
key: redis-password
119+
{{- end }}
106120
- name: "PORT"
107121
value: {{ .Values.mastodon.streaming.port | quote }}
108122
ports:

templates/deployment-web.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,20 @@ spec:
101101
secretKeyRef:
102102
name: {{ template "mastodon.redis.secretName" . }}
103103
key: redis-password
104+
{{- if and .Values.redis.sidekiq.enabled .Values.redis.sidekiq.auth.existingSecret }}
105+
- name: "SIDEKIQ_REDIS_PASSWORD"
106+
valueFrom:
107+
secretKeyRef:
108+
name: {{ template "mastodon.redis.sidekiq.secretName" . }}
109+
key: redis-password
110+
{{- end }}
111+
{{- if and .Values.redis.cache.enabled .Values.redis.cache.auth.existingSecret }}
112+
- name: "CACHE_REDIS_PASSWORD"
113+
valueFrom:
114+
secretKeyRef:
115+
name: {{ template "mastodon.redis.cache.secretName" . }}
116+
key: redis-password
117+
{{- end }}
104118
{{- if and .Values.elasticsearch.existingSecret (or .Values.elasticsearch.enabled .Values.elasticsearch.hostname) }}
105119
- name: "ES_PASS"
106120
valueFrom:

templates/job-assets-precompile.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,20 @@ spec:
6767
secretKeyRef:
6868
name: {{ template "mastodon.redis.secretName" . }}
6969
key: redis-password
70+
{{- if and .Values.redis.sidekiq.enabled .Values.redis.sidekiq.auth.existingSecret }}
71+
- name: "SIDEKIQ_REDIS_PASSWORD"
72+
valueFrom:
73+
secretKeyRef:
74+
name: {{ template "mastodon.redis.sidekiq.secretName" . }}
75+
key: redis-password
76+
{{- end }}
77+
{{- if and .Values.redis.cache.enabled .Values.redis.cache.auth.existingSecret }}
78+
- name: "CACHE_REDIS_PASSWORD"
79+
valueFrom:
80+
secretKeyRef:
81+
name: {{ template "mastodon.redis.cache.secretName" . }}
82+
key: redis-password
83+
{{- end }}
7084
- name: "PORT"
7185
value: {{ .Values.mastodon.web.port | quote }}
7286
{{- if (not .Values.mastodon.s3.enabled) }}

templates/job-chewy-upgrade.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,20 @@ spec:
6767
secretKeyRef:
6868
name: {{ template "mastodon.redis.secretName" . }}
6969
key: redis-password
70+
{{- if and .Values.redis.sidekiq.enabled .Values.redis.sidekiq.auth.existingSecret }}
71+
- name: "SIDEKIQ_REDIS_PASSWORD"
72+
valueFrom:
73+
secretKeyRef:
74+
name: {{ template "mastodon.redis.sidekiq.secretName" . }}
75+
key: redis-password
76+
{{- end }}
77+
{{- if and .Values.redis.cache.enabled .Values.redis.cache.auth.existingSecret }}
78+
- name: "CACHE_REDIS_PASSWORD"
79+
valueFrom:
80+
secretKeyRef:
81+
name: {{ template "mastodon.redis.cache.secretName" . }}
82+
key: redis-password
83+
{{- end }}
7084
{{- if and .Values.elasticsearch.existingSecret (or .Values.elasticsearch.enabled .Values.elasticsearch.hostname) }}
7185
- name: "ES_PASS"
7286
valueFrom:

templates/job-create-admin.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,20 @@ spec:
7272
secretKeyRef:
7373
name: {{ template "mastodon.redis.secretName" . }}
7474
key: redis-password
75+
{{- if and .Values.redis.sidekiq.enabled .Values.redis.sidekiq.auth.existingSecret }}
76+
- name: "SIDEKIQ_REDIS_PASSWORD"
77+
valueFrom:
78+
secretKeyRef:
79+
name: {{ template "mastodon.redis.sidekiq.secretName" . }}
80+
key: redis-password
81+
{{- end }}
82+
{{- if and .Values.redis.cache.enabled .Values.redis.cache.auth.existingSecret }}
83+
- name: "CACHE_REDIS_PASSWORD"
84+
valueFrom:
85+
secretKeyRef:
86+
name: {{ template "mastodon.redis.cache.secretName" . }}
87+
key: redis-password
88+
{{- end }}
7589
- name: "PORT"
7690
value: {{ .Values.mastodon.web.port | quote }}
7791
{{- if (not .Values.mastodon.s3.enabled) }}

templates/job-db-migrate.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,20 @@ spec:
6767
secretKeyRef:
6868
name: {{ template "mastodon.redis.secretName" . }}
6969
key: redis-password
70+
{{- if and .Values.redis.sidekiq.enabled .Values.redis.sidekiq.auth.existingSecret }}
71+
- name: "SIDEKIQ_REDIS_PASSWORD"
72+
valueFrom:
73+
secretKeyRef:
74+
name: {{ template "mastodon.redis.sidekiq.secretName" . }}
75+
key: redis-password
76+
{{- end }}
77+
{{- if and .Values.redis.cache.enabled .Values.redis.cache.auth.existingSecret }}
78+
- name: "CACHE_REDIS_PASSWORD"
79+
valueFrom:
80+
secretKeyRef:
81+
name: {{ template "mastodon.redis.cache.secretName" . }}
82+
key: redis-password
83+
{{- end }}
7084
- name: "PORT"
7185
value: {{ .Values.mastodon.web.port | quote }}
7286
{{- if (not .Values.mastodon.s3.enabled) }}

0 commit comments

Comments
 (0)