Skip to content
Merged
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
3 changes: 3 additions & 0 deletions braintrust/ci/values-azure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ brainstore:
nodeSelector: {}
tolerations: []
affinity: {}
fastreader:
volume:
size: "100Gi"
writer:
name: "brainstore-writer"
replicas: 1
Expand Down
39 changes: 31 additions & 8 deletions braintrust/examples/google-autopilot/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ global:
namespace: "braintrust"

# Cloud provider configuration
cloud: "google"
cloud: "google"

# Google Cloud specific configuration for Autopilot
google:
Expand Down Expand Up @@ -58,7 +58,7 @@ brainstore:
#image:
#repository: public.ecr.aws/braintrust/brainstore
#tag: "<your image tag>"
# New deployments should use objectStorage as the locks backend. Existing deployments should remain on redis at this time.
# New deployments should use objectStorage as the locks backend. Existing deployments should remain on redis at this time.
locksBackend: "objectStorage"

# Brainstore Reader configuration
Expand All @@ -79,12 +79,36 @@ brainstore:
memory: "32Gi"
cacheDir: "/mnt/tmp/brainstore"
objectStoreCacheMemoryLimit: "1Gi"
objectStoreCacheFileSize: "1000Gi"
objectStoreCacheFileSize: "900Gi"
verbose: true
volume:
size: "200Gi"
size: "1000Gi"
extraEnvVars:


# Brainstore Fast Reader configuration
fastreader:
name: "brainstore-fastreader"
replicas: 2
service:
name: ""
type: ClusterIP
port: 4000
portName: http
resources:
requests:
cpu: "16"
memory: "32Gi"
limits:
cpu: "16"
memory: "32Gi"
cacheDir: "/mnt/tmp/brainstore"
objectStoreCacheMemoryLimit: "1Gi"
objectStoreCacheFileSize: "900Gi"
verbose: true
volume:
size: "1000Gi"
extraEnvVars:

# Brainstore Writer configuration
writer:
name: "brainstore-writer"
Expand All @@ -103,9 +127,8 @@ brainstore:
memory: "64Gi"
cacheDir: "/mnt/tmp/brainstore"
objectStoreCacheMemoryLimit: "1Gi"
objectStoreCacheFileSize: "1000Gi"
objectStoreCacheFileSize: "900Gi"
verbose: true
volume:
size: "200Gi"
size: "1000Gi"
extraEnvVars:

16 changes: 16 additions & 0 deletions braintrust/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,19 @@ Get the namespace to use for resources
{{- .Release.Namespace -}}
{{- end -}}
{{- end -}}

