added repo
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ .Values.api.namePrefix }}-config
|
||||
labels:
|
||||
{{ include "deepgram-self-hosted.labels" . | indent 4}}
|
||||
{{- range $key, $val := .Values.engine.additionalLabels }}
|
||||
{{ $key }}: {{ $val | quote }}
|
||||
{{- end}}
|
||||
data:
|
||||
api.toml: |
|
||||
[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]
|
||||
base_url = "{{ .Values.api.server.baseUrl }}"
|
||||
host = "{{ .Values.api.server.host }}"
|
||||
port = {{ .Values.api.server.port }}
|
||||
callback_conn_timeout = "{{ .Values.api.server.callbackConnTimeout }}"
|
||||
callback_timeout = "{{ .Values.api.server.callbackTimeout }}"
|
||||
fetch_conn_timeout = "{{ .Values.api.server.fetchConnTimeout }}"
|
||||
fetch_timeout = "{{ .Values.api.server.fetchTimeout }}"
|
||||
|
||||
[resolver]
|
||||
{{- if .Values.api.resolver.nameservers }}
|
||||
{{- if gt (len .Values.api.resolver.nameservers) 0 }}
|
||||
nameservers = [
|
||||
{{- range $index, $element := .Values.api.resolver.nameservers }}
|
||||
{{- if ne $index 0}},{{ end }}"{{ $element }}"
|
||||
{{- end -}}
|
||||
]
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.api.resolver.maxTTL }}
|
||||
max_ttl = {{ .Values.api.resolver.maxTTL }}
|
||||
{{- end }}
|
||||
|
||||
[features]
|
||||
topic_detection = true
|
||||
summarization = true
|
||||
entity_detection = {{ .Values.api.features.entityDetection }}
|
||||
entity_redaction = {{ .Values.api.features.entityRedaction }}
|
||||
|
||||
{{- if .Values.api.features.diskBufferPath }}
|
||||
disk_buffer_path = "{{ .Values.api.features.diskBufferPath }}"
|
||||
{{- end }}
|
||||
|
||||
[[driver_pool.standard]]
|
||||
url = "https://{{ .Values.engine.namePrefix }}-internal:{{ .Values.engine.server.port}}/v2"
|
||||
timeout_backoff = {{ .Values.api.driverPool.standard.timeoutBackoff }}
|
||||
retry_sleep = "{{ .Values.api.driverPool.standard.retrySleep }}"
|
||||
retry_backoff = {{ .Values.api.driverPool.standard.retryBackoff }}
|
||||
max_response_size = {{ int .Values.api.driverPool.standard.maxResponseSize }}
|
||||
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
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
|
||||
@@ -0,0 +1,31 @@
|
||||
{{- if .Values.scaling.auto.enabled -}}
|
||||
apiVersion: autoscaling/v2
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: {{ .Values.api.namePrefix }}-hpa
|
||||
labels: &labels
|
||||
{{ include "deepgram-self-hosted.labels" . | indent 4}}
|
||||
{{- range $key, $val := .Values.api.additionalLabels }}
|
||||
{{ $key }}: {{ $val | quote }}
|
||||
{{- end}}
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
name: {{ .Values.api.namePrefix }}
|
||||
minReplicas: {{ (divf .Values.scaling.auto.engine.minReplicas .Values.scaling.auto.api.metrics.engineToApiRatio) | ceil | int64 }}
|
||||
maxReplicas: {{ (divf .Values.scaling.auto.engine.maxReplicas .Values.scaling.auto.api.metrics.engineToApiRatio) | ceil | int64 }}
|
||||
metrics:
|
||||
- type: External
|
||||
external:
|
||||
metric:
|
||||
name: engine_to_api_pod_ratio
|
||||
target:
|
||||
type: Value
|
||||
value: {{ .Values.scaling.auto.api.metrics.engineToApiRatio }}
|
||||
{{- if .Values.scaling.auto.api.metrics.custom }}
|
||||
{{- toYaml .Values.scaling.auto.api.metrics.custom | nindent 4 }}
|
||||
{{- end }}
|
||||
behavior:
|
||||
{{- toYaml .Values.scaling.auto.api.behavior | nindent 4 }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,33 @@
|
||||
{{- if .Values.api.ingress.enabled -}}
|
||||
{{- if .Values.api.createContourGateway -}}
|
||||
{{- if or ( eq "contour-internal" .Values.api.ingress.ingressClassName ) ( eq "contour-external" .Values.api.ingress.ingressClassName ) ( eq "contour-internal-0" .Values.api.ingress.ingressClassName ) ( eq "contour-internal-1" .Values.api.ingress.ingressClassName ) ( eq "contour-external-0" .Values.api.ingress.ingressClassName ) ( eq "contour-external-1" .Values.api.ingress.ingressClassName ) }}
|
||||
{{- $servicePortNumber := .Values.api.ingress.servicePortNumber -}}
|
||||
{{- $pathType := .Values.api.ingress.pathType -}}
|
||||
{{- $namespace := .Values.api.ingress.namespace -}}
|
||||
{{- $ingressClassName := .Values.api.ingress.ingressClassName -}}
|
||||
{{ $count := 0 | int }}
|
||||
{{- range .Values.api.ingress.hosts }}
|
||||
apiVersion: projectcontour.io/v1
|
||||
kind: HTTPProxy
|
||||
metadata:
|
||||
namespace: {{ $namespace }}
|
||||
name: {{ $namespace }}-{{ $count }}
|
||||
annotations:
|
||||
projectcontour.io/ingress.class: {{ $.Values.api.ingress.ingressClassName }}
|
||||
spec:
|
||||
ingressClassName: {{ $ingressClassName }}
|
||||
routes:
|
||||
- conditions:
|
||||
- prefix: /
|
||||
enableWebsockets: true
|
||||
services:
|
||||
- name: deepgram-api-external
|
||||
port: 80
|
||||
virtualhost:
|
||||
fqdn: {{ .host }}
|
||||
---
|
||||
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,42 @@
|
||||
{{- if .Values.api.serviceAccount.create }}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ default (printf "%s-sa" .Values.api.namePrefix) .Values.api.serviceAccount.name }}
|
||||
labels:
|
||||
{{ include "deepgram-self-hosted.labels" . | indent 4}}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: {{ .Values.api.namePrefix }}-role
|
||||
labels:
|
||||
{{ include "deepgram-self-hosted.labels" . | indent 4}}
|
||||
rules:
|
||||
- apiGroups: [""]
|
||||
resources: ["configmaps"]
|
||||
resourceNames: ["{{ .Values.api.namePrefix }}-config"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
- apiGroups: [""]
|
||||
resources: ["secrets"]
|
||||
resourceNames: ["{{ .Values.global.pullSecretRef }}", "{{ .Values.global.deepgramSecretRef }}"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
- apiGroups: [""]
|
||||
resources: ["services"]
|
||||
resourceNames: ["{{ .Values.engine.namePrefix }}-internal"{{- if .Values.licenseProxy.enabled -}}, "{{ .Values.licenseProxy.namePrefix }}-internal"{{- end -}}]
|
||||
verbs: ["get"]
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: {{ .Values.api.namePrefix }}-rolebinding
|
||||
labels:
|
||||
{{ include "deepgram-self-hosted.labels" . | indent 4}}
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ default (printf "%s-sa" .Values.api.namePrefix) .Values.api.serviceAccount.name }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: {{ .Values.api.namePrefix }}-role
|
||||
{{- end }}
|
||||
@@ -0,0 +1,55 @@
|
||||
{{- if .Values.apiAutoscaling.enabled }}
|
||||
apiVersion: keda.sh/v1alpha1
|
||||
kind: ScaledObject
|
||||
metadata:
|
||||
labels: &labels
|
||||
{{ include "deepgram-self-hosted.labels" . | indent 4}}
|
||||
namespace: {{ .Values.apiAutoscaling.namespace }}
|
||||
name: deepgram-api-hpa
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
name: {{ .Values.apiAutoscaling.targetName }}
|
||||
pollingInterval: {{ .Values.apiAutoscaling.pollingInterval }}
|
||||
{{- if ( default false (.Values.disasterRecovery).enabled ) }}
|
||||
minReplicaCount: 1
|
||||
{{- else }}
|
||||
minReplicaCount: {{ .Values.apiAutoscaling.minReplicas }}
|
||||
{{- end }}
|
||||
maxReplicaCount: {{ .Values.apiAutoscaling.maxReplicas }}
|
||||
advanced:
|
||||
horizontalPodAutoscalerConfig:
|
||||
behavior:
|
||||
scaleDown:
|
||||
stabilizationWindowSeconds: {{ .Values.apiAutoscaling.scaledown.stabilizationWindowSeconds }}
|
||||
policies:
|
||||
{{- range .Values.apiAutoscaling.scaledown.policies }}
|
||||
- type: {{ .type }}
|
||||
value: {{ .value }}
|
||||
periodSeconds: {{ .periodseconds }}
|
||||
{{- end }}
|
||||
selectPolicy: {{ .Values.apiAutoscaling.scaledown.selectpolicy }}
|
||||
scaleUp:
|
||||
stabilizationWindowSeconds: {{ .Values.apiAutoscaling.scaleup.stabilizationWindowSeconds }}
|
||||
policies:
|
||||
{{- range .Values.apiAutoscaling.scaleup.policies }}
|
||||
- type: {{ .type }}
|
||||
value: {{ .value }}
|
||||
periodSeconds: {{ .periodseconds }}
|
||||
{{- end }}
|
||||
selectPolicy: {{ .Values.apiAutoscaling.scaleup.selectpolicy }}
|
||||
triggers:
|
||||
{{- if ( default false (.Values.disasterRecovery).enabled ) }}
|
||||
{{- range $.Values.apiAutoscaling.triggers }}
|
||||
{{- if or (eq .type "cpu") (eq .type "memory") }}
|
||||
- metadata:
|
||||
{{- toYaml .metadata | nindent 8 }}
|
||||
type: {{ .type }}
|
||||
metricType: "Utilization"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- toYaml .Values.apiAutoscaling.triggers | nindent 2 }}
|
||||
{{ end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,19 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ .Values.api.namePrefix }}-external
|
||||
labels:
|
||||
{{ include "deepgram-self-hosted.labels" . | indent 4}}
|
||||
{{- range $key, $val := .Values.engine.additionalLabels }}
|
||||
{{ $key }}: {{ $val | quote }}
|
||||
{{- end}}
|
||||
spec:
|
||||
selector:
|
||||
app: deepgram-api
|
||||
{{ include "deepgram-self-hosted.selectorLabels" . }}
|
||||
ports:
|
||||
- name: "primary"
|
||||
port: 80
|
||||
protocol: TCP
|
||||
targetPort: {{ .Values.api.server.port }}
|
||||
|
||||
Reference in New Issue
Block a user