Files

113 lines
4.2 KiB
YAML

{{- if .Values.authService.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "medical-chatbot.fullname" . }}-auth-service
labels:
{{- include "medical-chatbot.labels" . | nindent 4 }}
data:
JWT_EXPIRES_IN: {{ .Values.authService.config.jwtExpiresIn | quote }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "medical-chatbot.fullname" . }}-auth-service
labels:
{{- include "medical-chatbot.labels" . | nindent 4 }}
app.kubernetes.io/component: auth-service
spec:
replicas: {{ .Values.authService.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: auth-service
template:
metadata:
labels:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: auth-service
annotations:
checksum/runtime-config: {{ .Values.authService.config | toJson | sha256sum | quote }}
spec:
serviceAccountName: {{ include "medical-chatbot.serviceAccountName" . }}
imagePullSecrets:
{{- toYaml .Values.global.imagePullSecrets | nindent 8 }}
{{- if or .Values.authService.migration.enabled .Values.authService.seed.enabled }}
initContainers:
{{- if .Values.authService.migration.enabled }}
- name: migrate
image: {{ include "medical-chatbot.image" (dict "image" .Values.authService.image "name" "authService") | quote }}
imagePullPolicy: {{ .Values.authService.image.pullPolicy }}
command: ["node", "dist/migrate.js"]
env:
- name: POSTGRES_DSN
valueFrom:
secretKeyRef:
name: {{ include "medical-chatbot.secretName" . }}
key: postgres-dsn
- name: JWT_SECRET
valueFrom:
secretKeyRef:
name: {{ include "medical-chatbot.secretName" . }}
key: jwt-secret
{{- end }}
{{- if .Values.authService.seed.enabled }}
- name: seed
image: {{ include "medical-chatbot.image" (dict "image" .Values.authService.image "name" "authService") | quote }}
imagePullPolicy: {{ .Values.authService.image.pullPolicy }}
command: ["node", "dist/seed.js"]
env:
- name: POSTGRES_DSN
valueFrom:
secretKeyRef:
name: {{ include "medical-chatbot.secretName" . }}
key: postgres-dsn
- name: JWT_SECRET
valueFrom:
secretKeyRef:
name: {{ include "medical-chatbot.secretName" . }}
key: jwt-secret
{{- end }}
{{- end }}
containers:
- name: auth-service
image: {{ include "medical-chatbot.image" (dict "image" .Values.authService.image "name" "authService") | quote }}
imagePullPolicy: {{ .Values.authService.image.pullPolicy }}
ports:
- { name: http, containerPort: {{ .Values.authService.service.port }} }
envFrom:
- configMapRef: { name: {{ include "medical-chatbot.fullname" . }}-auth-service }
env:
- name: PORT
value: {{ .Values.authService.service.port | quote }}
- name: POSTGRES_DSN
valueFrom:
secretKeyRef:
name: {{ include "medical-chatbot.secretName" . }}
key: postgres-dsn
- name: JWT_SECRET
valueFrom:
secretKeyRef:
name: {{ include "medical-chatbot.secretName" . }}
key: jwt-secret
resources:
{{- toYaml .Values.authService.resources | nindent 12 }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "medical-chatbot.fullname" . }}-auth-service
labels:
{{- include "medical-chatbot.labels" . | nindent 4 }}
app.kubernetes.io/component: auth-service
spec:
type: {{ .Values.authService.service.type }}
selector:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: auth-service
ports:
- name: http
port: {{ .Values.authService.service.port }}
targetPort: http
{{- end }}