From c9aad4c231ef120405ccbf03f177ffdd599026ad Mon Sep 17 00:00:00 2001 From: Mike Deeks Date: Wed, 25 Feb 2026 13:49:30 -0800 Subject: [PATCH] Add support for custom sidecars --- braintrust/templates/api-deployment.yaml | 14 +++++- .../brainstore-reader-deployment.yaml | 6 +++ .../brainstore-writer-deployment.yaml | 6 +++ braintrust/tests/api-deployment_test.yaml | 50 ++++++++++++++++++- braintrust/tests/brainstore-reader_test.yaml | 47 +++++++++++++++++ braintrust/values.yaml | 6 +++ 6 files changed, 126 insertions(+), 3 deletions(-) diff --git a/braintrust/templates/api-deployment.yaml b/braintrust/templates/api-deployment.yaml index 7a440fc..cc1a1f0 100644 --- a/braintrust/templates/api-deployment.yaml +++ b/braintrust/templates/api-deployment.yaml @@ -127,13 +127,23 @@ spec: mountPath: "/mnt/secrets-store" readOnly: true {{- end }} - {{- if and (eq .Values.cloud "azure") .Values.azure.enableAzureKeyVaultDriver }} + {{- with .Values.api.extraContainers }} + {{- toYaml . | nindent 8 }} + {{- end }} volumes: + {{- if or (and (eq .Values.cloud "azure") .Values.azure.enableAzureKeyVaultDriver) .Values.api.extraVolumes }} + {{- if and (eq .Values.cloud "azure") .Values.azure.enableAzureKeyVaultDriver }} - name: secrets-store-inline csi: driver: secrets-store.csi.k8s.io readOnly: true volumeAttributes: secretProviderClass: {{ .Values.azure.keyVaultName }} - {{- end }} + {{- end }} + {{- with .Values.api.extraVolumes }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- else }} + [] + {{- end }} diff --git a/braintrust/templates/brainstore-reader-deployment.yaml b/braintrust/templates/brainstore-reader-deployment.yaml index 7e905c9..d7e51e2 100644 --- a/braintrust/templates/brainstore-reader-deployment.yaml +++ b/braintrust/templates/brainstore-reader-deployment.yaml @@ -142,6 +142,9 @@ spec: mountPath: "/mnt/secrets-store" readOnly: true {{- end }} + {{- with .Values.brainstore.reader.extraContainers }} + {{- toYaml . | nindent 8 }} + {{- end }} volumes: - name: cache-volume {{- if and (eq .Values.cloud "azure") .Values.azure.enableAzureContainerStorageDriver }} @@ -165,3 +168,6 @@ spec: volumeAttributes: secretProviderClass: {{ .Values.azure.keyVaultName }} {{- end }} + {{- with .Values.brainstore.reader.extraVolumes }} + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/braintrust/templates/brainstore-writer-deployment.yaml b/braintrust/templates/brainstore-writer-deployment.yaml index 5866ea3..ca6c3fc 100644 --- a/braintrust/templates/brainstore-writer-deployment.yaml +++ b/braintrust/templates/brainstore-writer-deployment.yaml @@ -142,6 +142,9 @@ spec: mountPath: "/mnt/secrets-store" readOnly: true {{- end }} + {{- with .Values.brainstore.writer.extraContainers }} + {{- toYaml . | nindent 8 }} + {{- end }} volumes: - name: cache-volume {{- if and (eq .Values.cloud "azure") .Values.azure.enableAzureContainerStorageDriver }} @@ -165,3 +168,6 @@ spec: volumeAttributes: secretProviderClass: {{ .Values.azure.keyVaultName }} {{- end }} + {{- with .Values.brainstore.writer.extraVolumes }} + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/braintrust/tests/api-deployment_test.yaml b/braintrust/tests/api-deployment_test.yaml index f495cd0..058c3e0 100644 --- a/braintrust/tests/api-deployment_test.yaml +++ b/braintrust/tests/api-deployment_test.yaml @@ -132,8 +132,9 @@ tests: release: namespace: "braintrust" asserts: - - isNull: + - equal: path: spec.template.spec.volumes + value: [] - it: should include extraEnvVars when provided values: @@ -239,3 +240,50 @@ tests: path: spec.template.spec.containers[0].livenessProbe - isNull: path: spec.template.spec.containers[0].readinessProbe + + - it: should include extraContainers when provided (e.g. OTEL collector sidecar) + values: + - __fixtures__/base-values.yaml + set: + api.extraContainers: + - name: otel-collector + image: otel/opentelemetry-collector-contrib:0.100.0 + args: + - --config=/etc/otel/config.yaml + volumeMounts: + - name: otel-config + mountPath: /etc/otel + readOnly: true + release: + namespace: "braintrust" + asserts: + - equal: + path: spec.template.spec.containers[1].name + value: otel-collector + - equal: + path: spec.template.spec.containers[1].image + value: otel/opentelemetry-collector-contrib:0.100.0 + - contains: + path: spec.template.spec.containers[1].volumeMounts + content: + name: otel-config + mountPath: /etc/otel + readOnly: true + + - it: should include extraVolumes when provided (for sidecar config) + values: + - __fixtures__/base-values.yaml + set: + api.extraVolumes: + - name: otel-config + configMap: + name: otel-collector-config + release: + namespace: "braintrust" + asserts: + - contains: + path: spec.template.spec.volumes + content: + name: otel-config + configMap: + name: otel-collector-config diff --git a/braintrust/tests/brainstore-reader_test.yaml b/braintrust/tests/brainstore-reader_test.yaml index 9bab62d..f9fe261 100644 --- a/braintrust/tests/brainstore-reader_test.yaml +++ b/braintrust/tests/brainstore-reader_test.yaml @@ -230,3 +230,50 @@ tests: content: name: BRAINSTORE_AI_PROXY_URL value: "http://braintrust-api:8000" + + - it: should include extraContainers when provided (e.g. OTEL collector sidecar) + values: + - __fixtures__/base-values.yaml + set: + brainstore.reader.extraContainers: + - name: otel-collector + image: otel/opentelemetry-collector-contrib:0.100.0 + args: + - --config=/etc/otel/config.yaml + volumeMounts: + - name: otel-config + mountPath: /etc/otel + readOnly: true + release: + namespace: "braintrust" + asserts: + - equal: + path: spec.template.spec.containers[1].name + value: otel-collector + - equal: + path: spec.template.spec.containers[1].image + value: otel/opentelemetry-collector-contrib:0.100.0 + - contains: + path: spec.template.spec.containers[1].volumeMounts + content: + name: otel-config + mountPath: /etc/otel + readOnly: true + + - it: should include extraVolumes when provided (for sidecar config) + values: + - __fixtures__/base-values.yaml + set: + brainstore.reader.extraVolumes: + - name: otel-config + configMap: + name: otel-collector-config + release: + namespace: "braintrust" + asserts: + - contains: + path: spec.template.spec.volumes + content: + name: otel-config + configMap: + name: otel-collector-config diff --git a/braintrust/values.yaml b/braintrust/values.yaml index a3d8fa5..adfe264 100644 --- a/braintrust/values.yaml +++ b/braintrust/values.yaml @@ -143,6 +143,8 @@ api: healthServer: host: "0.0.0.0" port: "8001" + extraContainers: [] + extraVolumes: [] # Brainstore configuration (split into reader and writer) brainstore: @@ -222,6 +224,8 @@ brainstore: nodeSelector: {} tolerations: [] affinity: {} + extraContainers: [] + extraVolumes: [] # Brainstore Writer configuration writer: @@ -265,6 +269,8 @@ brainstore: nodeSelector: {} tolerations: [] affinity: {} + extraContainers: [] + extraVolumes: [] azureKeyVaultDriver: # Map your Key Vault secret names to the required Kubernetes secret keys