Files
2026-08-26 03:39:42 +05:30

87 lines
3.5 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.api.namePrefix }}
labels: &labels
{{ include "deepgram-self-hosted.labels" . | indent 4}}
app: deepgram-api
{{- range $key, $val := .Values.engine.additionalLabels }}
{{ $key }}: {{ $val | quote }}
{{- end}}
{{- with .Values.api.additionalAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
selector:
matchLabels:
app: deepgram-api
{{ include "deepgram-self-hosted.selectorLabels" . }}
replicas: {{ .Values.scaling.replicas.api }}
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: {{ .Values.api.updateStrategy.rollingUpdate.maxUnavailable }}
maxSurge: {{ .Values.api.updateStrategy.rollingUpdate.maxSurge }}
template:
metadata:
labels: *labels
annotations:
checksum/config: {{ include (print $.Template.BasePath "/api/api.config.yaml") . | sha256sum }}
spec:
terminationGracePeriodSeconds: {{ .Values.global.outstandingRequestGracePeriod }}
{{- if .Values.global.pullSecretRef }}
imagePullSecrets:
- name: {{ .Values.global.pullSecretRef }}
{{- end }}
affinity:
{{- toYaml .Values.api.affinity | nindent 8 }}
tolerations:
{{- toYaml .Values.api.tolerations | nindent 8 }}
securityContext:
{{- toYaml .Values.licenseProxy.securityContext | nindent 8 }}
{{- if or .Values.api.serviceAccount.create .Values.api.serviceAccount.name }}
serviceAccountName: {{ default (printf "%s-sa" .Values.api.namePrefix) .Values.api.serviceAccount.name }}
{{- end }}
containers:
- name: {{ .Values.api.namePrefix }}
image: {{ .Values.api.image.path }}:{{ .Values.api.image.tag }}
imagePullPolicy: {{ .Values.api.image.pullPolicy }}
envFrom:
- secretRef:
name: {{ required "Missing Deepgram self-hosted API key - see `global.deepgramSecretRef`" .Values.global.deepgramSecretRef }}
command: [ "stem" ]
args: ["-v", "serve", "/etc/config/api.toml"]
resources:
requests:
memory: "{{ .Values.api.resources.requests.memory }}"
cpu: "{{ .Values.api.resources.requests.cpu }}"
limits:
memory: "{{ .Values.api.resources.limits.memory }}"
cpu: "{{ .Values.api.resources.limits.cpu }}"
volumeMounts:
- name: api-config-volume
mountPath: /etc/config
ports:
- name: primary
containerPort: {{ .Values.api.server.port }}
livenessProbe:
tcpSocket:
port: {{ .Values.api.server.port }}
initialDelaySeconds: {{ .Values.api.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.api.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.api.livenessProbe.timeoutSeconds }}
readinessProbe:
exec:
command:
- sh
- -c
- curl --silent --insecure http://localhost:{{ .Values.api.server.port }}{{ if not (regexMatch `^\/` .Values.api.server.baseUrl) }}/{{ end }}{{ .Values.api.server.baseUrl}}/status/engine | grep --quiet -e '^{\"engine_connection_status\"\:\"Connected\".*}$'
initialDelaySeconds: {{ .Values.api.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.api.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.api.readinessProbe.timeoutSeconds }}
volumes:
- name: api-config-volume
configMap:
name: {{ .Values.api.namePrefix }}-config