Skip to content

Commit bcd8cde

Browse files
authored
Embeddings Service Config (#282)
* Update embeddings configuration to align with code intel storage * Add example for embeddings config
1 parent f7e320d commit bcd8cde

File tree

5 files changed

+52
-12
lines changed

5 files changed

+52
-12
lines changed

charts/sourcegraph/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ In addition to the documented values, all services also support the following va
9090
| codeIntelDB.serviceAccount.create | bool | `false` | Enable creation of ServiceAccount for `codeintel-db` |
9191
| codeIntelDB.serviceAccount.name | string | `""` | Name of the ServiceAccount to be created or an existing ServiceAccount |
9292
| codeIntelDB.storageSize | string | `"200Gi"` | PVC Storage Request for `codeintel-db` data volume |
93-
| embeddings.backend | object | `{"EMBEDDINGS_UPLOAD_AWS_ENDPOINT":"http://blobstore:9000","EMBEDDINGS_UPLOAD_BACKEND":"blobstore"}` | Configure the storage backend for embeddings |
9493
| embeddings.containerSecurityContext | object | `{"allowPrivilegeEscalation":false,"readOnlyRootFilesystem":true,"runAsGroup":101,"runAsUser":100}` | Security context for the `worker` container, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container) |
9594
| embeddings.enabled | bool | `false` | Enable `embeddings` |
9695
| embeddings.env | object | `{}` | Environment variables for the `embeddings` container |
@@ -352,6 +351,7 @@ In addition to the documented values, all services also support the following va
352351
| syntectServer.serviceAccount.create | bool | `false` | Enable creation of ServiceAccount for `syntect-server` |
353352
| syntectServer.serviceAccount.name | string | `""` | Name of the ServiceAccount to be created or an existing ServiceAccount |
354353
| worker.containerSecurityContext | object | `{"allowPrivilegeEscalation":false,"readOnlyRootFilesystem":true,"runAsGroup":101,"runAsUser":100}` | Security context for the `worker` container, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container) |
354+
| worker.env | object | `{}` | Environment variables for the `worker` container |
355355
| worker.image.defaultTag | string | `"5.0.2@sha256:83f1e1d30bad33a311e8e0c0c9e7995ef7b7df9a1135ac0ff5e5c9561c7b74c4"` | Docker image tag for the `worker` image |
356356
| worker.image.name | string | `"worker"` | Docker image name for the `worker` image |
357357
| worker.name | string | `"worker"` | Name used by resources. Does not affect service names or PVCs. |
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Override file demonstrating the use of external Object Storage services
2+
# Learn more from the tutorial below
3+
# - https://docs.sourcegraph.com/cody/explanations/code_graph_context#storing-embedding-indexes
4+
5+
# Disable deployment of the built-in object storage
6+
# Only disable if also using external storage for SCIP indexes
7+
blobstore:
8+
enabled: false
9+
10+
# we use YAML anchors and alias to keep override file clean
11+
objectStorageEnv: &objectStorageEnv
12+
EMBEDDINGS_UPLOAD_BACKEND:
13+
value: S3 # external object stoage type, one of "S3" or "GCS"
14+
EMBEDDINGS_UPLOAD_BUCKET:
15+
value: embedings-uploads # external object storage bucket name
16+
EMBEDDINGS_UPLOAD_AWS_ENDPOINT:
17+
value: https://s3.us-east-1.amazonaws.com
18+
EMBEDDINGS_UPLOAD_AWS_REGION:
19+
value: us-east-1
20+
EMBEDDINGS_UPLOAD_AWS_ACCESS_KEY_ID:
21+
secretKeyRef: # Pre-existing secret, not created by this chart
22+
name: sourcegraph-s3-credentials
23+
key: EMBEDDINGS_UPLOAD_AWS_ACCESS_KEY_ID
24+
EMBEDDINGS_UPLOAD_AWS_SECRET_ACCESS_KEY:
25+
secretKeyRef: # Pre-existing secret, not created by this chart
26+
name: sourcegraph-s3-credentials
27+
key: EMBEDDINGS_UPLOAD_AWS_SECRET_ACCESS_KEY
28+
29+
embeddings:
30+
enabled: true
31+
env:
32+
<<: *objectStorageEnv
33+
34+
worker:
35+
env:
36+
<<: *objectStorageEnv

charts/sourcegraph/templates/embeddings/embeddings.Deployment.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,13 @@ spec:
5555
- name: {{ $name }}
5656
{{- $item | toYaml | nindent 10 }}
5757
{{- end }}
58-
{{- range $name, $item := .Values.embeddings.backend }}
59-
- name: {{ $name }}
60-
value: {{ $item | quote }}
58+
{{- if not .Values.embeddings.env.EMBEDDINGS_UPLOAD_BACKEND }}
59+
- name: EMBEDDINGS_UPLOAD_BACKEND
60+
value: blobstore
61+
{{- end }}
62+
{{- if not .Values.embeddings.env.EMBEDDINGS_UPLOAD_AWS_ENDPOINT }}
63+
- name: EMBEDDINGS_UPLOAD_AWS_ENDPOINT
64+
value: http://blobstore:9000
6165
{{- end }}
6266
ports:
6367
- containerPort: 9991

charts/sourcegraph/templates/worker/worker.Deployment.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,13 @@ spec:
6060
- name: PRECISE_CODE_INTEL_UPLOAD_AWS_ENDPOINT
6161
value: http://blobstore:9000
6262
{{- end }}
63-
{{- if .Values.embeddings.enabled }}
64-
{{- range $name, $item := .Values.embeddings.backend }}
65-
- name: {{ $name }}
66-
value: {{ $item | quote }}
63+
{{- if and .Values.embeddings.enabled (not .Values.worker.env.EMBEDDINGS_UPLOAD_BACKEND) }}
64+
- name: EMBEDDINGS_UPLOAD_BACKEND
65+
value: blobstore
6766
{{- end }}
67+
{{- if and .Values.embeddings.enabled (not .Values.worker.env.EMBEDDINGS_UPLOAD_AWS_ENDPOINT) }}
68+
- name: EMBEDDINGS_UPLOAD_AWS_ENDPOINT
69+
value: http://blobstore:9000
6870
{{- end }}
6971
- name: POD_NAME
7072
valueFrom:

charts/sourcegraph/values.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,6 @@ embeddings:
301301
requests:
302302
cpu: "4"
303303
memory: 32G
304-
# -- Configure the storage backend for embeddings
305-
backend:
306-
EMBEDDINGS_UPLOAD_BACKEND: "blobstore"
307-
EMBEDDINGS_UPLOAD_AWS_ENDPOINT: "http://blobstore:9000"
308304
# -- Environment variables for the `embeddings` container
309305
env: {}
310306
# -- Security context for the `worker` container,
@@ -1283,6 +1279,8 @@ worker:
12831279
readOnlyRootFilesystem: true
12841280
# -- Name used by resources. Does not affect service names or PVCs.
12851281
name: "worker"
1282+
# -- Environment variables for the `worker` container
1283+
env: {}
12861284
# -- Security context for the `worker` pod,
12871285
# learn more from the [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod)
12881286
podSecurityContext: {}

0 commit comments

Comments
 (0)