{{/*
Static fast reader query sources used by API.
*/}}
{{- define "braintrust.fastReaderQuerySourcesCsv" -}}
{{- $sources := list
"summaryPaginatedObjectViewer [realtime]"
"summaryPaginatedObjectViewer"
"a602c972-1843-4ee1-b6bc-d3c1075cd7e7"
"traceQueryFn-id"
"traceQueryFn-rootSpanId"
"fullSpanQueryFn-root_span_id"
"fullSpanQueryFn-id"
-}}
{{- join "," $sources -}}
{{- end -}}
2 changes: 2 additions & 0 deletions braintrust/templates/api-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ data:
BRAINSTORE_ENABLED: "true"
BRAINSTORE_DEFAULT: "force"
BRAINSTORE_URL: "http://{{ .Values.brainstore.reader.service.name | default .Values.brainstore.reader.name }}.{{ .Values.global.namespace }}:{{ .Values.brainstore.reader.service.port }}"
BRAINSTORE_FAST_READER_URL: "http://{{ .Values.brainstore.fastreader.service.name | default .Values.brainstore.fastreader.name }}.{{ .Values.global.namespace }}:{{ .Values.brainstore.fastreader.service.port }}"
BRAINSTORE_FAST_READER_QUERY_SOURCES: {{ include "braintrust.fastReaderQuerySourcesCsv" . | quote }}
BRAINSTORE_WRITER_URL: "http://{{ .Values.brainstore.writer.service.name | default .Values.brainstore.writer.name }}.{{ .Values.global.namespace }}:{{ .Values.brainstore.writer.service.port }}"
BRAINSTORE_BACKFILL_DISABLE_HISTORICAL: {{ .Values.api.backfillDisableHistorical | quote }}
BRAINSTORE_BACKFILL_DISABLE_NONHISTORICAL: {{ .Values.api.backfillDisableNonhistorical | quote }}
Expand Down
47 changes: 47 additions & 0 deletions braintrust/templates/brainstore-fastreader-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Values.brainstore.fastreader.name }}
namespace: {{ include "braintrust.namespace" . }}
{{- with (merge (deepCopy .Values.brainstore.fastreader.labels) .Values.global.labels) }}
labels:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.brainstore.fastreader.annotations.configmap }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
data:
BRAINSTORE_READER_ONLY_MODE: "true"
BRAINSTORE_VERBOSE: {{ (or (eq (toString .Values.brainstore.fastreader.verbose) "true") (eq (toString .Values.brainstore.fastreader.verbose) "1")) | ternary "1" "0" | quote }}
BRAINSTORE_PORT: {{ .Values.brainstore.fastreader.service.port | quote }}
BRAINSTORE_CACHE_DIR: {{ .Values.brainstore.fastreader.cacheDir | quote }}
BRAINSTORE_OBJECT_STORE_CACHE_MEMORY_LIMIT: {{ .Values.brainstore.fastreader.objectStoreCacheMemoryLimit | quote }}
BRAINSTORE_OBJECT_STORE_CACHE_FILE_SIZE: {{ .Values.brainstore.fastreader.objectStoreCacheFileSize | quote }}
{{- if eq .Values.cloud "azure" }}
# See here for reference:
# https://docs.rs/object_store/latest/object_store/azure/struct.MicrosoftAzureBuilder.html
AZURE_STORAGE_ACCOUNT_NAME: {{ .Values.objectStorage.azure.storageAccountName | quote }}
# This will create odd paths like az://brainstore/brainstore/index, but it maintains the naming and prefix conventions
# with AWS and avoids confusion with env vars.
BRAINSTORE_INDEX_URI: "az://{{ .Values.objectStorage.azure.brainstoreContainer }}/brainstore/index"
BRAINSTORE_REALTIME_WAL_URI: "az://{{ .Values.objectStorage.azure.brainstoreContainer }}/brainstore/wal"
{{- if eq .Values.brainstore.locksBackend "objectStorage" }}
BRAINSTORE_LOCKS_URI: "az://{{ .Values.objectStorage.azure.brainstoreContainer }}/brainstore/locks"
{{- end }}
{{- else if eq .Values.cloud "aws" }}
BRAINSTORE_INDEX_URI: "s3://{{ .Values.objectStorage.aws.brainstoreBucket }}/brainstore/index"
BRAINSTORE_REALTIME_WAL_URI: "s3://{{ .Values.objectStorage.aws.brainstoreBucket }}/brainstore/wal"
{{- if eq .Values.brainstore.locksBackend "objectStorage" }}
BRAINSTORE_LOCKS_URI: "s3://{{ .Values.objectStorage.aws.brainstoreBucket }}/brainstore/locks"
{{- end }}
{{- else if eq .Values.cloud "google" }}
BRAINSTORE_INDEX_URI: "gs://{{ .Values.objectStorage.google.brainstoreBucket }}/brainstore/index"
BRAINSTORE_REALTIME_WAL_URI: "gs://{{ .Values.objectStorage.google.brainstoreBucket }}/brainstore/wal"
{{- if eq .Values.brainstore.locksBackend "objectStorage" }}
BRAINSTORE_LOCKS_URI: "gs://{{ .Values.objectStorage.google.brainstoreBucket }}/brainstore/locks"
{{- end }}
{{- end }}
BRAINSTORE_CONTROL_PLANE_TELEMETRY: {{ .Values.global.controlPlaneTelemetry | quote }}
NO_COLOR: "1"
173 changes: 173 additions & 0 deletions braintrust/templates/brainstore-fastreader-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.brainstore.fastreader.name }}
namespace: {{ include "braintrust.namespace" . }}
{{- with (merge (deepCopy .Values.brainstore.fastreader.labels) .Values.global.labels) }}
labels:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.brainstore.fastreader.annotations.deployment }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.brainstore.fastreader.replicas }}
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 100%
maxUnavailable: 0
selector:
matchLabels:
app: {{ .Values.brainstore.fastreader.name }}
template:
metadata:
labels:
app: {{ .Values.brainstore.fastreader.name }}
{{- if eq .Values.cloud "azure" }}
azure.workload.identity/use: "true"
{{- end }}
{{- if eq .Values.cloud "google" }}
gke-workload-identity/use: "true"
{{- end }}
{{- with (merge (deepCopy .Values.brainstore.fastreader.podLabels) .Values.brainstore.fastreader.labels .Values.global.labels) }}
{{- toYaml . | nindent 8 }}
{{- end }}
annotations:
{{- if eq .Values.cloud "google" }}
iam.gke.io/gcp-service-account: {{ required "brainstore.serviceAccount.googleServiceAccount is required when cloud is google" .Values.brainstore.serviceAccount.googleServiceAccount }}
{{- end }}
{{- with .Values.brainstore.fastreader.annotations.pod }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
serviceAccountName: {{ .Values.brainstore.serviceAccount.name }}
{{- if or .Values.brainstore.fastreader.nodeSelector (and (eq .Values.cloud "google") (eq .Values.google.mode "autopilot")) }}
nodeSelector:
{{- with .Values.brainstore.fastreader.nodeSelector }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if and (eq .Values.cloud "google") (eq .Values.google.mode "autopilot") }}
cloud.google.com/machine-family: {{ .Values.google.autopilotMachineFamily | default "c4" }}
cloud.google.com/gke-ephemeral-storage-local-ssd: "true"
cloud.google.com/compute-class: "Performance"
{{- end }}
{{- end }}
{{- with .Values.brainstore.fastreader.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.brainstore.fastreader.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: brainstore-fastreader
image: "{{ .Values.brainstore.image.repository }}:{{ .Values.brainstore.image.tag }}"
imagePullPolicy: {{ .Values.brainstore.image.pullPolicy }}
command: ["brainstore"]
args: ["web"]
ports:
- containerPort: {{ .Values.brainstore.fastreader.service.port }}
resources:
requests:
cpu: {{ .Values.brainstore.fastreader.resources.requests.cpu | quote }}
memory: {{ .Values.brainstore.fastreader.resources.requests.memory | quote }}
{{- if and (eq .Values.cloud "google") (eq .Values.google.mode "autopilot") .Values.brainstore.fastreader.volume.size }}
ephemeral-storage: {{ .Values.brainstore.fastreader.volume.size | quote }}
{{- end }}
limits:
cpu: {{ .Values.brainstore.fastreader.resources.limits.cpu | quote }}
memory: {{ .Values.brainstore.fastreader.resources.limits.memory | quote }}
{{- with .Values.brainstore.livenessProbe }}
livenessProbe:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.brainstore.readinessProbe }}
readinessProbe:
{{- toYaml . | nindent 12 }}
{{- end }}
envFrom:
- configMapRef:
name: {{ .Values.brainstore.fastreader.name }}
env:
- name: BRAINSTORE_METADATA_URI
valueFrom:
secretKeyRef:
name: braintrust-secrets
key: PG_URL
- name: BRAINSTORE_WAL_URI
valueFrom:
secretKeyRef:
name: braintrust-secrets
key: PG_URL
- name: BRAINSTORE_REDIS_URI
valueFrom:
secretKeyRef:
name: braintrust-secrets
key: REDIS_URL
- name: BRAINSTORE_XACT_MANAGER_URI
valueFrom:
secretKeyRef:
name: braintrust-secrets
key: REDIS_URL
- name: BRAINSTORE_AI_PROXY_URL
value: "http://{{ .Values.api.service.name | default .Values.api.name }}:{{ .Values.api.service.port }}"
{{- if eq .Values.brainstore.locksBackend "redis" }}
- name: BRAINSTORE_LOCKS_URI
valueFrom:
secretKeyRef:
name: braintrust-secrets
key: REDIS_URL
{{- end }}
- name: BRAINSTORE_LICENSE_KEY
valueFrom:
secretKeyRef:
name: braintrust-secrets
key: BRAINSTORE_LICENSE_KEY
- name: FUNCTION_SECRET_KEY
valueFrom:
secretKeyRef:
name: braintrust-secrets
key: FUNCTION_SECRET_KEY
{{- if .Values.brainstore.fastreader.extraEnvVars }}
{{- toYaml .Values.brainstore.fastreader.extraEnvVars | nindent 12 }}
{{- end }}
volumeMounts:
- name: cache-volume
mountPath: {{ .Values.brainstore.fastreader.cacheDir }}
{{- if and (eq .Values.cloud "azure") .Values.azure.enableAzureKeyVaultDriver }}
- name: secrets-store-inline
mountPath: "/mnt/secrets-store"
readOnly: true
{{- end }}
{{- with .Values.brainstore.fastreader.extraContainers }}
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: cache-volume
{{- if and (eq .Values.cloud "azure") .Values.azure.enableAzureContainerStorageDriver }}
ephemeral:
volumeClaimTemplate:
spec:
volumeMode: Filesystem
accessModes: ["ReadWriteOnce"]
storageClassName: local
resources:
requests:
storage: {{ required "brainstore.fastreader.volume.size must be set" .Values.brainstore.fastreader.volume.size | quote }}
{{- else }}
emptyDir: {}
{{- end }}
{{- 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 }}
{{- with .Values.brainstore.fastreader.extraVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
22 changes: 22 additions & 0 deletions braintrust/templates/brainstore-fastreader-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.brainstore.fastreader.service.name | default .Values.brainstore.fastreader.name }}
namespace: {{ include "braintrust.namespace" . }}
{{- with (merge (deepCopy .Values.brainstore.fastreader.labels) .Values.global.labels) }}
labels:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.brainstore.fastreader.annotations.service }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
selector:
app: {{ .Values.brainstore.fastreader.name }}
ports:
- name: {{ .Values.brainstore.fastreader.service.portName }}
protocol: TCP
port: {{ .Values.brainstore.fastreader.service.port }}
targetPort: {{ .Values.brainstore.fastreader.service.port }}
type: {{ .Values.brainstore.fastreader.service.type }}
32 changes: 32 additions & 0 deletions braintrust/tests/__fixtures__/base-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,38 @@ brainstore:
nodeSelector: {}
tolerations: []
affinity: {}
fastreader:
name: "brainstore-fastreader"
labels: {}
podLabels: {}
annotations:
configmap: {}
deployment: {}
service: {}
pod: {}
replicas: 1
service:
name: ""
type: ClusterIP
port: 4000
portName: http
resources:
requests:
cpu: "4"
memory: "8Gi"
limits:
cpu: "8"
memory: "16Gi"
cacheDir: "/mnt/tmp/brainstore"
objectStoreCacheMemoryLimit: "1Gi"
objectStoreCacheFileSize: "50Gi"
verbose: true
volume:
size: "100Gi"
extraEnvVars: []
nodeSelector: {}
tolerations: []
affinity: {}
writer:
name: "brainstore-writer"
labels: {}
Expand Down
Loading