diff --git a/charts/sourcegraph/CHANGELOG.md b/charts/sourcegraph/CHANGELOG.md index 55172c8c5..e01868129 100644 --- a/charts/sourcegraph/CHANGELOG.md +++ b/charts/sourcegraph/CHANGELOG.md @@ -8,6 +8,8 @@ Use `**BREAKING**:` to denote a breaking change ## Unreleased +- Added opt-in Redis config management through `redisCache.config.enabled` and `redisStore.config.enabled` (both default to `false`). Default deployments retain their image configs, custom mounts, authentication, and memory settings. When enabled, the chart mounts `/etc/redis/redis.conf` and supports `existingConfig`, `maxmemory`, `maxmemoryRatio`, `maxmemoryPolicy`, and `additionalConfig`. See [Enabling Redis config management](README.md#enabling-redis-config-management) before opting in, especially when using custom images or Secret-mounted configs. +- With Redis config management enabled, the chart sizes `maxmemory` at 75% of `resources.limits.memory` to leave room for overhead; this reduces, but does not eliminate, OOM risk. Ratios must be greater than 0 and less than 1. Auto-sizing is skipped in local development mode or when the limit is absent or unrecognised. At the default 7Gi limit, opting in lowers the effective cap from 6GiB to 5.25GiB: `redis-cache` evicts earlier, but `redis-store` uses `noeviction`, so its write-error ceiling drops too. Set `redisStore.config.maxmemory: 6gb` to keep the old ceiling if the pod has sufficient memory. - Added a `network-policy` example, which limits Executor and Executor job pods to the frontend API - Corrected the external object storage examples to configure the shared store for frontend, worker, precise code intel, syntactic code intel, gitserver, and searcher, including credentials or workload service accounts as required. - Removed the unused application ports from the precise and syntactic code intel worker Deployments and Services; health checks and Prometheus metrics continue to use the debug server on port 6060. diff --git a/charts/sourcegraph/README.md b/charts/sourcegraph/README.md index 028cfd3fd..0f22286af 100644 --- a/charts/sourcegraph/README.md +++ b/charts/sourcegraph/README.md @@ -7,6 +7,62 @@ Visit the [Helm docs](https://docs.sourcegraph.com/admin/install/kubernetes) for guidance on using this chart. +## Enabling Redis config management + +Redis config management is **disabled by default**. Upgrading the chart preserves +existing image configs, custom mounts, authentication, and memory settings. +The standard images retain their 6GiB cap, which can cause OOM kills if the pod +memory limit is lower. Opt in for either service independently, or both: + +```yaml +redisCache: + config: + enabled: true +redisStore: + config: + enabled: true +``` + +For each enabled service, the chart mounts `/etc/redis/redis.conf` and sizes +`maxmemory` to 75% of the container's memory limit. At the default 7Gi limit, +opting in changes the cap from 6GiB to 5.25GiB. `redis-cache` evicts earlier; +`redis-store` keeps `noeviction` and rejects writes sooner when full. Set +`redisStore.config.maxmemory: 6gb` to retain its old cap, provided the pod has +enough memory for Redis overhead. Auto-sizing reserves headroom but cannot +guarantee against OOM kills, particularly during persistence operations. + +Before opting in: + +- **Custom images:** the mounted config replaces the image's config, including + any `requirepass`, ACL, TLS, or persistence settings. Leave + `redisCache.config.enabled: false` and/or `redisStore.config.enabled: false` + to preserve the corresponding image config. Otherwise, migrate those settings + explicitly; image-baked authentication is not inherited. +- **Existing config mounts:** either leave config management disabled and + keep your `extraVolumes` / `extraVolumeMounts`, or remove those mounts and set + `config.enabled: true` and `config.existingConfig` to the name of a ConfigMap + with a complete `redis.conf` key. An existing ConfigMap bypasses all chart + sizing and directive overrides. +- **Secrets:** both `additionalConfig` and `existingConfig` use plaintext + ConfigMaps. For a config containing credentials, leave config management disabled + and mount a Secret at `/etc/redis/redis.conf` with `extraVolumeMounts` instead. + Configure the clients' `connection.existingSecret` and the exporter's + `redisExporter.env.REDIS_PASSWORD.valueFrom.secretKeyRef` as appropriate. + Redis readiness alone does not verify exporter authentication; check `redis_up`. + +While config management is disabled, all other `config` options are ignored, +including auto-sizing, so you must size Redis memory yourself. With management enabled, +an explicit `config.maxmemory` takes precedence over auto-sizing, and +`additionalConfig` is appended last. Supported memory limits are plain byte +counts or numbers with `k`, `M`, `G`, `T`, `P`, `E`, `Ki`, `Mi`, `Gi`, `Ti`, +`Pi`, or `Ei` suffixes. If the limit is absent or unrecognised, or +`sourcegraph.localDevMode` is enabled, the vendored 6gb default remains unless +overridden explicitly. + +Chart-managed config changes restart the Redis pod through a checksum +annotation. Changes to an existing ConfigMap or Secret require a manual pod +restart because `subPath` mounts do not update in running containers. + ## Configuration Options Reference the below chart for all available configuration parameters. @@ -301,6 +357,12 @@ In addition to the documented values, all services also support the following va | prometheus.storageAnnotations | object | `{}` | Optional annotations to add to the `prometheus` PVC | | prometheus.storageSize | string | `"200Gi"` | PVC Storage Request for `prometheus` data volume | | prometheus.storageSubPath | string | `""` | Optional subPath for the `prometheus` primary data volume mount | +| redisCache.config.additionalConfig | string | `""` | Additional raw redis directives appended to the vendored `redis-cache` config. Notes: This is expecting a multiline string. It renders into a ConfigMap in plaintext, so do not put secrets such as `requirepass` here or in `existingConfig` (also a ConfigMap). For secrets, set `config.enabled: false` and mount a Secret using `extraVolumeMounts`. | +| redisCache.config.enabled | bool | `false` | Opt in to a chart-managed Redis config and automatic memory sizing. Disabled by default to preserve image-baked configuration and custom `extraVolumeMounts` (including Secret mounts). When false, all other `config` options are ignored and auto-sizing is disabled. | +| redisCache.config.existingConfig | string | `""` | Name of an existing ConfigMap for `redis-cache`. It must contain a `redis.conf` key. When set, the chart-managed ConfigMap is not rendered and this one is mounted instead, so the chart no longer sizes `maxmemory`. Mutually exclusive with `additionalConfig`. | +| redisCache.config.maxmemory | string | `""` | Explicit redis `maxmemory` for `redis-cache` (for example `6gb`). Overrides the auto-computed value. Empty means compute it from the container memory limit. | +| redisCache.config.maxmemoryPolicy | string | `""` | Override the redis `maxmemory-policy` for `redis-cache`. Empty keeps the vendored default (`allkeys-lru`). | +| redisCache.config.maxmemoryRatio | float | `0.75` | Fraction of `redisCache.resources.limits.memory` used for `maxmemory` when `maxmemory` is empty. Must be greater than 0 and less than 1. Ignored when no memory limit is set or `sourcegraph.localDevMode` is enabled. An absent or unrecognised limit keeps the vendored 6gb default; use an explicit maxmemory if needed. | | redisCache.connection.endpoint | string | `"redis-cache:6379"` | Endpoint to use for redis-cache. Supports either host:port or IANA specification | | redisCache.connection.existingSecret | string | `""` | Name of existing secret to use for Redis endpoint The secret must contain the key `endpoint` and should follow IANA specification learn more from the [Helm docs](https://docs.sourcegraph.com/admin/install/kubernetes/helm#using-external-redis-instances) | | redisCache.containerSecurityContext | object | `{"allowPrivilegeEscalation":false,"readOnlyRootFilesystem":true,"runAsGroup":1000,"runAsUser":999}` | Security context for the `redis-cache` container, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container) | @@ -320,6 +382,12 @@ In addition to the documented values, all services also support the following va | redisExporter.image.defaultTag | string | `"6.0.0@sha256:b2ec48fc6adef31f36d525170138dec303c1c0c20c530d659f1fb7c6c54698af"` | Docker image tag for the `redis-exporter` image | | redisExporter.image.name | string | `"redis_exporter"` | Docker image name for the `redis-exporter` image | | redisExporter.resources | object | `{"limits":{"cpu":"10m","memory":"100Mi"},"requests":{"cpu":"10m","memory":"100Mi"}}` | Resource requests & limits for the `redis-exporter` sidecar container, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) | +| redisStore.config.additionalConfig | string | `""` | Additional raw redis directives appended to the vendored `redis-store` config. Notes: This is expecting a multiline string. It renders into a ConfigMap in plaintext, so do not put secrets such as `requirepass` here or in `existingConfig` (also a ConfigMap). For secrets, set `config.enabled: false` and mount a Secret using `extraVolumeMounts`. | +| redisStore.config.enabled | bool | `false` | Opt in to a chart-managed Redis config and automatic memory sizing. Disabled by default to preserve image-baked configuration and custom `extraVolumeMounts` (including Secret mounts). When false, all other `config` options are ignored and auto-sizing is disabled. | +| redisStore.config.existingConfig | string | `""` | Name of an existing ConfigMap for `redis-store`. It must contain a `redis.conf` key. When set, the chart-managed ConfigMap is not rendered and this one is mounted instead, so the chart no longer sizes `maxmemory`. Mutually exclusive with `additionalConfig`. | +| redisStore.config.maxmemory | string | `""` | Explicit redis `maxmemory` for `redis-store` (for example `6gb`). Overrides the auto-computed value. Empty means compute it from the container memory limit. | +| redisStore.config.maxmemoryPolicy | string | `""` | Override the redis `maxmemory-policy` for `redis-store`. Empty keeps the vendored default (`noeviction`). | +| redisStore.config.maxmemoryRatio | float | `0.75` | Fraction of `redisStore.resources.limits.memory` used for `maxmemory` when `maxmemory` is empty. Must be greater than 0 and less than 1. Ignored when no memory limit is set or `sourcegraph.localDevMode` is enabled. An absent or unrecognised limit keeps the vendored 6gb default; use an explicit maxmemory if needed. | | redisStore.connection.endpoint | string | `"redis-store:6379"` | Endpoint to use for redis-store. Supports either host:port or IANA specification | | redisStore.connection.existingSecret | string | `""` | Name of existing secret to use for Redis endpoint The secret must contain the key `endpoint` and should follow IANA specification learn more from the [Helm docs](https://docs.sourcegraph.com/admin/install/kubernetes/helm#using-external-redis-instances) | | redisStore.containerSecurityContext | object | `{"allowPrivilegeEscalation":false,"readOnlyRootFilesystem":true,"runAsGroup":1000,"runAsUser":999}` | Security context for the `redis-store` container, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container) | diff --git a/charts/sourcegraph/README.md.gotmpl b/charts/sourcegraph/README.md.gotmpl index 06ed43c99..b2fb8bba1 100644 --- a/charts/sourcegraph/README.md.gotmpl +++ b/charts/sourcegraph/README.md.gotmpl @@ -7,6 +7,62 @@ Visit the [Helm docs](https://docs.sourcegraph.com/admin/install/kubernetes) for guidance on using this chart. +## Enabling Redis config management + +Redis config management is **disabled by default**. Upgrading the chart preserves +existing image configs, custom mounts, authentication, and memory settings. +The standard images retain their 6GiB cap, which can cause OOM kills if the pod +memory limit is lower. Opt in for either service independently, or both: + +```yaml +redisCache: + config: + enabled: true +redisStore: + config: + enabled: true +``` + +For each enabled service, the chart mounts `/etc/redis/redis.conf` and sizes +`maxmemory` to 75% of the container's memory limit. At the default 7Gi limit, +opting in changes the cap from 6GiB to 5.25GiB. `redis-cache` evicts earlier; +`redis-store` keeps `noeviction` and rejects writes sooner when full. Set +`redisStore.config.maxmemory: 6gb` to retain its old cap, provided the pod has +enough memory for Redis overhead. Auto-sizing reserves headroom but cannot +guarantee against OOM kills, particularly during persistence operations. + +Before opting in: + +- **Custom images:** the mounted config replaces the image's config, including + any `requirepass`, ACL, TLS, or persistence settings. Leave + `redisCache.config.enabled: false` and/or `redisStore.config.enabled: false` + to preserve the corresponding image config. Otherwise, migrate those settings + explicitly; image-baked authentication is not inherited. +- **Existing config mounts:** either leave config management disabled and + keep your `extraVolumes` / `extraVolumeMounts`, or remove those mounts and set + `config.enabled: true` and `config.existingConfig` to the name of a ConfigMap + with a complete `redis.conf` key. An existing ConfigMap bypasses all chart + sizing and directive overrides. +- **Secrets:** both `additionalConfig` and `existingConfig` use plaintext + ConfigMaps. For a config containing credentials, leave config management disabled + and mount a Secret at `/etc/redis/redis.conf` with `extraVolumeMounts` instead. + Configure the clients' `connection.existingSecret` and the exporter's + `redisExporter.env.REDIS_PASSWORD.valueFrom.secretKeyRef` as appropriate. + Redis readiness alone does not verify exporter authentication; check `redis_up`. + +While config management is disabled, all other `config` options are ignored, +including auto-sizing, so you must size Redis memory yourself. With management enabled, +an explicit `config.maxmemory` takes precedence over auto-sizing, and +`additionalConfig` is appended last. Supported memory limits are plain byte +counts or numbers with `k`, `M`, `G`, `T`, `P`, `E`, `Ki`, `Mi`, `Gi`, `Ti`, +`Pi`, or `Ei` suffixes. If the limit is absent or unrecognised, or +`sourcegraph.localDevMode` is enabled, the vendored 6gb default remains unless +overridden explicitly. + +Chart-managed config changes restart the Redis pod through a checksum +annotation. Changes to an existing ConfigMap or Secret require a manual pod +restart because `subPath` mounts do not update in running containers. + ## Configuration Options Reference the below chart for all available configuration parameters. diff --git a/charts/sourcegraph/files/redis-cache/redis.conf b/charts/sourcegraph/files/redis-cache/redis.conf new file mode 100644 index 000000000..907ac587b --- /dev/null +++ b/charts/sourcegraph/files/redis-cache/redis.conf @@ -0,0 +1,17 @@ +# Vendored from the `redis-cache` image (`/etc/redis/redis.conf`). +# Source: sourcegraph/sourcegraph docker-images/redis-cache/redis.conf +# Seeded from image tag 6.0.0. Keep this file in sync when the image tag changes. +# +# The chart mounts this file over /etc/redis/redis.conf, so the image entrypoint +# (`redis-server /etc/redis/redis.conf`) reads it. The chart appends the computed +# `maxmemory` and any `redisCache.config` overrides after this body. + +# allow access from all instances +protected-mode no +# limit memory usage, discard unused keys when hitting limit +maxmemory 6gb +maxmemory-policy allkeys-lru +# snapshots on disk every minute +dir /redis-data/ +appendonly no +save 60 1 diff --git a/charts/sourcegraph/files/redis-store/redis.conf b/charts/sourcegraph/files/redis-store/redis.conf new file mode 100644 index 000000000..b45fba495 --- /dev/null +++ b/charts/sourcegraph/files/redis-store/redis.conf @@ -0,0 +1,18 @@ +# Vendored from the `redis-store` image (`/etc/redis/redis.conf`). +# Source: sourcegraph/sourcegraph docker-images/redis-store/redis.conf +# Seeded from image tag 6.0.0. Keep this file in sync when the image tag changes. +# +# The chart mounts this file over /etc/redis/redis.conf, so the image entrypoint +# (`redis-server /etc/redis/redis.conf`) reads it. The chart appends the computed +# `maxmemory` and any `redisStore.config` overrides after this body. + +# allow access from all instances +protected-mode no +# limit memory usage, return error when hitting limit +maxmemory 6gb +maxmemory-policy noeviction +# live commit log to disk, additionally snapshot every 5 minutes +dir /redis-data/ +appendonly yes +aof-use-rdb-preamble yes +save 300 1 diff --git a/charts/sourcegraph/templates/_helpers.tpl b/charts/sourcegraph/templates/_helpers.tpl index 5c064c4b4..fa1af3b4e 100644 --- a/charts/sourcegraph/templates/_helpers.tpl +++ b/charts/sourcegraph/templates/_helpers.tpl @@ -312,3 +312,66 @@ checksum/auth: {{ toJson $checksum | sha256sum }} {{- $checksum := append $checksum .Values.redisCache.connection -}} checksum/redis: {{ toJson $checksum | sha256sum }} {{- end -}} + +{{/* +Resolve the redis `maxmemory` directive for a service. +Usage: include "sourcegraph.redis.maxmemory" (list . "redisCache") + +Resolution order: + 1. .config.maxmemory, used verbatim. + 2. floor(.config.maxmemoryRatio * .resources.limits.memory), + rendered as a plain byte count, unless localDevMode removes the limit. + 3. Empty string, when there is no memory limit or the quantity is not + recognised. The caller then emits no `maxmemory` and the vendored default + stands. +*/}} +{{- define "sourcegraph.redis.maxmemory" -}} +{{- $top := index . 0 -}} +{{- $service := index . 1 -}} +{{- $values := index $top.Values $service -}} +{{- $config := $values.config | default dict -}} +{{- if $config.maxmemory -}} +{{- $config.maxmemory -}} +{{- else if not $top.Values.sourcegraph.localDevMode -}} +{{- $limit := dig "resources" "limits" "memory" "" $values | toString -}} +{{- $number := regexReplaceAll "^([0-9]+(\\.[0-9]+)?).*$" $limit "${1}" -}} +{{- $suffix := regexReplaceAll "^[0-9]+(\\.[0-9]+)?" $limit "" -}} +{{- /* Kubernetes quantity suffixes: binary (1024^n) and decimal (1000^n). */ -}} +{{- $units := dict "" 1.0 "k" 1e3 "M" 1e6 "G" 1e9 "T" 1e12 "P" 1e15 "E" 1e18 "Ki" 1024.0 "Mi" 1048576.0 "Gi" 1073741824.0 "Ti" 1099511627776.0 "Pi" 1125899906842624.0 "Ei" 1152921504606846976.0 -}} +{{- if and (regexMatch "^[0-9]+(\\.[0-9]+)?$" $number) (hasKey $units $suffix) -}} +{{- $ratio := 0.75 -}} +{{- if hasKey $config "maxmemoryRatio" -}} +{{- $ratio = float64 $config.maxmemoryRatio -}} +{{- end -}} +{{- if not (and (gt $ratio 0.0) (lt $ratio 1.0)) -}} +{{- fail (printf "%s.config.maxmemoryRatio must be greater than 0 and less than 1" $service) -}} +{{- end -}} +{{- $bytes := floor (mulf (float64 $number) (index $units $suffix) $ratio) -}} +{{- if gt $bytes 0.0 -}} +{{- printf "%d" (int64 $bytes) -}} +{{- end -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Fail the render when a service's extra volumes or volume mounts collide with the +chart-managed redis config mount. Without this the collision only surfaces as an +opaque "must be unique" rejection from the API server. +Usage: include "sourcegraph.redis.assertNoConfClash" (list . "redisCache") +*/}} +{{- define "sourcegraph.redis.assertNoConfClash" -}} +{{- $top := index . 0 -}} +{{- $service := index . 1 -}} +{{- $values := index $top.Values $service -}} +{{- range ($values.extraVolumeMounts | default list) -}} +{{- if has .mountPath (list "/etc/redis/redis.conf" "/etc/redis" "/etc/redis/") -}} +{{- fail (printf "%s.extraVolumeMounts must not mount over /etc/redis/redis.conf; the chart now manages that file. Move your custom redis config to %s.config.existingConfig or %s.config.additionalConfig, or set %s.config.enabled=false to preserve your existing mount." $service $service $service $service) -}} +{{- end -}} +{{- end -}} +{{- range (concat ($values.extraVolumes | default list) ($values.extraVolumeMounts | default list)) -}} +{{- if eq (.name | toString) "redis-conf" -}} +{{- fail (printf "%s must not define a volume named 'redis-conf'; the chart reserves that name for the redis config mount." $service) -}} +{{- end -}} +{{- end -}} +{{- end -}} diff --git a/charts/sourcegraph/templates/redis/redis-cache.ConfigMap.yaml b/charts/sourcegraph/templates/redis/redis-cache.ConfigMap.yaml new file mode 100644 index 000000000..bfecbc7e4 --- /dev/null +++ b/charts/sourcegraph/templates/redis/redis-cache.ConfigMap.yaml @@ -0,0 +1,37 @@ +{{- if and .Values.redisCache.enabled .Values.redisCache.config.enabled -}} +{{- if and .Values.redisCache.config.existingConfig .Values.redisCache.config.additionalConfig -}} +{{- fail "You can only define one of 'redisCache.config.existingConfig' and 'redisCache.config.additionalConfig' at a time" }} +{{- end }} +{{- if not .Values.redisCache.config.existingConfig -}} +{{- $body := .Files.Get "files/redis-cache/redis.conf" | trimSuffix "\n" -}} +{{- $overrides := list -}} +{{- with include "sourcegraph.redis.maxmemory" (list . "redisCache") -}} +{{- $overrides = append $overrides (printf "maxmemory %s" .) -}} +{{- end -}} +{{- with .Values.redisCache.config.maxmemoryPolicy -}} +{{- $overrides = append $overrides (printf "maxmemory-policy %s" .) -}} +{{- end -}} +{{- with .Values.redisCache.config.additionalConfig -}} +{{- $overrides = append $overrides (tpl . $ | trim) -}} +{{- end -}} +{{- if $overrides -}} +{{- $body = printf "%s\n\n# Chart-managed directives. Redis applies the last occurrence of a directive.\n%s" $body (join "\n" $overrides) -}} +{{- end -}} +apiVersion: v1 +kind: ConfigMap +metadata: + annotations: + description: Configuration for redis-cache + labels: + {{- include "sourcegraph.labels" . | nindent 4 }} + {{- if .Values.redisCache.labels }} + {{- toYaml .Values.redisCache.labels | nindent 4 }} + {{- end }} + deploy: sourcegraph + app.kubernetes.io/component: redis + name: {{ .Values.redisCache.name }}-conf +data: + redis.conf: | + {{- $body | nindent 4 }} +{{- end }} +{{- end }} diff --git a/charts/sourcegraph/templates/redis/redis-cache.Deployment.yaml b/charts/sourcegraph/templates/redis/redis-cache.Deployment.yaml index bb5982328..1ea57e114 100644 --- a/charts/sourcegraph/templates/redis/redis-cache.Deployment.yaml +++ b/charts/sourcegraph/templates/redis/redis-cache.Deployment.yaml @@ -1,4 +1,7 @@ {{- if .Values.redisCache.enabled -}} +{{- if .Values.redisCache.config.enabled -}} +{{- include "sourcegraph.redis.assertNoConfClash" (list . "redisCache") -}} +{{- end -}} apiVersion: apps/v1 kind: Deployment metadata: @@ -26,6 +29,9 @@ spec: metadata: annotations: kubectl.kubernetes.io/default-container: redis-cache + {{- if and .Values.redisCache.config.enabled (not .Values.redisCache.config.existingConfig) }} + checksum/redis-config: {{ include (print $.Template.BasePath "/redis/redis-cache.ConfigMap.yaml") . | sha256sum }} + {{- end }} {{- if .Values.sourcegraph.podAnnotations }} {{- toYaml .Values.sourcegraph.podAnnotations | nindent 8 }} {{- end }} @@ -100,6 +106,12 @@ spec: {{- if .Values.redisCache.storageSubPath }} subPath: {{ .Values.redisCache.storageSubPath }} {{- end }} + {{- if .Values.redisCache.config.enabled }} + - mountPath: /etc/redis/redis.conf + name: redis-conf + subPath: redis.conf + readOnly: true + {{- end }} {{- if .Values.redisCache.extraVolumeMounts }} {{- toYaml .Values.redisCache.extraVolumeMounts | nindent 8 }} {{- end }} @@ -139,6 +151,14 @@ spec: - name: redis-data persistentVolumeClaim: claimName: redis-cache + {{- if .Values.redisCache.config.enabled }} + - name: redis-conf + configMap: + name: {{ default (print .Values.redisCache.name "-conf") .Values.redisCache.config.existingConfig }} + items: + - key: redis.conf + path: redis.conf + {{- end }} {{- if .Values.redisCache.extraVolumes }} {{- toYaml .Values.redisCache.extraVolumes | nindent 6 }} {{- end }} diff --git a/charts/sourcegraph/templates/redis/redis-store.ConfigMap.yaml b/charts/sourcegraph/templates/redis/redis-store.ConfigMap.yaml new file mode 100644 index 000000000..6cf4246c7 --- /dev/null +++ b/charts/sourcegraph/templates/redis/redis-store.ConfigMap.yaml @@ -0,0 +1,37 @@ +{{- if and .Values.redisStore.enabled .Values.redisStore.config.enabled -}} +{{- if and .Values.redisStore.config.existingConfig .Values.redisStore.config.additionalConfig -}} +{{- fail "You can only define one of 'redisStore.config.existingConfig' and 'redisStore.config.additionalConfig' at a time" }} +{{- end }} +{{- if not .Values.redisStore.config.existingConfig -}} +{{- $body := .Files.Get "files/redis-store/redis.conf" | trimSuffix "\n" -}} +{{- $overrides := list -}} +{{- with include "sourcegraph.redis.maxmemory" (list . "redisStore") -}} +{{- $overrides = append $overrides (printf "maxmemory %s" .) -}} +{{- end -}} +{{- with .Values.redisStore.config.maxmemoryPolicy -}} +{{- $overrides = append $overrides (printf "maxmemory-policy %s" .) -}} +{{- end -}} +{{- with .Values.redisStore.config.additionalConfig -}} +{{- $overrides = append $overrides (tpl . $ | trim) -}} +{{- end -}} +{{- if $overrides -}} +{{- $body = printf "%s\n\n# Chart-managed directives. Redis applies the last occurrence of a directive.\n%s" $body (join "\n" $overrides) -}} +{{- end -}} +apiVersion: v1 +kind: ConfigMap +metadata: + annotations: + description: Configuration for redis-store + labels: + {{- include "sourcegraph.labels" . | nindent 4 }} + {{- if .Values.redisStore.labels }} + {{- toYaml .Values.redisStore.labels | nindent 4 }} + {{- end }} + deploy: sourcegraph + app.kubernetes.io/component: redis + name: {{ .Values.redisStore.name }}-conf +data: + redis.conf: | + {{- $body | nindent 4 }} +{{- end }} +{{- end }} diff --git a/charts/sourcegraph/templates/redis/redis-store.Deployment.yaml b/charts/sourcegraph/templates/redis/redis-store.Deployment.yaml index 59806df90..e557c4ebb 100644 --- a/charts/sourcegraph/templates/redis/redis-store.Deployment.yaml +++ b/charts/sourcegraph/templates/redis/redis-store.Deployment.yaml @@ -1,4 +1,7 @@ {{- if .Values.redisStore.enabled -}} +{{- if .Values.redisStore.config.enabled -}} +{{- include "sourcegraph.redis.assertNoConfClash" (list . "redisStore") -}} +{{- end -}} apiVersion: apps/v1 kind: Deployment metadata: @@ -26,6 +29,9 @@ spec: metadata: annotations: kubectl.kubernetes.io/default-container: redis-store + {{- if and .Values.redisStore.config.enabled (not .Values.redisStore.config.existingConfig) }} + checksum/redis-config: {{ include (print $.Template.BasePath "/redis/redis-store.ConfigMap.yaml") . | sha256sum }} + {{- end }} {{- if .Values.sourcegraph.podAnnotations }} {{- toYaml .Values.sourcegraph.podAnnotations | nindent 8 }} {{- end }} @@ -99,6 +105,12 @@ spec: {{- if .Values.redisStore.storageSubPath }} subPath: {{ .Values.redisStore.storageSubPath }} {{- end }} + {{- if .Values.redisStore.config.enabled }} + - mountPath: /etc/redis/redis.conf + name: redis-conf + subPath: redis.conf + readOnly: true + {{- end }} {{- if .Values.redisStore.extraVolumeMounts }} {{- toYaml .Values.redisStore.extraVolumeMounts | nindent 8 }} {{- end }} @@ -138,6 +150,14 @@ spec: - name: redis-data persistentVolumeClaim: claimName: redis-store + {{- if .Values.redisStore.config.enabled }} + - name: redis-conf + configMap: + name: {{ default (print .Values.redisStore.name "-conf") .Values.redisStore.config.existingConfig }} + items: + - key: redis.conf + path: redis.conf + {{- end }} {{- if .Values.redisStore.extraVolumes }} {{- toYaml .Values.redisStore.extraVolumes | nindent 6 }} {{- end }} diff --git a/charts/sourcegraph/tests/redisConfigMount_test.yaml b/charts/sourcegraph/tests/redisConfigMount_test.yaml new file mode 100644 index 000000000..78dab75c8 --- /dev/null +++ b/charts/sourcegraph/tests/redisConfigMount_test.yaml @@ -0,0 +1,255 @@ +--- +suite: redisConfigMount +# The ConfigMap templates are listed so the Deployments' checksum annotation can +# include them. +templates: +- redis/redis-cache.Deployment.yaml +- redis/redis-store.Deployment.yaml +- redis/redis-cache.ConfigMap.yaml +- redis/redis-store.ConfigMap.yaml +tests: +- it: should enable config management for redis-cache independently + template: redis/redis-cache.Deployment.yaml + set: + redisCache.config.enabled: true + asserts: + - contains: + path: spec.template.spec.containers[0].volumeMounts + content: + mountPath: /etc/redis/redis.conf + name: redis-conf + subPath: redis.conf + readOnly: true + - contains: + path: spec.template.spec.volumes + content: + name: redis-conf + configMap: + name: redis-cache-conf + items: + - key: redis.conf + path: redis.conf + - isNotEmpty: + path: spec.template.metadata.annotations["checksum/redis-config"] + - notExists: + path: spec.template.spec.containers[0].command + - hasDocuments: + count: 1 + template: redis/redis-cache.ConfigMap.yaml + - hasDocuments: + count: 0 + template: redis/redis-store.ConfigMap.yaml + - lengthEqual: + path: spec.template.spec.containers[0].volumeMounts + count: 1 + template: redis/redis-store.Deployment.yaml + - lengthEqual: + path: spec.template.spec.volumes + count: 1 + template: redis/redis-store.Deployment.yaml + - notExists: + path: spec.template.metadata.annotations["checksum/redis-config"] + template: redis/redis-store.Deployment.yaml +- it: should enable config management for redis-store independently + template: redis/redis-store.Deployment.yaml + set: + redisStore.config.enabled: true + asserts: + - contains: + path: spec.template.spec.containers[0].volumeMounts + content: + mountPath: /etc/redis/redis.conf + name: redis-conf + subPath: redis.conf + readOnly: true + - contains: + path: spec.template.spec.volumes + content: + name: redis-conf + configMap: + name: redis-store-conf + items: + - key: redis.conf + path: redis.conf + - isNotEmpty: + path: spec.template.metadata.annotations["checksum/redis-config"] + - notExists: + path: spec.template.spec.containers[0].command + - hasDocuments: + count: 1 + template: redis/redis-store.ConfigMap.yaml + - hasDocuments: + count: 0 + template: redis/redis-cache.ConfigMap.yaml + - lengthEqual: + path: spec.template.spec.containers[0].volumeMounts + count: 1 + template: redis/redis-cache.Deployment.yaml + - lengthEqual: + path: spec.template.spec.volumes + count: 1 + template: redis/redis-cache.Deployment.yaml + - notExists: + path: spec.template.metadata.annotations["checksum/redis-config"] + template: redis/redis-cache.Deployment.yaml +- it: should mount an existing ConfigMap and drop the checksum annotation + template: redis/redis-cache.Deployment.yaml + set: + redisCache: + config: + enabled: true + existingConfig: my-redis-conf + asserts: + - contains: + path: spec.template.spec.volumes + content: + name: redis-conf + configMap: + name: my-redis-conf + items: + - key: redis.conf + path: redis.conf + - notExists: + path: spec.template.metadata.annotations["checksum/redis-config"] +- it: should fail when redis-cache extraVolumeMounts collide with the chart-managed redis.conf + template: redis/redis-cache.Deployment.yaml + set: + redisCache: + config: + enabled: true + extraVolumeMounts: + - name: my-conf + mountPath: /etc/redis/redis.conf + subPath: redis.conf + asserts: + - failedTemplate: + errorMessage: "redisCache.extraVolumeMounts must not mount over /etc/redis/redis.conf; the chart now manages that file. Move your custom redis config to redisCache.config.existingConfig or redisCache.config.additionalConfig, or set redisCache.config.enabled=false to preserve your existing mount." +- it: should fail when redis-store extraVolumeMounts mount the whole /etc/redis directory + template: redis/redis-store.Deployment.yaml + set: + redisStore: + config: + enabled: true + extraVolumeMounts: + - name: my-conf + mountPath: /etc/redis + asserts: + - failedTemplate: + errorMessage: "redisStore.extraVolumeMounts must not mount over /etc/redis/redis.conf; the chart now manages that file. Move your custom redis config to redisStore.config.existingConfig or redisStore.config.additionalConfig, or set redisStore.config.enabled=false to preserve your existing mount." +- it: should fail when an extra volume reuses the reserved redis-conf name + template: redis/redis-cache.Deployment.yaml + set: + redisCache: + config: + enabled: true + extraVolumes: + - name: redis-conf + emptyDir: {} + asserts: + - failedTemplate: + errorMessage: "redisCache must not define a volume named 'redis-conf'; the chart reserves that name for the redis config mount." +- it: should still allow unrelated extraVolumeMounts + template: redis/redis-cache.Deployment.yaml + set: + redisCache: + config: + enabled: true + extraVolumeMounts: + - name: my-extra + mountPath: /somewhere-else + asserts: + - contains: + path: spec.template.spec.containers[0].volumeMounts + content: + name: my-extra + mountPath: /somewhere-else +- it: should preserve the image config by default + asserts: + - hasDocuments: + count: 0 + template: redis/redis-cache.ConfigMap.yaml + - hasDocuments: + count: 0 + template: redis/redis-store.ConfigMap.yaml + - equal: + path: spec.template.spec.containers[0].volumeMounts + value: + - mountPath: /redis-data + name: redis-data + template: redis/redis-cache.Deployment.yaml + - equal: + path: spec.template.spec.containers[0].volumeMounts + value: + - mountPath: /redis-data + name: redis-data + template: redis/redis-store.Deployment.yaml + - lengthEqual: + path: spec.template.spec.volumes + count: 1 + template: redis/redis-cache.Deployment.yaml + - lengthEqual: + path: spec.template.spec.volumes + count: 1 + template: redis/redis-store.Deployment.yaml + - notExists: + path: spec.template.metadata.annotations["checksum/redis-config"] + template: redis/redis-cache.Deployment.yaml + - notExists: + path: spec.template.metadata.annotations["checksum/redis-config"] + template: redis/redis-store.Deployment.yaml +- it: should preserve a Secret-mounted config by default + set: + redisCache.extraVolumeMounts: &mounts + - name: redis-conf + mountPath: /etc/redis/redis.conf + subPath: redis.conf + readOnly: true + redisStore.extraVolumeMounts: *mounts + redisCache.extraVolumes: &volumes + - name: redis-conf + secret: + secretName: redis-auth-config + redisStore.extraVolumes: *volumes + asserts: + - equal: + path: spec.template.spec.containers[0].volumeMounts + value: + - mountPath: /redis-data + name: redis-data + - name: redis-conf + mountPath: /etc/redis/redis.conf + subPath: redis.conf + readOnly: true + template: redis/redis-cache.Deployment.yaml + - equal: + path: spec.template.spec.containers[0].volumeMounts + value: + - mountPath: /redis-data + name: redis-data + - name: redis-conf + mountPath: /etc/redis/redis.conf + subPath: redis.conf + readOnly: true + template: redis/redis-store.Deployment.yaml + - equal: + path: spec.template.spec.volumes[1] + value: + name: redis-conf + secret: + secretName: redis-auth-config + template: redis/redis-cache.Deployment.yaml + - equal: + path: spec.template.spec.volumes[1] + value: + name: redis-conf + secret: + secretName: redis-auth-config + template: redis/redis-store.Deployment.yaml + - lengthEqual: + path: spec.template.spec.volumes + count: 2 + template: redis/redis-cache.Deployment.yaml + - lengthEqual: + path: spec.template.spec.volumes + count: 2 + template: redis/redis-store.Deployment.yaml diff --git a/charts/sourcegraph/tests/redisConfig_test.yaml b/charts/sourcegraph/tests/redisConfig_test.yaml new file mode 100644 index 000000000..671d349c0 --- /dev/null +++ b/charts/sourcegraph/tests/redisConfig_test.yaml @@ -0,0 +1,303 @@ +--- +suite: redisConfig +templates: +- redis/redis-cache.ConfigMap.yaml +- redis/redis-store.ConfigMap.yaml +set: + redisCache.config.enabled: true + redisStore.config.enabled: true +tests: +- it: should render the vendored config with an auto-sized maxmemory when enabled + asserts: + - matchRegex: + path: data["redis.conf"] + pattern: "\ndir /redis-data/\n" + # 7Gi * 0.75 + - matchRegex: + path: data["redis.conf"] + pattern: "\nmaxmemory 5637144576\n?$" +- it: should keep the vendored maxmemory-policy of each service + template: redis/redis-cache.ConfigMap.yaml + asserts: + - matchRegex: + path: data["redis.conf"] + pattern: "\nmaxmemory-policy allkeys-lru\n" +- it: should keep the vendored maxmemory-policy for redis-store + template: redis/redis-store.ConfigMap.yaml + asserts: + - matchRegex: + path: data["redis.conf"] + pattern: "\nmaxmemory-policy noeviction\n" +- it: should size maxmemory from a binary memory limit + set: + redisCache: + resources: + limits: + memory: 4Gi + redisStore: + resources: + limits: + memory: 512Mi + asserts: + - matchRegex: + path: data["redis.conf"] + pattern: "\nmaxmemory 3221225472\n?$" + template: redis/redis-cache.ConfigMap.yaml + - matchRegex: + path: data["redis.conf"] + pattern: "\nmaxmemory 402653184\n?$" + template: redis/redis-store.ConfigMap.yaml +- it: should size maxmemory from a decimal memory limit + set: + redisCache: + resources: + limits: + memory: 2G + redisStore: + resources: + limits: + memory: 2G + asserts: + - matchRegex: + path: data["redis.conf"] + pattern: "\nmaxmemory 1500000000\n?$" +- it: should size maxmemory from a suffixless byte count + set: + redisCache: + resources: + limits: + memory: "6442450944" + redisStore: + resources: + limits: + memory: "6442450944" + asserts: + - matchRegex: + path: data["redis.conf"] + pattern: "\nmaxmemory 4831838208\n?$" +- it: should size maxmemory from a fractional memory limit + set: + redisCache: + resources: + limits: + memory: 1.5Gi + redisStore: + resources: + limits: + memory: 1.5Gi + asserts: + - matchRegex: + path: data["redis.conf"] + pattern: "\nmaxmemory 1207959552\n?$" +- it: should honour maxmemoryRatio + set: + redisCache: + config: + maxmemoryRatio: 0.5 + redisStore: + config: + maxmemoryRatio: 0.5 + asserts: + # 7Gi * 0.5 + - matchRegex: + path: data["redis.conf"] + pattern: "\nmaxmemory 3758096384\n?$" +- it: should not append maxmemory when there is no memory limit + set: + redisCache: + resources: + limits: null + redisStore: + resources: + limits: null + asserts: + - notMatchRegex: + path: data["redis.conf"] + pattern: "Chart-managed directives" +- it: should not append maxmemory when the memory limit is unparseable + set: + redisCache: + resources: + limits: + memory: 7Gib + redisStore: + resources: + limits: + memory: notaquantity + asserts: + - notMatchRegex: + path: data["redis.conf"] + pattern: "Chart-managed directives" +- it: should use an explicit maxmemory verbatim + set: + redisCache: + config: + maxmemory: 6gb + redisStore: + config: + maxmemory: 6gb + asserts: + - matchRegex: + path: data["redis.conf"] + pattern: "\nmaxmemory 6gb\n?$" +- it: should append maxmemory-policy and additionalConfig overrides + set: + redisCache: + config: + maxmemoryPolicy: volatile-lru + additionalConfig: | + lazyfree-lazy-eviction yes + redisStore: + config: + maxmemoryPolicy: volatile-lru + additionalConfig: | + lazyfree-lazy-eviction yes + asserts: + - matchRegex: + path: data["redis.conf"] + pattern: "\nmaxmemory 5637144576\nmaxmemory-policy volatile-lru\nlazyfree-lazy-eviction yes\n?$" +- it: should not render the redis-cache ConfigMap when existingConfig is set + template: redis/redis-cache.ConfigMap.yaml + set: + redisCache: + config: + existingConfig: my-redis-conf + asserts: + - hasDocuments: + count: 0 +- it: should not render the redis-store ConfigMap when existingConfig is set + template: redis/redis-store.ConfigMap.yaml + set: + redisStore: + config: + existingConfig: my-redis-conf + asserts: + - hasDocuments: + count: 0 +- it: should fail when both redisCache existingConfig and additionalConfig are defined + template: redis/redis-cache.ConfigMap.yaml + set: + redisCache: + config: + existingConfig: i-will-break-rendering + additionalConfig: | + maxmemory 1gb + asserts: + - failedTemplate: + errorMessage: You can only define one of 'redisCache.config.existingConfig' and 'redisCache.config.additionalConfig' at a time +- it: should fail when both redisStore existingConfig and additionalConfig are defined + template: redis/redis-store.ConfigMap.yaml + set: + redisStore: + config: + existingConfig: i-will-break-rendering + additionalConfig: | + maxmemory 1gb + asserts: + - failedTemplate: + errorMessage: You can only define one of 'redisStore.config.existingConfig' and 'redisStore.config.additionalConfig' at a time +- it: should reject a zero ratio instead of silently defaulting it + template: redis/redis-cache.ConfigMap.yaml + set: + redisCache.config.maxmemoryRatio: 0 + asserts: + - failedTemplate: + errorMessage: redisCache.config.maxmemoryRatio must be greater than 0 and less than 1 +- it: should reject a negative ratio instead of reverting to 6gb + template: redis/redis-store.ConfigMap.yaml + set: + redisStore.config.maxmemoryRatio: -0.5 + asserts: + - failedTemplate: + errorMessage: redisStore.config.maxmemoryRatio must be greater than 0 and less than 1 +- it: should reject a ratio of one to reserve memory for Redis overhead + template: redis/redis-cache.ConfigMap.yaml + set: + redisCache.config.maxmemoryRatio: 1 + asserts: + - failedTemplate: + errorMessage: redisCache.config.maxmemoryRatio must be greater than 0 and less than 1 +- it: should reject a ratio greater than one + template: redis/redis-store.ConfigMap.yaml + set: + redisStore.config.maxmemoryRatio: 1.5 + asserts: + - failedTemplate: + errorMessage: redisStore.config.maxmemoryRatio must be greater than 0 and less than 1 +- it: should reject a nonnumeric ratio + template: redis/redis-cache.ConfigMap.yaml + set: + redisCache.config.maxmemoryRatio: invalid + asserts: + - failedTemplate: + errorMessage: redisCache.config.maxmemoryRatio must be greater than 0 and less than 1 +- it: should floor fractional bytes and accept ratios near either boundary + set: + redisCache.resources.limits.memory: "1001" + redisStore.resources.limits.memory: "1001" + redisCache.config.maxmemoryRatio: 0.01 + redisStore.config.maxmemoryRatio: 0.99 + asserts: + - matchRegex: + path: data["redis.conf"] + pattern: "\nmaxmemory 10\n?$" + template: redis/redis-cache.ConfigMap.yaml + - matchRegex: + path: data["redis.conf"] + pattern: "\nmaxmemory 990\n?$" + template: redis/redis-store.ConfigMap.yaml +- it: should keep the vendored limit in local development mode + set: + sourcegraph.localDevMode: true + redisCache.resources.limits.memory: 512Mi + redisStore.resources.limits.memory: 1Gi + asserts: + - notMatchRegex: + path: data["redis.conf"] + pattern: "Chart-managed directives" + - matchRegex: + path: data["redis.conf"] + pattern: "\nmaxmemory 6gb\n" +- it: should honour an explicit limit even in local development mode + set: + sourcegraph.localDevMode: true + redisCache.config.maxmemory: 256mb + redisStore.config.maxmemory: 256mb + asserts: + - matchRegex: + path: data["redis.conf"] + pattern: "\nmaxmemory 256mb\n?$" +- it: should ignore an unused ratio when an explicit limit is set + set: + redisCache.config.maxmemory: 300mb + redisStore.config.maxmemory: 300mb + redisCache.config.maxmemoryRatio: 0 + redisStore.config.maxmemoryRatio: 2 + asserts: + - matchRegex: + path: data["redis.conf"] + pattern: "\nmaxmemory 300mb\n?$" +- it: should skip config rendering and validation when config management is disabled + set: + redisCache.config: + enabled: false + existingConfig: ignored + additionalConfig: ignored + maxmemoryRatio: 0 + redisStore.config: + enabled: false + existingConfig: ignored + additionalConfig: ignored + maxmemoryRatio: 0 + asserts: + - hasDocuments: + count: 0 +- it: should skip config rendering and validation for external Redis + set: + redisCache.enabled: false + redisStore.enabled: false + redisCache.config.maxmemoryRatio: 0 + redisStore.config.maxmemoryRatio: 0 + asserts: + - hasDocuments: + count: 0 diff --git a/charts/sourcegraph/values.yaml b/charts/sourcegraph/values.yaml index 85a14dcaf..74a1395e0 100644 --- a/charts/sourcegraph/values.yaml +++ b/charts/sourcegraph/values.yaml @@ -1089,6 +1089,32 @@ redisCache: storageSubPath: "" # -- Optional annotations to add to the `redis-cache` PVC storageAnnotations: {} + config: + # -- Opt in to a chart-managed Redis config and automatic memory sizing. + # Disabled by default to preserve image-baked configuration and custom + # `extraVolumeMounts` (including Secret mounts). + # When false, all other `config` options are ignored and auto-sizing is disabled. + enabled: false + # -- Name of an existing ConfigMap for `redis-cache`. It must contain a `redis.conf` key. + # When set, the chart-managed ConfigMap is not rendered and this one is mounted instead, + # so the chart no longer sizes `maxmemory`. Mutually exclusive with `additionalConfig`. + existingConfig: "" + # -- Explicit redis `maxmemory` for `redis-cache` (for example `6gb`). Overrides the + # auto-computed value. Empty means compute it from the container memory limit. + maxmemory: "" + # -- Fraction of `redisCache.resources.limits.memory` used for `maxmemory` when + # `maxmemory` is empty. Must be greater than 0 and less than 1. Ignored when no + # memory limit is set or `sourcegraph.localDevMode` is enabled. An absent or + # unrecognised limit keeps the vendored 6gb default; use an explicit maxmemory if needed. + maxmemoryRatio: 0.75 + # -- Override the redis `maxmemory-policy` for `redis-cache`. + # Empty keeps the vendored default (`allkeys-lru`). + maxmemoryPolicy: "" + # -- Additional raw redis directives appended to the vendored `redis-cache` config. + # Notes: This is expecting a multiline string. It renders into a ConfigMap in plaintext, + # so do not put secrets such as `requirepass` here or in `existingConfig` (also a ConfigMap). + # For secrets, set `config.enabled: false` and mount a Secret using `extraVolumeMounts`. + additionalConfig: "" redisExporter: image: @@ -1164,6 +1190,32 @@ redisStore: storageSubPath: "" # -- Optional annotations to add to the `redis-store` PVC storageAnnotations: {} + config: + # -- Opt in to a chart-managed Redis config and automatic memory sizing. + # Disabled by default to preserve image-baked configuration and custom + # `extraVolumeMounts` (including Secret mounts). + # When false, all other `config` options are ignored and auto-sizing is disabled. + enabled: false + # -- Name of an existing ConfigMap for `redis-store`. It must contain a `redis.conf` key. + # When set, the chart-managed ConfigMap is not rendered and this one is mounted instead, + # so the chart no longer sizes `maxmemory`. Mutually exclusive with `additionalConfig`. + existingConfig: "" + # -- Explicit redis `maxmemory` for `redis-store` (for example `6gb`). Overrides the + # auto-computed value. Empty means compute it from the container memory limit. + maxmemory: "" + # -- Fraction of `redisStore.resources.limits.memory` used for `maxmemory` when + # `maxmemory` is empty. Must be greater than 0 and less than 1. Ignored when no + # memory limit is set or `sourcegraph.localDevMode` is enabled. An absent or + # unrecognised limit keeps the vendored 6gb default; use an explicit maxmemory if needed. + maxmemoryRatio: 0.75 + # -- Override the redis `maxmemory-policy` for `redis-store`. + # Empty keeps the vendored default (`noeviction`). + maxmemoryPolicy: "" + # -- Additional raw redis directives appended to the vendored `redis-store` config. + # Notes: This is expecting a multiline string. It renders into a ConfigMap in plaintext, + # so do not put secrets such as `requirepass` here or in `existingConfig` (also a ConfigMap). + # For secrets, set `config.enabled: false` and mount a Secret using `extraVolumeMounts`. + additionalConfig: "" searcher: # -- Environment variables for the `searcher` container