Files
duocthu/infra/helm/medical-chatbot/templates/web.yaml
T

77 lines
2.8 KiB
YAML

{{- if .Values.web.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "medical-chatbot.fullname" . }}-web
labels:
{{- include "medical-chatbot.labels" . | nindent 4 }}
app.kubernetes.io/component: web
spec:
replicas: {{ .Values.web.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: web
template:
metadata:
labels:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: web
spec:
imagePullSecrets:
{{- toYaml .Values.global.imagePullSecrets | nindent 8 }}
containers:
- name: web
image: {{ include "medical-chatbot.image" (dict "image" .Values.web.image "name" "web") | quote }}
imagePullPolicy: {{ .Values.web.image.pullPolicy }}
env:
- name: AI_SERVICE_URL
value: {{ printf "http://%s-ai-service:%v" (include "medical-chatbot.fullname" .) .Values.aiService.service.port | quote }}
{{- if .Values.apiGateway.enabled }}
- name: API_GATEWAY_URL
value: {{ printf "http://%s-api-gateway:%d" (include "medical-chatbot.fullname" .) (.Values.apiGateway.service.port | int) | quote }}
{{- end }}
{{- if or .Values.authService.enabled .Values.apiGateway.enabled }}
{{/* Only middleware.ts needs this (verifies the admin JWT locally
at the edge) — the BFF routes never see it, they just forward the
cookie's raw token to the gateway. */}}
- name: JWT_SECRET
valueFrom:
secretKeyRef:
name: {{ include "medical-chatbot.secretName" . }}
key: jwt-secret
{{- end }}
ports:
- { name: http, containerPort: 3000 }
readinessProbe:
httpGet: { path: /, port: http }
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
httpGet: { path: /, port: http }
initialDelaySeconds: 15
periodSeconds: 20
resources:
{{- toYaml .Values.web.resources | nindent 12 }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "medical-chatbot.fullname" . }}-web
labels:
{{- include "medical-chatbot.labels" . | nindent 4 }}
app.kubernetes.io/component: web
spec:
type: {{ .Values.web.service.type }}
selector:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: web
ports:
- name: http
port: {{ .Values.web.service.port }}
targetPort: http
{{- if and (eq .Values.web.service.type "NodePort") .Values.web.service.nodePort }}
nodePort: {{ .Values.web.service.nodePort }}
{{- end }}
{{- end }}