108 lines
4.2 KiB
YAML
108 lines
4.2 KiB
YAML
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: {{ include "medical-chatbot.fullname" . }}-ai-service
|
|
labels:
|
|
{{- include "medical-chatbot.labels" . | nindent 4 }}
|
|
data:
|
|
ENVIRONMENT: {{ .Values.global.environment | quote }}
|
|
QDRANT_URL: {{ default (printf "http://%s-qdrant:6333" (include "medical-chatbot.fullname" .)) .Values.qdrant.url | quote }}
|
|
QDRANT_COLLECTION: {{ .Values.aiService.config.qdrantCollection | quote }}
|
|
EMBEDDING_PROVIDER: {{ .Values.aiService.config.embeddingProvider | quote }}
|
|
ANSWER_PROVIDER: {{ .Values.aiService.config.answerProvider | quote }}
|
|
ANSWER_MODEL_ID: {{ .Values.aiService.config.answerModelId | quote }}
|
|
METRICS_ENABLED: {{ .Values.aiService.config.metricsEnabled | quote }}
|
|
OTEL_ENABLED: {{ and .Values.observability.enabled .Values.aiService.config.otelEnabled | quote }}
|
|
OTEL_SERVICE_NAME: ai-service
|
|
OTEL_EXPORTER_OTLP_ENDPOINT: {{ printf "http://%s-otel-collector:4318/v1/traces" (include "medical-chatbot.fullname" .) | quote }}
|
|
OTEL_SAMPLE_RATIO: {{ .Values.aiService.config.otelSampleRatio | quote }}
|
|
MAX_WALL_CLOCK_MS: {{ .Values.aiService.config.maxWallClockMs | quote }}
|
|
MAX_LLM_CALLS_PER_TURN: {{ .Values.aiService.config.maxLlmCallsPerTurn | quote }}
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: {{ include "medical-chatbot.fullname" . }}-ai-service
|
|
labels:
|
|
{{- include "medical-chatbot.labels" . | nindent 4 }}
|
|
app.kubernetes.io/component: ai-service
|
|
spec:
|
|
replicas: {{ .Values.aiService.replicaCount }}
|
|
selector:
|
|
matchLabels:
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
app.kubernetes.io/component: ai-service
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
app.kubernetes.io/component: ai-service
|
|
annotations:
|
|
prometheus.io/scrape: "true"
|
|
prometheus.io/path: /metrics
|
|
prometheus.io/port: "8000"
|
|
spec:
|
|
serviceAccountName: {{ include "medical-chatbot.serviceAccountName" . }}
|
|
imagePullSecrets:
|
|
{{- toYaml .Values.global.imagePullSecrets | nindent 8 }}
|
|
{{- if .Values.aiService.migration.enabled }}
|
|
initContainers:
|
|
- name: migrate
|
|
image: "{{ .Values.aiService.image.repository }}:{{ .Values.aiService.image.tag }}"
|
|
imagePullPolicy: {{ .Values.aiService.image.pullPolicy }}
|
|
command: ["python", "migrate.py"]
|
|
envFrom:
|
|
- configMapRef: { name: {{ include "medical-chatbot.fullname" . }}-ai-service }
|
|
env:
|
|
- name: POSTGRES_DSN
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ include "medical-chatbot.secretName" . }}
|
|
key: postgres-dsn
|
|
{{- end }}
|
|
containers:
|
|
- name: ai-service
|
|
image: "{{ .Values.aiService.image.repository }}:{{ .Values.aiService.image.tag }}"
|
|
imagePullPolicy: {{ .Values.aiService.image.pullPolicy }}
|
|
ports:
|
|
- { name: http, containerPort: 8000 }
|
|
envFrom:
|
|
- configMapRef: { name: {{ include "medical-chatbot.fullname" . }}-ai-service }
|
|
env:
|
|
- name: POSTGRES_DSN
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ include "medical-chatbot.secretName" . }}
|
|
key: postgres-dsn
|
|
readinessProbe:
|
|
httpGet: { path: /ready, port: http }
|
|
initialDelaySeconds: 5
|
|
periodSeconds: 10
|
|
livenessProbe:
|
|
httpGet: { path: /health, port: http }
|
|
initialDelaySeconds: 15
|
|
periodSeconds: 20
|
|
startupProbe:
|
|
httpGet: { path: /health, port: http }
|
|
failureThreshold: 30
|
|
periodSeconds: 5
|
|
resources:
|
|
{{- toYaml .Values.aiService.resources | nindent 12 }}
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: {{ include "medical-chatbot.fullname" . }}-ai-service
|
|
labels:
|
|
{{- include "medical-chatbot.labels" . | nindent 4 }}
|
|
app.kubernetes.io/component: ai-service
|
|
spec:
|
|
type: {{ .Values.aiService.service.type }}
|
|
selector:
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
app.kubernetes.io/component: ai-service
|
|
ports:
|
|
- name: http
|
|
port: {{ .Values.aiService.service.port }}
|
|
targetPort: http
|