added repo
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ .Values.engine.namePrefix }}-config
|
||||
labels:
|
||||
{{ include "deepgram-self-hosted.labels" . | indent 4}}
|
||||
{{- range $key, $val := .Values.engine.additionalLabels }}
|
||||
{{ $key }}: {{ $val | quote }}
|
||||
{{- end}}
|
||||
data:
|
||||
engine.toml: |
|
||||
{{- if .Values.engine.concurrencyLimit.activeRequests }}
|
||||
max_active_requests = {{ .Values.engine.concurrencyLimit.activeRequests }}
|
||||
{{- end }}
|
||||
|
||||
[license]
|
||||
server_url = [
|
||||
{{- if .Values.licenseProxy.enabled }}
|
||||
"https://{{ .Values.licenseProxy.namePrefix }}-internal:{{ .Values.licenseProxy.server.port}}{{ .Values.licenseProxy.server.baseUrl }}"
|
||||
{{- end }}
|
||||
{{- if or (not .Values.licenseProxy.enabled) .Values.licenseProxy.keepUpstreamServerAsBackup }}
|
||||
{{- if .Values.licenseProxy.enabled -}},{{- end -}}"https://license.deepgram.com"
|
||||
{{- end }}
|
||||
]
|
||||
|
||||
[server]
|
||||
host = "{{ .Values.engine.server.host }}"
|
||||
port = {{ .Values.engine.server.port }}
|
||||
|
||||
[metrics_server]
|
||||
host = "{{ .Values.engine.metricsServer.host }}"
|
||||
port = {{ .Values.engine.metricsServer.port }}
|
||||
|
||||
[model_manager]
|
||||
search_paths = [
|
||||
"/models
|
||||
{{- if .Values.engine.modelManager.volumes.customVolumeClaim.enabled -}}
|
||||
{{- if not (regexMatch `^\/` .Values.engine.modelManager.volumes.customVolumeClaim.modelsDirectory) -}}
|
||||
/
|
||||
{{- end -}}
|
||||
{{- .Values.engine.modelManager.volumes.customVolumeClaim.modelsDirectory -}}
|
||||
{{- end -}}"
|
||||
]
|
||||
|
||||
[features]
|
||||
multichannel = true
|
||||
language_detection = true
|
||||
|
||||
[chunking.batch]
|
||||
{{- if .Values.engine.chunking.speechToText.batch.minDuration }}
|
||||
min_duration = {{ .Values.engine.chunking.speechToText.batch.minDuration }}
|
||||
{{- end }}
|
||||
{{- if .Values.engine.chunking.speechToText.batch.maxDuration }}
|
||||
max_duration = {{ .Values.engine.chunking.speechToText.batch.maxDuration }}
|
||||
{{- end }}
|
||||
|
||||
[chunking.streaming]
|
||||
{{- if .Values.engine.chunking.speechToText.streaming.minDuration }}
|
||||
min_duration = {{ .Values.engine.chunking.speechToText.streaming.minDuration }}
|
||||
{{- end }}
|
||||
{{- if .Values.engine.chunking.speechToText.streaming.maxDuration }}
|
||||
max_duration = {{ .Values.engine.chunking.speechToText.streaming.maxDuration }}
|
||||
{{- end }}
|
||||
step = {{ .Values.engine.chunking.speechToText.streaming.step }}
|
||||
|
||||
[half_precision]
|
||||
state = "{{ .Values.engine.halfPrecision.state }}"
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ .Values.engine.namePrefix }}
|
||||
labels: &labels
|
||||
{{ include "deepgram-self-hosted.labels" . | indent 4}}
|
||||
app: deepgram-engine
|
||||
{{- range $key, $val := .Values.engine.additionalLabels }}
|
||||
{{ $key }}: {{ $val | quote }}
|
||||
{{- end}}
|
||||
{{- with .Values.engine.additionalAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: deepgram-engine
|
||||
{{ include "deepgram-self-hosted.selectorLabels" . }}
|
||||
{{- if not .Values.engineAutoscaling.enabled }}
|
||||
replicas: {{ .Values.scaling.replicas.engine }}
|
||||
{{- end }}
|
||||
strategy:
|
||||
type: RollingUpdate
|
||||
rollingUpdate:
|
||||
maxUnavailable: {{ .Values.engine.updateStrategy.rollingUpdate.maxUnavailable }}
|
||||
maxSurge: {{ .Values.engine.updateStrategy.rollingUpdate.maxSurge }}
|
||||
template:
|
||||
metadata:
|
||||
labels: *labels
|
||||
annotations:
|
||||
checksum/config: {{ include (print $.Template.BasePath "/engine/engine.config.yaml") . | sha256sum }}
|
||||
spec:
|
||||
nodeSelector:
|
||||
{{- toYaml .Values.engine.nodeSelector | nindent 8 }}
|
||||
terminationGracePeriodSeconds: {{ .Values.global.outstandingRequestGracePeriod }}
|
||||
{{- if .Values.global.pullSecretRef }}
|
||||
imagePullSecrets:
|
||||
- name: {{ .Values.global.pullSecretRef }}
|
||||
{{- end }}
|
||||
affinity:
|
||||
{{- toYaml .Values.engine.affinity | nindent 8 }}
|
||||
tolerations:
|
||||
{{- toYaml .Values.engine.tolerations | nindent 8 }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.licenseProxy.securityContext | nindent 8 }}
|
||||
{{- if or .Values.engine.serviceAccount.create .Values.engine.serviceAccount.name }}
|
||||
serviceAccountName: {{ default (printf "%s-sa" .Values.engine.namePrefix) .Values.engine.serviceAccount.name }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: {{ .Values.engine.namePrefix }}
|
||||
image: {{ .Values.engine.image.path }}:{{ .Values.engine.image.tag }}
|
||||
imagePullPolicy: {{ .Values.engine.image.pullPolicy }}
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: {{ required "Missing Deepgram self-hosted API key - see `global.deepgramSecretRef`" .Values.global.deepgramSecretRef }}
|
||||
{{- if le (int .Values.engine.resources.requests.gpu) 0 }}
|
||||
env:
|
||||
- name: NVIDIA_VISIBLE_DEVICES
|
||||
value: "void"
|
||||
{{- end }}
|
||||
command: [ "impeller" ]
|
||||
args: ["-v", "serve", "/etc/config/engine.toml"]
|
||||
resources:
|
||||
requests:
|
||||
memory: "{{ .Values.engine.resources.requests.memory }}"
|
||||
cpu: "{{ .Values.engine.resources.requests.cpu }}"
|
||||
{{- if gt (int .Values.engine.resources.requests.gpu) 0 }}
|
||||
nvidia.com/gpu: {{ .Values.engine.resources.requests.gpu }}
|
||||
{{- end }}
|
||||
limits:
|
||||
memory: "{{ .Values.engine.resources.limits.memory }}"
|
||||
cpu: "{{ .Values.engine.resources.limits.cpu }}"
|
||||
{{- if gt (int .Values.engine.resources.limits.gpu) 0 }}
|
||||
nvidia.com/gpu: {{ .Values.engine.resources.limits.gpu }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: engine-config-volume
|
||||
mountPath: /etc/config
|
||||
- name: models-volume
|
||||
mountPath: /models
|
||||
ports:
|
||||
- name: primary
|
||||
containerPort: {{ .Values.engine.server.port }}
|
||||
- name: metrics
|
||||
containerPort: {{ .Values.engine.metricsServer.port }}
|
||||
startupProbe:
|
||||
tcpSocket:
|
||||
port: {{ .Values.engine.server.port }}
|
||||
periodSeconds: {{ .Values.engine.startupProbe.periodSeconds }}
|
||||
failureThreshold: {{ .Values.engine.startupProbe.failureThreshold }}
|
||||
livenessProbe:
|
||||
tcpSocket:
|
||||
port: {{ .Values.engine.server.port }}
|
||||
initialDelaySeconds: {{ .Values.engine.livenessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.engine.livenessProbe.periodSeconds }}
|
||||
failureThreshold: {{ .Values.engine.livenessProbe.failureThreshold }}
|
||||
readinessProbe:
|
||||
tcpSocket:
|
||||
port: {{ .Values.engine.server.port }}
|
||||
initialDelaySeconds: {{ .Values.engine.readinessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.engine.readinessProbe.periodSeconds }}
|
||||
failureThreshold: {{ .Values.engine.readinessProbe.failureThreshold }}
|
||||
{{- if .Values.engine.lifecycle }}
|
||||
lifecycle:
|
||||
{{- toYaml .Values.engine.lifecycle | nindent 10 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: engine-config-volume
|
||||
configMap:
|
||||
name: {{ .Values.engine.namePrefix }}-config
|
||||
- name: models-volume
|
||||
persistentVolumeClaim:
|
||||
{{- $customClaimEnabled := .Values.engine.modelManager.volumes.customVolumeClaim.enabled }}
|
||||
{{- $customClaimName := .Values.engine.modelManager.volumes.customVolumeClaim.name }}
|
||||
{{- $awsEfsEnabled := .Values.engine.modelManager.volumes.aws.efs.enabled }}
|
||||
{{- $gcpGpdEnabled := .Values.engine.modelManager.volumes.gcp.gpd.enabled }}
|
||||
{{- $nova3Enabled := .Values.engine.modelManager.volumes.nova3.enabled }}
|
||||
{{- $nova3MultilingualEnabled := .Values.engine.modelManager.volumes.nova3.multilingual.enabled }}
|
||||
|
||||
{{- $enabledCount := (int $customClaimEnabled) | add (int $awsEfsEnabled) | add (int $gcpGpdEnabled) }}
|
||||
|
||||
{{- if eq $enabledCount 0 }}
|
||||
{{- fail "Error: At least one of customVolumeClaim.enabled, aws.efs.enabled, or gcp.gpd.enabled must be set to true." }}
|
||||
{{- else if gt $enabledCount 1 }}
|
||||
{{- fail "Error: Only one of customVolumeClaim.enabled, aws.efs.enabled, or gcp.gpd.enabled can be set to true." }}
|
||||
{{- end }}
|
||||
|
||||
{{- if $customClaimEnabled }}
|
||||
{{- if not $customClaimName }}
|
||||
{{- fail "Error: customVolumeClaim.name must be set when customVolumeClaim.enabled is true." }}
|
||||
{{- else }}
|
||||
claimName: {{ $customClaimName }}
|
||||
{{- end }}
|
||||
{{- else if $awsEfsEnabled }}
|
||||
claimName: {{ .Values.engine.modelManager.volumes.aws.efs.namePrefix }}-aws-efs-pvc
|
||||
{{- else if and $gcpGpdEnabled $nova3Enabled }}
|
||||
claimName: {{ .Values.engine.modelManager.volumes.gcp.gpd.namePrefix }}-gcp-gpd-pvc-nova3
|
||||
{{- else if and $gcpGpdEnabled $nova3MultilingualEnabled }}
|
||||
claimName: {{ .Values.engine.modelManager.volumes.gcp.gpd.namePrefix }}-gcp-gpd-pvc-nova3-multilingual
|
||||
{{- else }}
|
||||
claimName: {{ .Values.engine.modelManager.volumes.gcp.gpd.namePrefix }}-gcp-gpd-pvc-v1
|
||||
{{- end }}
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
{{- if .Values.scaling.auto.enabled -}}
|
||||
apiVersion: autoscaling/v2
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: {{ .Values.engine.namePrefix }}-hpa
|
||||
labels: &labels
|
||||
{{ include "deepgram-self-hosted.labels" . | indent 4}}
|
||||
{{- range $key, $val := .Values.engine.additionalLabels }}
|
||||
{{ $key }}: {{ $val | quote }}
|
||||
{{- end}}
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
name: {{ .Values.engine.namePrefix }}
|
||||
minReplicas: {{ .Values.scaling.auto.engine.minReplicas }}
|
||||
maxReplicas: {{ .Values.scaling.auto.engine.maxReplicas }}
|
||||
metrics:
|
||||
{{- $sttBatchScaling := .Values.scaling.auto.engine.metrics.speechToText.batch.requestsPerPod }}
|
||||
{{- $sttStreamingScaling := .Values.scaling.auto.engine.metrics.speechToText.streaming.requestsPerPod }}
|
||||
{{- $ttsBatchScaling := .Values.scaling.auto.engine.metrics.textToSpeech.batch.requestsPerPod }}
|
||||
{{- $requestCapacityScaling := .Values.scaling.auto.engine.metrics.requestCapacityRatio }}
|
||||
{{- $customScaling := .Values.scaling.auto.engine.metrics.custom }}
|
||||
|
||||
{{- if and (not $sttBatchScaling) (not $sttStreamingScaling) (not $ttsBatchScaling) (not $requestCapacityScaling) (not $customScaling) }}
|
||||
{{- fail "Error: When autoscaling is enabled, at least one scaling metric in scaling.auto.engine.metrics must be defined." }}
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.scaling.auto.engine.metrics.speechToText.batch.requestsPerPod }}
|
||||
- type: External
|
||||
external:
|
||||
metric:
|
||||
name: engine_active_requests_stt_batch
|
||||
target:
|
||||
type: Value
|
||||
value: {{ .Values.scaling.auto.engine.metrics.speechToText.batch.requestsPerPod }}
|
||||
{{- end }}
|
||||
{{- if .Values.scaling.auto.engine.metrics.speechToText.streaming.requestsPerPod }}
|
||||
- type: External
|
||||
external:
|
||||
metric:
|
||||
name: engine_active_requests_stt_streaming
|
||||
target:
|
||||
type: Value
|
||||
value: {{ .Values.scaling.auto.engine.metrics.speechToText.streaming.requestsPerPod }}
|
||||
{{- end }}
|
||||
{{- if .Values.scaling.auto.engine.metrics.textToSpeech.batch.requestsPerPod }}
|
||||
- type: External
|
||||
external:
|
||||
metric:
|
||||
name: engine_active_requests_tts_batch
|
||||
target:
|
||||
type: Value
|
||||
value: {{ .Values.scaling.auto.engine.metrics.textToSpeech.batch.requestsPerPod }}
|
||||
{{- end }}
|
||||
{{- if .Values.scaling.auto.engine.metrics.requestCapacityRatio }}
|
||||
{{- if not .Values.engine.concurrencyLimit.activeRequests }}
|
||||
{{- fail "Error: engine.concurrencyLimit.activeRequests must be set to autoscale using requestCapacityRatio." }}
|
||||
{{- end }}
|
||||
- type: External
|
||||
external:
|
||||
metric:
|
||||
name: engine_requests_active_to_max_ratio
|
||||
target:
|
||||
type: Value
|
||||
value: {{ .Values.scaling.auto.engine.metrics.requestCapacityRatio }}
|
||||
{{- end }}
|
||||
{{- if .Values.scaling.auto.engine.metrics.custom }}
|
||||
{{- toYaml .Values.scaling.auto.engine.metrics.custom | nindent 4 }}
|
||||
{{- end }}
|
||||
behavior:
|
||||
{{- toYaml .Values.scaling.auto.engine.behavior | nindent 4 }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,49 @@
|
||||
{{- if .Values.engine.serviceAccount.create }}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ default (printf "%s-sa" .Values.engine.namePrefix) .Values.engine.serviceAccount.name }}
|
||||
labels:
|
||||
{{ include "deepgram-self-hosted.labels" . | indent 4}}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: {{ .Values.engine.namePrefix }}-role
|
||||
labels:
|
||||
{{ include "deepgram-self-hosted.labels" . | indent 4}}
|
||||
rules:
|
||||
- apiGroups: [""]
|
||||
resources: ["configmaps"]
|
||||
resourceNames: ["{{ .Values.engine.namePrefix }}-config"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
- apiGroups: [""]
|
||||
resources: ["secrets"]
|
||||
resourceNames: ["{{ .Values.global.pullSecretRef }}", "{{ .Values.global.deepgramSecretRef }}"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
- apiGroups: [""]
|
||||
resources: ["services"]
|
||||
resourceNames: [{{- if .Values.licenseProxy.enabled -}}"{{ .Values.licenseProxy.namePrefix }}-internal"{{- end -}}]
|
||||
verbs: ["get"]
|
||||
- apiGroups: [""]
|
||||
resources: ["persistentvolumeclaims"]
|
||||
resourceNames: ["{{ .Values.engine.modelManager.volumes.customVolumeClaim.name }}", "{{ .Values.engine.modelManager.volumes.aws.efs.namePrefix }}-aws-efs-pvc", "{{ .Values.engine.modelManager.volumes.gcp.gpd.namePrefix }}-gcp-gpd-pvc" ]
|
||||
verbs: ["get", "list", "watch"]
|
||||
- apiGroups: ["nvidia.com"]
|
||||
resources: ["*"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: {{ .Values.engine.namePrefix }}-rolebinding
|
||||
labels:
|
||||
{{ include "deepgram-self-hosted.labels" . | indent 4}}
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ default (printf "%s-sa" .Values.engine.namePrefix) .Values.engine.serviceAccount.name }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: {{ .Values.engine.namePrefix }}-role
|
||||
{{- end }}
|
||||
@@ -0,0 +1,55 @@
|
||||
{{- if .Values.engineAutoscaling.enabled }}
|
||||
apiVersion: keda.sh/v1alpha1
|
||||
kind: ScaledObject
|
||||
metadata:
|
||||
labels: &labels
|
||||
{{ include "deepgram-self-hosted.labels" . | indent 4}}
|
||||
namespace: {{ .Values.engineAutoscaling.namespace }}
|
||||
name: deepgram-engine-hpa
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
name: {{ .Values.engineAutoscaling.targetName }}
|
||||
pollingInterval: {{ .Values.engineAutoscaling.pollingInterval }}
|
||||
{{- if ( default false (.Values.disasterRecovery).enabled ) }}
|
||||
minReplicaCount: 1
|
||||
{{- else }}
|
||||
minReplicaCount: {{ .Values.engineAutoscaling.minReplicas }}
|
||||
{{- end }}
|
||||
maxReplicaCount: {{ .Values.engineAutoscaling.maxReplicas }}
|
||||
advanced:
|
||||
horizontalPodAutoscalerConfig:
|
||||
behavior:
|
||||
scaleDown:
|
||||
stabilizationWindowSeconds: {{ .Values.engineAutoscaling.scaledown.stabilizationWindowSeconds }}
|
||||
policies:
|
||||
{{- range .Values.engineAutoscaling.scaledown.policies }}
|
||||
- type: {{ .type }}
|
||||
value: {{ .value }}
|
||||
periodSeconds: {{ .periodseconds }}
|
||||
{{- end }}
|
||||
selectPolicy: {{ .Values.engineAutoscaling.scaledown.selectpolicy }}
|
||||
scaleUp:
|
||||
stabilizationWindowSeconds: {{ .Values.engineAutoscaling.scaleup.stabilizationWindowSeconds }}
|
||||
policies:
|
||||
{{- range .Values.engineAutoscaling.scaleup.policies }}
|
||||
- type: {{ .type }}
|
||||
value: {{ .value }}
|
||||
periodSeconds: {{ .periodseconds }}
|
||||
{{- end }}
|
||||
selectPolicy: {{ .Values.engineAutoscaling.scaleup.selectpolicy }}
|
||||
triggers:
|
||||
{{- if ( default false (.Values.disasterRecovery).enabled ) }}
|
||||
{{- range $.Values.engineAutoscaling.triggers }}
|
||||
{{- if or (eq .type "cpu") (eq .type "memory") }}
|
||||
- metadata:
|
||||
{{- toYaml .metadata | nindent 8 }}
|
||||
type: {{ .type }}
|
||||
metricType: "Utilization"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- toYaml .Values.engineAutoscaling.triggers | nindent 2 }}
|
||||
{{ end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,38 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ .Values.engine.namePrefix }}-metrics
|
||||
labels:
|
||||
{{ include "deepgram-self-hosted.labels" . | indent 4}}
|
||||
{{- range $key, $val := .Values.engine.additionalLabels }}
|
||||
{{ $key }}: {{ $val | quote }}
|
||||
{{- end}}
|
||||
spec:
|
||||
selector:
|
||||
app: deepgram-engine
|
||||
{{ include "deepgram-self-hosted.selectorLabels" . }}
|
||||
ports:
|
||||
- name: "metrics"
|
||||
port: {{ .Values.engine.metricsServer.port }}
|
||||
targetPort: {{ .Values.engine.metricsServer.port }}
|
||||
|
||||
---
|
||||
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ .Values.engine.namePrefix }}-internal
|
||||
labels:
|
||||
{{ include "deepgram-self-hosted.labels" . | indent 4}}
|
||||
{{- range $key, $val := .Values.engine.additionalLabels }}
|
||||
{{ $key }}: {{ $val | quote }}
|
||||
{{- end}}
|
||||
spec:
|
||||
selector:
|
||||
app: deepgram-engine
|
||||
{{ include "deepgram-self-hosted.selectorLabels" . }}
|
||||
ports:
|
||||
- name: "primary"
|
||||
port: {{ .Values.engine.server.port }}
|
||||
targetPort: {{ .Values.engine.server.port }}
|
||||
|
||||
Reference in New Issue
Block a user