251 lines
11 KiB
YAML
251 lines
11 KiB
YAML
{{- /* StatefulSet is used for: sqlite mode with persistence enabled and no existingClaim */}}
|
|
{{- $useStatefulSet := and (eq .Values.storage.mode "sqlite") .Values.storage.persistence.enabled (not .Values.storage.persistence.existingClaim) }}
|
|
{{- if $useStatefulSet }}
|
|
{{- if not .Values.image.tag }}
|
|
{{- fail "ERROR: image.tag is required. Please specify the Bifrost image version (e.g., --set image.tag=v1.3.36). See available tags at https://hub.docker.com/r/maximhq/bifrost/tags" }}
|
|
{{- end }}
|
|
{{- include "bifrost.validate" . }}
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: {{ include "bifrost.fullname" . }}
|
|
namespace: {{ .Release.Namespace }}
|
|
labels:
|
|
{{- include "bifrost.labels" . | nindent 4 }}
|
|
{{- with .Values.deploymentLabels }}
|
|
{{- toYaml . | nindent 4 }}
|
|
{{- end }}
|
|
{{- with .Values.deploymentAnnotations }}
|
|
annotations:
|
|
{{- toYaml . | nindent 4 }}
|
|
{{- end }}
|
|
spec:
|
|
serviceName: {{ include "bifrost.fullname" . }}-headless
|
|
{{- if not .Values.autoscaling.enabled }}
|
|
replicas: {{ .Values.replicaCount }}
|
|
{{- end }}
|
|
selector:
|
|
matchLabels:
|
|
{{- include "bifrost.serverSelectorLabels" . | nindent 6 }}
|
|
template:
|
|
metadata:
|
|
annotations:
|
|
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
|
|
{{- with .Values.podAnnotations }}
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
labels:
|
|
{{- include "bifrost.labels" . | nindent 8 }}
|
|
app.kubernetes.io/component: server
|
|
{{- with .Values.podLabels }}
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
spec:
|
|
{{- with .Values.imagePullSecrets }}
|
|
imagePullSecrets:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
serviceAccountName: {{ include "bifrost.serviceAccountName" . }}
|
|
securityContext:
|
|
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
|
{{- if .Values.terminationGracePeriodSeconds }}
|
|
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
|
|
{{- end }}
|
|
{{- with .Values.initContainers }}
|
|
initContainers:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
containers:
|
|
- name: {{ .Chart.Name }}
|
|
securityContext:
|
|
{{- toYaml .Values.securityContext | nindent 12 }}
|
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
|
{{- with .Values.lifecycle }}
|
|
lifecycle:
|
|
{{- toYaml . | nindent 12 }}
|
|
{{- end }}
|
|
ports:
|
|
- name: http
|
|
containerPort: {{ .Values.bifrost.port }}
|
|
protocol: TCP
|
|
{{- if .Values.bifrost.cluster.enabled }}
|
|
- name: gossip
|
|
containerPort: {{ .Values.bifrost.cluster.gossip.port }}
|
|
protocol: TCP
|
|
- name: gossip-udp
|
|
containerPort: {{ .Values.bifrost.cluster.gossip.port }}
|
|
protocol: UDP
|
|
{{- end }}
|
|
env:
|
|
- name: APP_DIR
|
|
value: {{ .Values.bifrost.appDir | quote }}
|
|
- name: APP_PORT
|
|
value: {{ .Values.bifrost.port | quote }}
|
|
- name: APP_HOST
|
|
value: {{ .Values.bifrost.host | quote }}
|
|
- name: LOG_LEVEL
|
|
value: {{ .Values.bifrost.logLevel | quote }}
|
|
- name: LOG_STYLE
|
|
value: {{ .Values.bifrost.logStyle | quote }}
|
|
{{- if .Values.bifrost.encryptionKeySecret }}
|
|
- name: BIFROST_ENCRYPTION_KEY
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ .Values.bifrost.encryptionKeySecret.name }}
|
|
key: {{ .Values.bifrost.encryptionKeySecret.key }}
|
|
{{- end }}
|
|
{{- if and .Values.bifrost.plugins.semanticCache.enabled .Values.bifrost.plugins.semanticCache.secretRef .Values.bifrost.plugins.semanticCache.secretRef.name }}
|
|
- name: SEMANTIC_CACHE_API_KEY
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ .Values.bifrost.plugins.semanticCache.secretRef.name }}
|
|
key: {{ .Values.bifrost.plugins.semanticCache.secretRef.key | default "api-key" }}
|
|
{{- end }}
|
|
{{- /* PostgreSQL password from existing secret */ -}}
|
|
{{- if and .Values.postgresql.external.enabled .Values.postgresql.external.existingSecret }}
|
|
- name: BIFROST_POSTGRES_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ .Values.postgresql.external.existingSecret }}
|
|
key: {{ .Values.postgresql.external.passwordKey | default "password" }}
|
|
{{- end }}
|
|
{{- /* Redis password from existing secret */ -}}
|
|
{{- if and .Values.vectorStore.enabled (eq .Values.vectorStore.type "redis") .Values.vectorStore.redis.external.enabled .Values.vectorStore.redis.external.existingSecret }}
|
|
- name: BIFROST_REDIS_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ .Values.vectorStore.redis.external.existingSecret }}
|
|
key: {{ .Values.vectorStore.redis.external.passwordKey | default "password" }}
|
|
{{- end }}
|
|
{{- /* Weaviate API key from existing secret */ -}}
|
|
{{- if and .Values.vectorStore.enabled (eq .Values.vectorStore.type "weaviate") .Values.vectorStore.weaviate.external.enabled .Values.vectorStore.weaviate.external.existingSecret }}
|
|
- name: BIFROST_WEAVIATE_API_KEY
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ .Values.vectorStore.weaviate.external.existingSecret }}
|
|
key: {{ .Values.vectorStore.weaviate.external.apiKeyKey | default "api-key" }}
|
|
{{- end }}
|
|
{{- /* Qdrant API key from existing secret */ -}}
|
|
{{- if and .Values.vectorStore.enabled (eq .Values.vectorStore.type "qdrant") .Values.vectorStore.qdrant.external.enabled .Values.vectorStore.qdrant.external.existingSecret }}
|
|
- name: BIFROST_QDRANT_API_KEY
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ .Values.vectorStore.qdrant.external.existingSecret }}
|
|
key: {{ .Values.vectorStore.qdrant.external.apiKeyKey | default "api-key" }}
|
|
{{- end }}
|
|
{{- /* Pinecone API key from existing secret */ -}}
|
|
{{- if and .Values.vectorStore.enabled (eq .Values.vectorStore.type "pinecone") .Values.vectorStore.pinecone.external.enabled .Values.vectorStore.pinecone.external.existingSecret }}
|
|
- name: BIFROST_PINECONE_API_KEY
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ .Values.vectorStore.pinecone.external.existingSecret }}
|
|
key: {{ .Values.vectorStore.pinecone.external.apiKeyKey | default "api-key" }}
|
|
{{- end }}
|
|
{{- /* Maxim API key from existing secret */ -}}
|
|
{{- if and .Values.bifrost.plugins.maxim.enabled .Values.bifrost.plugins.maxim.secretRef .Values.bifrost.plugins.maxim.secretRef.name }}
|
|
- name: BIFROST_MAXIM_API_KEY
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ .Values.bifrost.plugins.maxim.secretRef.name }}
|
|
key: {{ .Values.bifrost.plugins.maxim.secretRef.key | default "api-key" }}
|
|
{{- end }}
|
|
{{- /* Governance auth credentials from existing secret */ -}}
|
|
{{- if and .Values.bifrost.governance .Values.bifrost.governance.authConfig .Values.bifrost.governance.authConfig.existingSecret }}
|
|
- name: BIFROST_ADMIN_USERNAME
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ .Values.bifrost.governance.authConfig.existingSecret }}
|
|
key: {{ .Values.bifrost.governance.authConfig.usernameKey | default "username" }}
|
|
- name: BIFROST_ADMIN_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ .Values.bifrost.governance.authConfig.existingSecret }}
|
|
key: {{ .Values.bifrost.governance.authConfig.passwordKey | default "password" }}
|
|
{{- end }}
|
|
{{- /* Top-level auth credentials from existing secret (reuses same env vars as governance) */ -}}
|
|
{{- if and .Values.bifrost.authConfig .Values.bifrost.authConfig.existingSecret (not (and .Values.bifrost.governance .Values.bifrost.governance.authConfig .Values.bifrost.governance.authConfig.existingSecret)) }}
|
|
- name: BIFROST_ADMIN_USERNAME
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ .Values.bifrost.authConfig.existingSecret }}
|
|
key: {{ .Values.bifrost.authConfig.usernameKey | default "username" }}
|
|
- name: BIFROST_ADMIN_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ .Values.bifrost.authConfig.existingSecret }}
|
|
key: {{ .Values.bifrost.authConfig.passwordKey | default "password" }}
|
|
{{- end }}
|
|
{{- /* Provider secrets */ -}}
|
|
{{- range $provider, $secret := .Values.bifrost.providerSecrets }}
|
|
{{- if and $secret.existingSecret $secret.envVar }}
|
|
- name: {{ $secret.envVar }}
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ $secret.existingSecret }}
|
|
key: {{ $secret.key | default "api-key" }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- with .Values.env }}
|
|
{{- toYaml . | nindent 12 }}
|
|
{{- end }}
|
|
{{- with .Values.envFrom }}
|
|
envFrom:
|
|
{{- toYaml . | nindent 12 }}
|
|
{{- end }}
|
|
livenessProbe:
|
|
{{- toYaml .Values.livenessProbe | nindent 12 }}
|
|
readinessProbe:
|
|
{{- toYaml .Values.readinessProbe | nindent 12 }}
|
|
resources:
|
|
{{- toYaml .Values.resources | nindent 12 }}
|
|
volumeMounts:
|
|
- name: data
|
|
mountPath: {{ .Values.bifrost.appDir }}
|
|
- name: config
|
|
mountPath: {{ .Values.bifrost.appDir }}/config.json
|
|
subPath: config.json
|
|
readOnly: true
|
|
{{- with .Values.volumeMounts }}
|
|
{{- toYaml . | nindent 12 }}
|
|
{{- end }}
|
|
volumes:
|
|
- name: config
|
|
configMap:
|
|
name: {{ include "bifrost.fullname" . }}-config
|
|
{{- with .Values.volumes }}
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.nodeSelector }}
|
|
nodeSelector:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.affinity }}
|
|
affinity:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.tolerations }}
|
|
tolerations:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
volumeClaimTemplates:
|
|
- metadata:
|
|
name: data
|
|
labels:
|
|
{{- include "bifrost.labels" . | nindent 10 }}
|
|
spec:
|
|
accessModes:
|
|
- {{ .Values.storage.persistence.accessMode }}
|
|
{{- if .Values.storage.persistence.storageClass }}
|
|
{{- if (eq "-" .Values.storage.persistence.storageClass) }}
|
|
storageClassName: ""
|
|
{{- else }}
|
|
storageClassName: {{ .Values.storage.persistence.storageClass }}
|
|
{{- end }}
|
|
{{- end }}
|
|
resources:
|
|
requests:
|
|
storage: {{ .Values.storage.persistence.size }}
|
|
{{- end }}
|
|
|