added repo

This commit is contained in:
Your Name
2026-08-26 03:39:42 +05:30
parent 45c25a95af
commit b8575bb8b9
6889 changed files with 1217125 additions and 0 deletions
@@ -0,0 +1,59 @@
Bifrost has been installed!
{{- if .Values.ingress.enabled }}
1. Access Bifrost at:
{{- range .Values.ingress.hosts }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ .host }}
{{- end }}
{{- else if eq .Values.service.type "LoadBalancer" }}
1. Get the LoadBalancer IP:
kubectl get svc {{ include "bifrost.fullname" . }} -n {{ .Release.Namespace }}
2. Access Bifrost at:
http://<EXTERNAL-IP>:{{ .Values.service.port }}
{{- else if eq .Values.service.type "NodePort" }}
1. Get the NodePort:
export NODE_PORT=$(kubectl get svc {{ include "bifrost.fullname" . }} -n {{ .Release.Namespace }} -o jsonpath='{.spec.ports[0].nodePort}')
export NODE_IP=$(kubectl get nodes -o jsonpath='{.items[0].status.addresses[?(@.type=="ExternalIP")].address}' || kubectl get nodes -o jsonpath='{.items[0].status.addresses[?(@.type=="InternalIP")].address}')
2. Access Bifrost at:
http://$NODE_IP:$NODE_PORT
{{- else }}
1. Port-forward to access Bifrost:
kubectl port-forward svc/{{ include "bifrost.fullname" . }} 8080:{{ .Values.service.port }} -n {{ .Release.Namespace }}
2. Access Bifrost at:
http://localhost:8080
{{- end }}
Configuration:
- Storage Mode: {{ .Values.storage.mode }}
{{- if eq .Values.storage.mode "postgres" }}
{{- if .Values.postgresql.enabled }}
- PostgreSQL: Deployed
{{- else }}
- PostgreSQL: External ({{ .Values.postgresql.external.host }})
{{- end }}
{{- else }}
- SQLite: Using persistent volume ({{ .Values.storage.persistence.size }})
{{- end }}
{{- if and .Values.vectorStore.enabled (ne .Values.vectorStore.type "none") }}
- Vector Store: {{ .Values.vectorStore.type }}
{{- end }}
{{- if .Values.autoscaling.enabled }}
- Autoscaling: Enabled ({{ .Values.autoscaling.minReplicas }}-{{ .Values.autoscaling.maxReplicas }} replicas)
{{- else }}
- Replicas: {{ .Values.replicaCount }}
{{- end }}
Metrics: http://{{ include "bifrost.fullname" . }}:{{ .Values.service.port }}/metrics
For documentation, visit: https://www.getbifrost.ai/docs
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,10 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "bifrost.fullname" . }}-config
namespace: {{ .Release.Namespace }}
labels:
{{- include "bifrost.labels" . | nindent 4 }}
data:
config.json: |
{{- include "bifrost.config" . | nindent 4 }}
@@ -0,0 +1,242 @@
{{- /* Use Deployment when: postgres mode, OR sqlite without persistence, OR sqlite with existingClaim */}}
{{- /* 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 not $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: Deployment
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:
{{- 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:
{{- if eq .Values.storage.mode "sqlite" }}
- name: data
mountPath: {{ .Values.bifrost.appDir }}
{{- end }}
- 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
{{- if eq .Values.storage.mode "sqlite" }}
- name: data
{{- if .Values.storage.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ .Values.storage.persistence.existingClaim | default (printf "%s-data" (include "bifrost.fullname" .)) }}
{{- else }}
emptyDir: {}
{{- end }}
{{- end }}
{{- 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 }}
{{- end }}
@@ -0,0 +1,27 @@
{{- if .Values.externalSecret.enabled }}
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: {{ .Values.externalSecret.secretName | default (printf "%s-vault" (include "bifrost.fullname" .)) }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "bifrost.labels" . | nindent 4 }}
annotations:
argocd.argoproj.io/sync-wave: "-5"
spec:
dataFrom:
- extract:
conversionStrategy: Default
key: {{ .Values.externalSecret.path }}
{{- if .Values.externalSecret.version }}
version: {{ .Values.externalSecret.version | quote }}
{{- end }}
refreshInterval: {{ .Values.externalSecret.refreshInterval | default "0" | quote }}
secretStoreRef:
kind: ClusterSecretStore
name: {{ .Values.externalSecret.secretStoreRef | default "vault-backend" }}
target:
name: {{ .Values.externalSecret.secretName | default (printf "%s-vault" (include "bifrost.fullname" .)) }}
creationPolicy: Owner
deletionPolicy: Retain
{{- end }}
+38
View File
@@ -0,0 +1,38 @@
{{- if .Values.autoscaling.enabled }}
{{- $useStatefulSet := and (eq .Values.storage.mode "sqlite") .Values.storage.persistence.enabled (not .Values.storage.persistence.existingClaim) }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "bifrost.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "bifrost.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: {{ if $useStatefulSet }}StatefulSet{{ else }}Deployment{{ end }}
name: {{ include "bifrost.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- with .Values.autoscaling.behavior }}
behavior:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
@@ -0,0 +1,149 @@
{{- if .Values.httpProxy.enabled -}}
{{- if .Values.createContourGateway -}}
{{- if or (eq "contour-internal" .Values.ingress.ingressClassName) (eq "contour-internal-0" .Values.ingress.ingressClassName) (eq "contour-internal-1" .Values.ingress.ingressClassName) }}
{{- $servicePortNumber := .Values.ingress.servicePortNumber | default 80 -}}
{{- $namespace := .Values.namespace -}}
{{- /* resolve intra ingress class */ -}}
{{- $intraIngressClass := "" -}}
{{- if eq .Values.ingress.ingressClassName "contour-internal" -}}
{{- $intraIngressClass = "contour-internal-intra" -}}
{{- else if eq .Values.ingress.ingressClassName "contour-internal-0" -}}
{{- $intraIngressClass = "contour-internal-intra-0" -}}
{{- else if eq .Values.ingress.ingressClassName "contour-internal-1" -}}
{{- $intraIngressClass = "contour-internal-intra-1" -}}
{{- end -}}
{{ $count := 0 | int }}
{{- range .Values.ingress.hosts }}
{{- $hasName := hasKey . "name" -}}
{{- $proxyName := ternary .intraName (printf "%s-intra-%d" $namespace $count) (hasKey . "intraName") -}}
{{- $childProxyName := printf "%s-intra" $namespace -}}
apiVersion: projectcontour.io/v1
kind: HTTPProxy
metadata:
namespace: {{ $namespace }}
name: {{ $proxyName }}
labels:
{{- include "bifrost.labels" $ | nindent 4 }}
annotations:
projectcontour.io/ingress.class: {{ $intraIngressClass }}
spec:
ingressClassName: {{ $intraIngressClass }}
virtualhost:
fqdn: "{{ .host }}"
routes:
{{- range .paths }}
{{- if hasKey . "backends" }}
- conditions:
{{- if or (eq (lower .pathType) "prefix") (eq (lower .pathType) "implementationspecific") }}
- prefix: {{ .path }}
{{- end }}
{{- if eq (lower .pathType) "exact" }}
- exact: {{ .path }}
{{- end }}
{{- if eq (lower .pathType) "regex" }}
- regex: {{ .path }}
{{- end }}
{{- if hasKey . "header" }}
- header:
name: {{ (split "___" .header)._0 }}
{{ (split "___" .header)._1 }}: {{ (split "___" .header)._2 }}
{{ end }}
services:
{{ range .backends }}
{{- $svc := .service -}}
{{- $hasSlash := contains "/" $svc -}}
{{- $svcName := ternary (split "/" $svc)._1 $svc $hasSlash -}}
{{- $targetNs := ternary .namespace (ternary (split "/" $svc)._0 $namespace $hasSlash) (hasKey . "namespace") -}}
{{- $useAlias := ne $targetNs $namespace -}}
{{- $aliasName := printf "%s-xns-%s" $svcName $targetNs | trunc 63 | trimSuffix "-" -}}
- name: {{ ternary $aliasName $svcName $useAlias }}
port: {{ $servicePortNumber }}
{{- if .weight }}
weight: {{ .weight }}
{{- end }}
{{- if $.Values.ingress.slowStart.enabled }}
slowStartPolicy:
window: {{ $.Values.ingress.slowStart.window }}
aggression: {{ $.Values.ingress.slowStart.aggression | float64 | squote }}
minWeightPercent: {{ $.Values.ingress.slowStart.minPercent }}
{{- end }}
{{ end }}
{{- end }}
{{- end }}
includes:
{{- range .paths }}
{{- if not (hasKey . "backends") }}
- conditions:
{{- if or (eq (lower .pathType) "prefix") (eq (lower .pathType) "implementationspecific") }}
- prefix: {{ .path }}
{{- end }}
{{- if eq (lower .pathType) "exact" }}
- exact: {{ .path }}
{{- end }}
{{- if eq (lower .pathType) "regex" }}
- regex: {{ .path }}
{{- end }}
{{- if eq (lower .pathType) "header" }}
- header:
name: {{ (split "___" .path)._0 }}
{{ (split "___" .path)._1 }}: {{ (split "___" .path)._2 }}
{{- end }}
{{- if eq (lower .pathType) "prefixheader" }}
- prefix: {{ (split "___" .path)._0 }}
- header:
name: {{ (split "___" .path)._1 }}
{{ (split "___" .path)._2 }}: {{ (split "___" .path)._3 }}
{{- end }}
{{- if .targetService }}
name: {{ .targetService | replace "/" "-" }}-intra
namespace: {{ (split "/" .targetService)._0 }}
{{- else }}
name: {{ $childProxyName }}
namespace: {{ $namespace }}
{{- end }}
{{- end }}
{{- end }}
---
{{- if not $hasName }}
{{ $count = add1 $count }}
{{- /* Child Intra HTTPProxy - routes with services */}}
apiVersion: projectcontour.io/v1
kind: HTTPProxy
metadata:
namespace: {{ $namespace }}
name: {{ $childProxyName }}
labels:
{{- include "bifrost.labels" $ | nindent 4 }}
annotations:
projectcontour.io/ingress.class: {{ $intraIngressClass }}
spec:
ingressClassName: {{ $intraIngressClass }}
routes:
- services:
- name: {{ $namespace }}
port: {{ $servicePortNumber | default "80" }}
{{- if $.Values.ingress.slowStart.enabled }}
slowStartPolicy:
window: {{ $.Values.ingress.slowStart.window }}
aggression: {{ $.Values.ingress.slowStart.aggression | float64 | squote }}
minWeightPercent: {{ $.Values.ingress.slowStart.minPercent }}
{{- end }}
{{- if $.Values.ingress.enableWebsocket }}
enableWebsockets: true
{{- end }}
{{- if $.Values.contourResponseTimeout }}
timeoutPolicy:
response: {{ $.Values.contourResponseTimeout }}
{{- end }}
---
{{- else }}
{{ $count = add1 $count }}
{{- end }}
{{ end }}
{{- end -}}
{{- end -}}
{{- end -}}
@@ -0,0 +1,149 @@
{{- if .Values.httpProxy.enabled -}}
{{- if .Values.createContourGateway -}}
{{- if or ( eq "contour-internal" .Values.ingress.ingressClassName ) ( eq "contour-external" .Values.ingress.ingressClassName ) ( eq "contour-internal-0" .Values.ingress.ingressClassName ) ( eq "contour-internal-1" .Values.ingress.ingressClassName ) ( eq "contour-external-0" .Values.ingress.ingressClassName ) ( eq "contour-external-1" .Values.ingress.ingressClassName ) }}
{{- $servicePortNumber := .Values.ingress.servicePortNumber | default 80 -}}
{{- $servicePort := .Values.ingress.servicePort -}}
{{- $pathType := .Values.ingress.pathType -}}
{{- $namespace := .Values.namespace -}}
{{- $ingressClassName := .Values.ingress.ingressClassName -}}
{{ $count := 0 | int }}
{{- range .Values.ingress.hosts }}
{{- $hasName := hasKey . "name" -}}
{{- $proxyName := ternary .name (printf "%s-%d" $namespace $count) (hasKey . "name") -}}
{{- $childProxyName := $namespace -}}
apiVersion: projectcontour.io/v1
kind: HTTPProxy
metadata:
namespace: {{ $namespace }}
name: {{ $proxyName }}
labels:
{{- include "bifrost.labels" $ | nindent 4 }}
annotations:
projectcontour.io/ingress.class: {{ $.Values.ingress.ingressClassName }}
spec:
ingressClassName: {{ $ingressClassName }}
virtualhost:
fqdn: "{{ .host }}"
{{- /* 1) Weighted paths render here as routes with services */}}
routes:
{{- range .paths }}
{{- if hasKey . "backends" }}
- conditions:
{{- if or ( eq ( lower .pathType ) "prefix" ) ( eq ( lower .pathType ) "implementationspecific") }}
- prefix: {{ .path }}
{{- end }}
{{- if ( eq ( lower .pathType ) "exact" ) }}
- exact: {{ .path }}
{{- end }}
{{- if ( eq ( lower .pathType ) "regex" ) }}
- regex: {{ .path }}
{{- end }}
{{- if ( eq ( lower .pathType ) "header" ) }}
- header:
name: {{ (split "___" .path)._0 }}
{{ (split "___" .path)._1 }}: {{ (split "___" .path)._2 }}
{{- end }}
{{- if ( eq ( lower .pathType ) "prefixheader" ) }}
- prefix: {{ (split "___" .path)._0 }}
- header:
name: {{ (split "___" .path)._1 }}
{{ (split "___" .path)._2 }}: {{ (split "___" .path)._3 }}
{{- end }}
services:
{{ range .backends }}
{{- $svc := .service -}}
{{- $hasSlash := contains "/" $svc -}}
{{- $svcName := ternary (split "/" $svc)._1 $svc $hasSlash -}}
{{- $targetNs := ternary .namespace (ternary (split "/" $svc)._0 $.Values.namespace $hasSlash) (hasKey . "namespace") -}}
{{- $useAlias := ne $targetNs $.Values.namespace -}}
{{- $aliasName := printf "%s-xns-%s" $svcName $targetNs | trunc 63 | trimSuffix "-" -}}
- name: {{ ternary $aliasName $svcName $useAlias }}
port: {{ $servicePortNumber }}
{{- if .weight }}
weight: {{ .weight }}
{{- end }}
{{- if $.Values.ingress.slowStart.enabled }}
slowStartPolicy:
window: {{ $.Values.ingress.slowStart.window }}
aggression: {{ $.Values.ingress.slowStart.aggression | float64 | squote }}
minWeightPercent: {{ $.Values.ingress.slowStart.minPercent }}
{{- end }}
{{ end }}
{{- end }}
{{- end }}
{{- /* 2) Non-weighted paths keep using includes to your upstreams */}}
includes:
{{- range .paths }}
{{- if not (hasKey . "backends") }}
- conditions:
{{- if or ( eq ( lower .pathType ) "prefix" ) ( eq ( lower .pathType ) "implementationspecific") }}
- prefix: {{ .path }}
{{- end }}
{{- if ( eq ( lower .pathType ) "exact" ) }}
- exact: {{ .path }}
{{- end }}
{{- if ( eq ( lower .pathType ) "regex" ) }}
- regex: {{ .path }}
{{- end }}
{{- if ( eq ( lower .pathType ) "header" ) }}
- header:
name: {{ (split "___" .path)._0 }}
{{ (split "___" .path)._1 }}: {{ (split "___" .path)._2 }}
{{- end }}
{{- if ( eq ( lower .pathType ) "prefixheader" ) }}
- prefix: {{ (split "___" .path)._0 }}
- header:
name: {{ (split "___" .path)._1 }}
{{ (split "___" .path)._2 }}: {{ (split "___" .path)._3 }}
{{- end }}
{{- if .targetService }}
name: {{ .targetService | replace "/" "-" }}
namespace: {{ (split "/" .targetService)._0 }}
{{- else }}
name: {{ $childProxyName }}
namespace: {{ $namespace }}
{{- end }}
{{- end }}
{{- end }}
---
{{- if not $hasName }}
{{ $count = add1 $count }}
{{- /* Child HTTPProxy - routes with services */}}
apiVersion: projectcontour.io/v1
kind: HTTPProxy
metadata:
namespace: {{ $namespace }}
name: {{ $childProxyName }}
labels:
{{- include "bifrost.labels" $ | nindent 4 }}
annotations:
projectcontour.io/ingress.class: {{ $ingressClassName }}
spec:
ingressClassName: {{ $ingressClassName }}
routes:
- services:
- name: {{ $namespace }}
port: {{ $servicePortNumber | default "80" }}
{{- if $.Values.ingress.slowStart.enabled }}
slowStartPolicy:
window: {{ $.Values.ingress.slowStart.window }}
aggression: {{ $.Values.ingress.slowStart.aggression | float64 | squote }}
minWeightPercent: {{ $.Values.ingress.slowStart.minPercent }}
{{- end }}
{{- if $.Values.ingress.enableWebsocket }}
enableWebsockets: true
{{- end }}
{{- if $.Values.contourResponseTimeout }}
timeoutPolicy:
response: {{ $.Values.contourResponseTimeout }}
{{- end }}
---
{{- else }}
{{ $count = add1 $count }}
{{- end }}
{{ end }}
{{- end -}}
{{- end -}}
{{- end -}}
@@ -0,0 +1,42 @@
{{- if .Values.ingress.enabled -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "bifrost.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "bifrost.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.className }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
pathType: {{ .pathType }}
backend:
service:
name: {{ include "bifrost.fullname" $ }}
port:
number: {{ $.Values.service.port }}
{{- end }}
{{- end }}
{{- end }}
+18
View File
@@ -0,0 +1,18 @@
{{- if .Values.podDisruptionBudget.enabled }}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ include "bifrost.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "bifrost.labels" . | nindent 4 }}
spec:
{{- if .Values.podDisruptionBudget.minAvailable }}
minAvailable: {{ .Values.podDisruptionBudget.minAvailable }}
{{- else }}
maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable | default "10%" }}
{{- end }}
selector:
matchLabels:
{{- include "bifrost.serverSelectorLabels" . | nindent 6 }}
{{- end }}
@@ -0,0 +1,79 @@
{{- if and (eq .Values.storage.mode "postgres") .Values.postgresql.enabled (not .Values.postgresql.external.enabled) }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "bifrost.fullname" . }}-postgresql
namespace: {{ .Release.Namespace }}
labels:
{{- include "bifrost.labels" . | nindent 4 }}
app.kubernetes.io/component: database
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
{{- include "bifrost.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: database
template:
metadata:
labels:
{{- include "bifrost.labels" . | nindent 8 }}
app.kubernetes.io/component: database
spec:
securityContext:
fsGroup: 999
containers:
- name: postgresql
image: "{{ .Values.postgresql.image.repository }}:{{ .Values.postgresql.image.tag }}"
imagePullPolicy: {{ .Values.postgresql.image.pullPolicy }}
ports:
- name: postgresql
containerPort: 5432
protocol: TCP
env:
- name: POSTGRES_USER
value: {{ .Values.postgresql.auth.username | quote }}
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "bifrost.fullname" . }}-postgresql
key: password
- name: POSTGRES_DB
value: {{ .Values.postgresql.auth.database | quote }}
- name: PGDATA
value: /var/lib/postgresql/data/pgdata
livenessProbe:
exec:
command:
- /bin/sh
- -c
- pg_isready -U "{{ .Values.postgresql.auth.username }}"
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 6
readinessProbe:
exec:
command:
- /bin/sh
- -c
- pg_isready -U "{{ .Values.postgresql.auth.username }}"
initialDelaySeconds: 5
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 6
resources:
{{- toYaml .Values.postgresql.primary.resources | nindent 12 }}
volumeMounts:
- name: data
mountPath: /var/lib/postgresql/data
volumes:
- name: data
{{- if .Values.postgresql.primary.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ include "bifrost.fullname" . }}-postgresql
{{- else }}
emptyDir: {}
{{- end }}
{{- end }}
@@ -0,0 +1,23 @@
{{- if and (eq .Values.storage.mode "postgres") .Values.postgresql.enabled (not .Values.postgresql.external.enabled) .Values.postgresql.primary.persistence.enabled }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "bifrost.fullname" . }}-postgresql
namespace: {{ .Release.Namespace }}
labels:
{{- include "bifrost.labels" . | nindent 4 }}
app.kubernetes.io/component: database
spec:
accessModes:
- ReadWriteOnce
{{- if .Values.postgresql.primary.persistence.storageClass }}
{{- if (eq "-" .Values.postgresql.primary.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: {{ .Values.postgresql.primary.persistence.storageClass }}
{{- end }}
{{- end }}
resources:
requests:
storage: {{ .Values.postgresql.primary.persistence.size }}
{{- end }}
@@ -0,0 +1,20 @@
{{- if and (eq .Values.storage.mode "postgres") .Values.postgresql.enabled (not .Values.postgresql.external.enabled) }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "bifrost.fullname" . }}-postgresql
namespace: {{ .Release.Namespace }}
labels:
{{- include "bifrost.labels" . | nindent 4 }}
app.kubernetes.io/component: database
spec:
type: ClusterIP
ports:
- port: 5432
targetPort: postgresql
protocol: TCP
name: postgresql
selector:
{{- include "bifrost.selectorLabels" . | nindent 4 }}
app.kubernetes.io/component: database
{{- end }}
@@ -0,0 +1,65 @@
{{- if and .Values.vectorStore.enabled (eq .Values.vectorStore.type "qdrant") .Values.vectorStore.qdrant.enabled (not .Values.vectorStore.qdrant.external.enabled) }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "bifrost.fullname" . }}-qdrant
namespace: {{ .Release.Namespace }}
labels:
{{- include "bifrost.labels" . | nindent 4 }}
app.kubernetes.io/component: vectorstore
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
{{- include "bifrost.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: vectorstore-qdrant
template:
metadata:
labels:
{{- include "bifrost.labels" . | nindent 8 }}
app.kubernetes.io/component: vectorstore-qdrant
spec:
containers:
- name: qdrant
image: "{{ .Values.vectorStore.qdrant.image.repository }}:{{ .Values.vectorStore.qdrant.image.tag }}"
imagePullPolicy: {{ .Values.vectorStore.qdrant.image.pullPolicy }}
ports:
- name: http
containerPort: 6333
protocol: TCP
- name: grpc
containerPort: 6334
protocol: TCP
livenessProbe:
httpGet:
path: /readyz
port: http
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
httpGet:
path: /readyz
port: http
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
resources:
{{- toYaml .Values.vectorStore.qdrant.resources | nindent 12 }}
volumeMounts:
- name: data
mountPath: /qdrant/storage
volumes:
- name: data
{{- if .Values.vectorStore.qdrant.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ include "bifrost.fullname" . }}-qdrant
{{- else }}
emptyDir: {}
{{- end }}
{{- end }}
@@ -0,0 +1,24 @@
{{- if and .Values.vectorStore.enabled (eq .Values.vectorStore.type "qdrant") .Values.vectorStore.qdrant.enabled (not .Values.vectorStore.qdrant.external.enabled) .Values.vectorStore.qdrant.persistence.enabled }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "bifrost.fullname" . }}-qdrant
namespace: {{ .Release.Namespace }}
labels:
{{- include "bifrost.labels" . | nindent 4 }}
app.kubernetes.io/component: vectorstore-qdrant
spec:
accessModes:
- ReadWriteOnce
{{- if .Values.vectorStore.qdrant.persistence.storageClass }}
{{- if (eq "-" .Values.vectorStore.qdrant.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: {{ .Values.vectorStore.qdrant.persistence.storageClass }}
{{- end }}
{{- end }}
resources:
requests:
storage: {{ .Values.vectorStore.qdrant.persistence.size }}
{{- end }}
@@ -0,0 +1,25 @@
{{- if and .Values.vectorStore.enabled (eq .Values.vectorStore.type "qdrant") .Values.vectorStore.qdrant.enabled (not .Values.vectorStore.qdrant.external.enabled) }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "bifrost.fullname" . }}-qdrant
namespace: {{ .Release.Namespace }}
labels:
{{- include "bifrost.labels" . | nindent 4 }}
app.kubernetes.io/component: vectorstore-qdrant
spec:
type: ClusterIP
ports:
- port: 6333
targetPort: http
protocol: TCP
name: http
- port: 6334
targetPort: grpc
protocol: TCP
name: grpc
selector:
{{- include "bifrost.selectorLabels" . | nindent 4 }}
app.kubernetes.io/component: vectorstore-qdrant
{{- end }}
@@ -0,0 +1,89 @@
{{- if and .Values.vectorStore.enabled (eq .Values.vectorStore.type "redis") .Values.vectorStore.redis.enabled (not .Values.vectorStore.redis.external.enabled) }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "bifrost.fullname" . }}-redis-master
namespace: {{ .Release.Namespace }}
labels:
{{- include "bifrost.labels" . | nindent 4 }}
app.kubernetes.io/component: redis
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
{{- include "bifrost.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: redis
template:
metadata:
labels:
{{- include "bifrost.labels" . | nindent 8 }}
app.kubernetes.io/component: redis
spec:
containers:
- name: redis
image: "{{ .Values.vectorStore.redis.image.repository }}:{{ .Values.vectorStore.redis.image.tag }}"
imagePullPolicy: {{ .Values.vectorStore.redis.image.pullPolicy }}
ports:
- name: redis
containerPort: 6379
protocol: TCP
env:
{{- if .Values.vectorStore.redis.auth.enabled }}
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "bifrost.fullname" . }}-redis
key: password
{{- end }}
{{- if .Values.vectorStore.redis.auth.enabled }}
command:
- redis-server
- --requirepass
- $(REDIS_PASSWORD)
{{- end }}
livenessProbe:
exec:
command:
- sh
- -c
- |
{{- if .Values.vectorStore.redis.auth.enabled }}
redis-cli -a "$REDIS_PASSWORD" ping
{{- else }}
redis-cli ping
{{- end }}
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
exec:
command:
- sh
- -c
- |
{{- if .Values.vectorStore.redis.auth.enabled }}
redis-cli -a "$REDIS_PASSWORD" ping
{{- else }}
redis-cli ping
{{- end }}
initialDelaySeconds: 5
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
resources:
{{- toYaml .Values.vectorStore.redis.master.resources | nindent 12 }}
volumeMounts:
- name: data
mountPath: /data
volumes:
- name: data
{{- if .Values.vectorStore.redis.master.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ include "bifrost.fullname" . }}-redis
{{- else }}
emptyDir: {}
{{- end }}
{{- end }}
@@ -0,0 +1,23 @@
{{- if and .Values.vectorStore.enabled (eq .Values.vectorStore.type "redis") .Values.vectorStore.redis.enabled (not .Values.vectorStore.redis.external.enabled) .Values.vectorStore.redis.master.persistence.enabled }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "bifrost.fullname" . }}-redis
namespace: {{ .Release.Namespace }}
labels:
{{- include "bifrost.labels" . | nindent 4 }}
app.kubernetes.io/component: redis
spec:
accessModes:
- ReadWriteOnce
{{- if .Values.vectorStore.redis.master.persistence.storageClass }}
{{- if (eq "-" .Values.vectorStore.redis.master.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: {{ .Values.vectorStore.redis.master.persistence.storageClass }}
{{- end }}
{{- end }}
resources:
requests:
storage: {{ .Values.vectorStore.redis.master.persistence.size }}
{{- end }}
@@ -0,0 +1,20 @@
{{- if and .Values.vectorStore.enabled (eq .Values.vectorStore.type "redis") .Values.vectorStore.redis.enabled (not .Values.vectorStore.redis.external.enabled) }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "bifrost.fullname" . }}-redis-master
namespace: {{ .Release.Namespace }}
labels:
{{- include "bifrost.labels" . | nindent 4 }}
app.kubernetes.io/component: redis
spec:
type: ClusterIP
ports:
- port: 6379
targetPort: redis
protocol: TCP
name: redis
selector:
{{- include "bifrost.selectorLabels" . | nindent 4 }}
app.kubernetes.io/component: redis
{{- end }}
@@ -0,0 +1,42 @@
{{- if .Values.keda.enabled }}
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: {{ include "bifrost.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "bifrost.labels" . | nindent 4 }}
annotations:
argocd.argoproj.io/sync-wave: "5"
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "bifrost.fullname" . }}
pollingInterval: {{ .Values.keda.pollingInterval | default 30 }}
minReplicaCount: {{ .Values.keda.minReplicaCount | default 2 }}
maxReplicaCount: {{ .Values.keda.maxReplicaCount | default 200 }}
advanced:
horizontalPodAutoscalerConfig:
behavior:
scaleDown:
stabilizationWindowSeconds: {{ .Values.keda.scaledown.stabilizationWindowSeconds }}
policies:
{{- range .Values.keda.scaledown.policies }}
- type: {{ .type }}
value: {{ .value }}
periodSeconds: {{ .periodseconds }}
{{- end }}
selectPolicy: {{ .Values.keda.scaledown.selectpolicy }}
scaleUp:
stabilizationWindowSeconds: {{ .Values.keda.scaleup.stabilizationWindowSeconds }}
policies:
{{- range .Values.keda.scaleup.policies }}
- type: {{ .type }}
value: {{ .value }}
periodSeconds: {{ .periodseconds }}
{{- end }}
selectPolicy: {{ .Values.keda.scaleup.selectpolicy }}
triggers:
{{- toYaml .Values.keda.triggers | nindent 2 }}
{{- end }}
@@ -0,0 +1,27 @@
{{- if and (eq .Values.storage.mode "postgres") .Values.postgresql.enabled (not .Values.postgresql.external.enabled) }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "bifrost.fullname" . }}-postgresql
namespace: {{ .Release.Namespace }}
labels:
{{- include "bifrost.labels" . | nindent 4 }}
app.kubernetes.io/component: database
type: Opaque
data:
password: {{ .Values.postgresql.auth.password | b64enc | quote }}
{{- end }}
---
{{- if and .Values.vectorStore.enabled (eq .Values.vectorStore.type "redis") .Values.vectorStore.redis.enabled (not .Values.vectorStore.redis.external.enabled) .Values.vectorStore.redis.auth.enabled }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "bifrost.fullname" . }}-redis
namespace: {{ .Release.Namespace }}
labels:
{{- include "bifrost.labels" . | nindent 4 }}
app.kubernetes.io/component: redis
type: Opaque
data:
password: {{ .Values.vectorStore.redis.auth.password | b64enc | quote }}
{{- end }}
@@ -0,0 +1,30 @@
{{- if and (eq .Values.storage.mode "sqlite") .Values.storage.persistence.enabled (not .Values.storage.persistence.existingClaim) }}
# Headless service for StatefulSet pod DNS resolution
apiVersion: v1
kind: Service
metadata:
name: {{ include "bifrost.fullname" . }}-headless
namespace: {{ .Release.Namespace }}
labels:
{{- include "bifrost.labels" . | nindent 4 }}
spec:
type: ClusterIP
clusterIP: None
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
{{- if .Values.bifrost.cluster.enabled }}
- port: {{ .Values.bifrost.cluster.gossip.port }}
targetPort: gossip
protocol: TCP
name: gossip
- port: {{ .Values.bifrost.cluster.gossip.port }}
targetPort: gossip-udp
protocol: UDP
name: gossip-udp
{{- end }}
selector:
{{- include "bifrost.serverSelectorLabels" . | nindent 4 }}
{{- end }}
@@ -0,0 +1,30 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "bifrost.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "bifrost.labels" . | nindent 4 }}
{{- with .Values.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
{{- if .Values.bifrost.cluster.enabled }}
- port: {{ .Values.bifrost.cluster.gossip.port }}
targetPort: gossip
protocol: TCP
name: gossip
- port: {{ .Values.bifrost.cluster.gossip.port }}
targetPort: gossip-udp
protocol: UDP
name: gossip-udp
{{- end }}
selector:
{{- include "bifrost.serverSelectorLabels" . | nindent 4 }}
@@ -0,0 +1,14 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "bifrost.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "bifrost.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
automountServiceAccountToken: {{ .Values.serviceAccount.automount }}
{{- end }}
@@ -0,0 +1,250 @@
{{- /* 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 }}
@@ -0,0 +1,69 @@
{{- if and .Values.vectorStore.enabled (eq .Values.vectorStore.type "weaviate") .Values.vectorStore.weaviate.enabled (not .Values.vectorStore.weaviate.external.enabled) }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "bifrost.fullname" . }}-weaviate
namespace: {{ .Release.Namespace }}
labels:
{{- include "bifrost.labels" . | nindent 4 }}
app.kubernetes.io/component: vectorstore
spec:
replicas: {{ .Values.vectorStore.weaviate.replicas }}
strategy:
type: Recreate
selector:
matchLabels:
{{- include "bifrost.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: vectorstore
template:
metadata:
labels:
{{- include "bifrost.labels" . | nindent 8 }}
app.kubernetes.io/component: vectorstore
spec:
containers:
- name: weaviate
image: "{{ .Values.vectorStore.weaviate.image.repository }}:{{ .Values.vectorStore.weaviate.image.tag }}"
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 8080
protocol: TCP
- name: grpc
containerPort: 50051
protocol: TCP
env:
{{- range $key, $value := .Values.vectorStore.weaviate.env }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }}
livenessProbe:
httpGet:
path: /v1/.well-known/live
port: http
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
httpGet:
path: /v1/.well-known/ready
port: http
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
resources:
{{- toYaml .Values.vectorStore.weaviate.resources | nindent 12 }}
volumeMounts:
- name: data
mountPath: /var/lib/weaviate
volumes:
- name: data
{{- if .Values.vectorStore.weaviate.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ include "bifrost.fullname" . }}-weaviate
{{- else }}
emptyDir: {}
{{- end }}
{{- end }}
@@ -0,0 +1,23 @@
{{- if and .Values.vectorStore.enabled (eq .Values.vectorStore.type "weaviate") .Values.vectorStore.weaviate.enabled (not .Values.vectorStore.weaviate.external.enabled) }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "bifrost.fullname" . }}-weaviate
namespace: {{ .Release.Namespace }}
labels:
{{- include "bifrost.labels" . | nindent 4 }}
app.kubernetes.io/component: vectorstore
spec:
accessModes:
- ReadWriteOnce
{{- if .Values.vectorStore.weaviate.persistence.storageClass }}
{{- if (eq "-" .Values.vectorStore.weaviate.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: {{ .Values.vectorStore.weaviate.persistence.storageClass }}
{{- end }}
{{- end }}
resources:
requests:
storage: {{ .Values.vectorStore.weaviate.persistence.size }}
{{- end }}
@@ -0,0 +1,24 @@
{{- if and .Values.vectorStore.enabled (eq .Values.vectorStore.type "weaviate") .Values.vectorStore.weaviate.enabled (not .Values.vectorStore.weaviate.external.enabled) }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "bifrost.fullname" . }}-weaviate
namespace: {{ .Release.Namespace }}
labels:
{{- include "bifrost.labels" . | nindent 4 }}
app.kubernetes.io/component: vectorstore
spec:
type: ClusterIP
ports:
- port: 8080
targetPort: http
protocol: TCP
name: http
- port: 50051
targetPort: grpc
protocol: TCP
name: grpc
selector:
{{- include "bifrost.selectorLabels" . | nindent 4 }}
app.kubernetes.io/component: vectorstore
{{- end }}