danswer/deployment/helm/templates/api-deployment.yaml
2024-03-24 18:37:27 -07:00

111 lines
4.1 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "danswer-stack.fullname" . }}-api
labels:
{{- include "danswer-stack.labels" . | nindent 4 }}
spec:
{{- if not .Values.api.autoscaling.enabled }}
replicas: {{ .Values.api.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "danswer-stack.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.api.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "danswer-stack.labels" . | nindent 8 }}
{{- with .Values.api.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "danswer-stack.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.api.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.api.securityContext | nindent 12 }}
image: "{{ .Values.api.image.repository }}:{{ .Values.api.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.api.image.pullPolicy }}
command:
- "/bin/sh"
- "-c"
- |
alembic upgrade head &&
echo "Starting Danswer Api Server" &&
uvicorn danswer.main:app --host 0.0.0.0 --port 8080
ports:
- name: api-server-port
containerPort: {{ .Values.api.service.port }}
protocol: TCP
resources:
{{- toYaml .Values.api.resources | nindent 12 }}
envFrom:
- configMapRef:
name: {{ include "danswer-stack.fullname" . }}
env:
- name: INTERNAL_URL
value: {{ (list "http://" (include "danswer-stack.fullname" .) "-api:" .Values.api.service.port | join "") | quote }}
- name: VESPA_HOST
value: {{ (list (include "danswer-stack.fullname" .) "vespa" | join "-") }}
{{- if .Values.postgresql.enabled }}
- name: POSTGRES_HOST
value: {{ (list .Release.Name "postgresql" | join "-") }}
- name: POSTGRES_DB
value: {{ .Values.postgresql.auth.database }}
- name: POSTGRES_USER
value: {{ .Values.postgresql.auth.username }}
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: {{ (list .Release.Name "postgresql" | join "-") }}
key: password
{{- end }}
volumeMounts:
- name: dynamic-storage
mountPath: /home/storage
- name: connector-storage
mountPath: /home/file_connector_storage
{{- if .Values.api.volumeMounts }}
{{- .Values.api.volumeMounts | toYaml | nindent 12}}
{{- end }}
volumes:
- name: dynamic-storage
{{- if .Values.persistence.dynamic.enabled }}
persistentVolumeClaim:
claimName: {{ .Values.persistence.dynamic.existingClaim | default (list (include "danswer-stack.fullname" .) "dynamic" | join "-") }}
{{- else }}
emptyDir: { }
{{- end }}
- name: connector-storage
{{- if .Values.persistence.connector.enabled }}
persistentVolumeClaim:
claimName: {{ .Values.persistence.connector.existingClaim | default (list (include "danswer-stack.fullname" .) "connector" | join "-") }}
{{- else }}
emptyDir: { }
{{- end }}
{{- if .Values.api.volumes }}
{{- .Values.api.volumes | toYaml | nindent 8}}
{{- end }}
{{- with .Values.api.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.api.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.api.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}