Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions charts/sourcegraph/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Use `**BREAKING**:` to denote a breaking change

## Unreleased

- **BREAKING**: The chart no longer sets `SEARCHER_CACHE_SIZE_MB` and `SYMBOLS_CACHE_SIZE_MB`; `searcher` sizes each cache to 45% of its cache volume at startup. Previously the chart derived them from `searcher.storageSize` assuming a `Gi` suffix, so any other unit (e.g. `150G`) rendered `0`, which disables eviction and fills the volume. `searcher.autoCacheSize` is removed. To pin an explicit size, set the env vars under `searcher.env`
- 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
Expand Down
1 change: 0 additions & 1 deletion charts/sourcegraph/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,6 @@ In addition to the documented values, all services also support the following va
| redisStore.storageAnnotations | object | `{}` | Optional annotations to add to the `redis-store` PVC |
| redisStore.storageSize | string | `"100Gi"` | PVC Storage Request for `redis-store` data volume |
| redisStore.storageSubPath | string | `""` | Optional subPath for the `redis-store` primary data volume mount |
| searcher.autoCacheSize | bool | `false` | When enabled, omit the `SEARCHER_CACHE_SIZE_MB` and `SYMBOLS_CACHE_SIZE_MB` env vars so `searcher` auto-sizes its cache to ~45% of the live cache volume. This tracks PVC expansion automatically, whereas the hardcoded env vars are frozen to the initial `storageSize` and do not follow later disk growth. |
| searcher.containerSecurityContext | object | `{"allowPrivilegeEscalation":false,"readOnlyRootFilesystem":true,"runAsGroup":101,"runAsUser":100}` | Security context for the `searcher` container, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container) |
| searcher.env | object | the chart will add some default environment values | Environment variables for the `searcher` container |
| searcher.image.defaultTag | string | `"6.0.0@sha256:c7508abda2202d4a33400ce23a95dd8d59fe6220d85d7fbee6fb186c55931336"` | Docker image tag for the `searcher` image |
Expand Down
24 changes: 0 additions & 24 deletions charts/sourcegraph/templates/searcher/searcher.StatefulSet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,30 +57,6 @@ spec:
- name: {{ $name }}
{{- $item | toYaml | nindent 10 }}
{{- end }}
{{- if not .Values.searcher.autoCacheSize }}
# When autoCacheSize is enabled, these env vars are omitted so searcher
# sizes its cache to ~45% of the live cache volume, tracking PVC
# expansion automatically. SEARCHER_CACHE_SIZE_MB / SYMBOLS_CACHE_SIZE_MB
# are deprecated in favor of this auto-detection.
- name: SEARCHER_CACHE_SIZE_MB
# Set the cache size to ~45% of the PVC size
{{- if .Values.searcher.storageSize }}
value: {{ trimSuffix "Gi" .Values.searcher.storageSize | mul 450 | quote }}
{{- else }}
# This value is ~45% of the default value for
# storageSize in the VolumeClaimTemplate below
value: "11700"
{{- end }}
- name: SYMBOLS_CACHE_SIZE_MB
# Set the cache size to ~45% of the PVC size
{{- if .Values.searcher.storageSize }}
value: {{ trimSuffix "Gi" .Values.searcher.storageSize | mul 450 | quote }}
{{- else }}
# This value is ~45% of the default value for
# storageSize in the VolumeClaimTemplate below
value: "11700"
{{- end }}
{{- end }}
- name: POD_NAME
valueFrom:
fieldRef:
Expand Down
36 changes: 36 additions & 0 deletions charts/sourcegraph/tests/searcherCacheSize_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
suite: searcher cache size
templates:
- searcher/searcher.StatefulSet.yaml
tests:
- it: should not set cache size env vars, searcher sizes its caches from the volume
set:
searcher.storageSize: 150G
asserts:
- notContains:
path: spec.template.spec.containers[0].env
content:
name: SEARCHER_CACHE_SIZE_MB
any: true
- notContains:
path: spec.template.spec.containers[0].env
content:
name: SYMBOLS_CACHE_SIZE_MB
any: true
- it: should pass through cache size env vars set under searcher.env
set:
searcher.env:
SEARCHER_CACHE_SIZE_MB:
value: "20000"
SYMBOLS_CACHE_SIZE_MB:
value: "1500"
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: SEARCHER_CACHE_SIZE_MB
value: "20000"
- contains:
path: spec.template.spec.containers[0].env
content:
name: SYMBOLS_CACHE_SIZE_MB
value: "1500"
5 changes: 0 additions & 5 deletions charts/sourcegraph/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1261,11 +1261,6 @@ searcher:
create: false
# -- Name of the ServiceAccount to be created or an existing ServiceAccount
name: ""
# -- When enabled, omit the `SEARCHER_CACHE_SIZE_MB` and `SYMBOLS_CACHE_SIZE_MB`
# env vars so `searcher` auto-sizes its cache to ~45% of the live cache volume.
# This tracks PVC expansion automatically, whereas the hardcoded env vars are
# frozen to the initial `storageSize` and do not follow later disk growth.
autoCacheSize: false
# -- Size of the PVC for searcher pods to store cache data
storageSize: 26Gi
# -- Optional subPath for the `searcher` primary data volume mount
Expand Down
Loading