prole/supabase/helm/prole-supabase/templates/auth/deployment.yaml
chrisfu 133b719479 Align CNPG bootstrap placement with Ansible policy
Prefer infra-managed manifests for bootstrap; reconcile CNPG instances based on Ready+schedulable labeled db nodes; update manifests to use node-role affinity + anti-affinity; add policy/tests and config touch-ups (incl. prole.cfg).
2026-03-18 22:06:41 -07:00

166 lines
6.7 KiB
YAML

{{- if .Values.deployment.auth.enabled -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "supabase.auth.fullname" . }}
labels:
{{- include "supabase.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.auth.enabled }}
replicas: {{ .Values.deployment.auth.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "supabase.auth.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.deployment.auth.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "supabase.auth.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.image.auth.pullSecrets}}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "supabase.auth.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.deployment.auth.podSecurityContext | nindent 8 }}
initContainers:
- name: init-db
image: postgres:15-alpine
imagePullPolicy: IfNotPresent
env:
- name: DB_HOST
value: {{ include "supabase.database.host" . | quote }}
- name: DB_PORT
value: {{ include "supabase.database.port" . | quote }}
command: ["/bin/sh", "-c"]
args:
- |
until pg_isready -h $(DB_HOST) -p $(DB_PORT) -U postgres; do
echo "Waiting for database to start..."
sleep 2
done
- echo "Database is ready"
containers:
- name: {{ include "supabase.auth.name" $ }}
securityContext:
{{- toYaml .Values.deployment.auth.securityContext | nindent 12 }}
image: "{{ .Values.image.auth.repository }}:{{ .Values.image.auth.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.auth.pullPolicy }}
env:
{{- range $key, $value := .Values.environment.auth }}
{{- if and (ne $key "DB_HOST") (ne $key "DB_PORT") (ne $key "DB_SSL") }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }}
{{- end }}
- name: DB_HOST
value: {{ include "supabase.database.host" . | quote }}
- name: DB_PORT
value: {{ include "supabase.database.port" . | quote }}
- name: DB_SSL
value: {{ include "supabase.database.ssl" . | quote }}
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
{{- if .Values.secret.db.secretRef }}
name: {{ .Values.secret.db.secretRef }}
key: {{ .Values.secret.db.secretRefKey.password | default "password" }}
{{- else }}
name: {{ include "supabase.secret.db" . }}
key: password
{{- end }}
- name: DB_PASSWORD_ENC
valueFrom:
secretKeyRef:
{{- if .Values.secret.db.secretRef }}
name: {{ .Values.secret.db.secretRef }}
key: {{ .Values.secret.db.secretRefKey.password | default "password" }}
{{- else }}
name: {{ include "supabase.secret.db" . }}
key: password_encoded
{{- end }}
- name: DB_NAME
valueFrom:
secretKeyRef:
{{- if .Values.secret.db.secretRef }}
name: {{ .Values.secret.db.secretRef }}
key: {{ .Values.secret.db.secretRefKey.database | default "database" }}
{{- else }}
name: {{ include "supabase.secret.db" . }}
key: database
{{- end }}
- name: GOTRUE_DB_DATABASE_URL
value: $(DB_DRIVER)://$(DB_USER):$(DB_PASSWORD_ENC)@{{ include "supabase.database.host" . }}:{{ include "supabase.database.port" . }}/{{ include "supabase.database.name" . }}?search_path=auth&sslmode={{ include "supabase.database.ssl" . }}
- name: GOTRUE_DB_DRIVER
value: $(DB_DRIVER)
- name: GOTRUE_JWT_SECRET
valueFrom:
secretKeyRef:
{{- if .Values.secret.jwt.secretRef }}
name: {{ .Values.secret.jwt.secretRef }}
key: {{ .Values.secret.jwt.secretRefKey.secret | default "secret" }}
{{- else }}
name: {{ include "supabase.secret.jwt" . }}
key: secret
{{- end }}
- name: GOTRUE_SMTP_USER
valueFrom:
secretKeyRef:
{{- if .Values.secret.smtp.secretRef }}
name: {{ .Values.secret.smtp.secretRef }}
key: {{ .Values.secret.smtp.secretRefKey.username | default "username" }}
{{- else }}
name: {{ include "supabase.secret.smtp" . }}
key: username
{{- end }}
- name: GOTRUE_SMTP_PASS
valueFrom:
secretKeyRef:
{{- if .Values.secret.smtp.secretRef }}
name: {{ .Values.secret.smtp.secretRef }}
key: {{ .Values.secret.smtp.secretRefKey.password | default "password" }}
{{- else }}
name: {{ include "supabase.secret.smtp" . }}
key: password
{{- end }}
{{- with .Values.deployment.auth.envFrom }}
envFrom:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.deployment.auth.livenessProbe }}
livenessProbe:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.deployment.auth.readinessProbe }}
readinessProbe:
{{- toYaml . | nindent 12 }}
{{- end }}
ports:
- name: http
containerPort: 9999
protocol: TCP
{{- with .Values.deployment.auth.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.deployment.auth.volumeMounts }}
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.deployment.auth.volumes }}
volumes:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- include "supabase.enforcedGeneralNodeSelector" (dict "nodeSelector" .Values.deployment.auth.nodeSelector) | nindent 6 }}
{{- include "supabase.enforcedGeneralAffinity" (dict "affinity" .Values.deployment.auth.affinity) | nindent 6 }}
{{- with .Values.deployment.auth.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}