Skip to content

Commit 1654d57

Browse files
committed
Provide the option to not define REDIS_CACHE_ENDPOINT or REDIS_STORE_ENDPOINT env vars at all, if they're not using k8s secrets, and need to inject custom endpoints (ex. external Redis, with creds in endpoint string) as env vars by their own external means
1 parent 776f4ac commit 1654d57

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

charts/sourcegraph/templates/_helpers.tpl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,12 +248,24 @@ app.kubernetes.io/name: jaeger
248248
value: "localhost:$(DATA_SOURCE_PORT)/$(DATA_SOURCE_DB)?sslmode=disable"
249249
{{- end }}
250250

251+
{{/*
252+
Set redisCache and redisStore endpoints
253+
So that customers can configure them any of these ways:
254+
1. Create a new Kubernetes secret, with default values (default, no override config required)
255+
2. Use an existing Kubernetes secret, by configuring .Values.redisCache.connection.existingSecret
256+
3. Do not create or use Kubernetes secrets, just pass the default values directly as environment variables into the needed pods, by configuring .Values.sourcegraph.disableKubernetesSecrets = true
257+
4. Do not create or use Kubernetes secrets, but pass custom values (ex. external Redis) directly as environment variables into the needed pods, by configuring .Values.sourcegraph.disableKubernetesSecrets = true, .Values.redisCache.connection.endpoint = "", .Values.redisStore.connection.endpoint = "", and defining the REDIS_CACHE_ENDPOINT and REDIS_STORE_ENDPOINT env vars on frontend, gitserver, searcher, and worker pods
258+
*/}}
251259
{{- define "sourcegraph.redisConnection" -}}
252260
{{- if .Values.sourcegraph.disableKubernetesSecrets -}}
261+
{{- if .Values.redisCache.connection.endpoint -}}
253262
- name: REDIS_CACHE_ENDPOINT
254263
value: {{ .Values.redisCache.connection.endpoint }}
264+
{{- end -}}
265+
{{- if .Values.redisStore.connection.endpoint -}}
255266
- name: REDIS_STORE_ENDPOINT
256267
value: {{ .Values.redisStore.connection.endpoint }}
268+
{{- end -}}
257269
{{- else -}}
258270
- name: REDIS_CACHE_ENDPOINT
259271
valueFrom:

0 commit comments

Comments
 (0)