mirror of
https://github.com/dredx/prole.git
synced 2026-09-27 17:34:30 +00:00
- align app/db cluster defaults for knoe-dev-0 + knoe-dev-cnpg-0 on e2-standard-2\n- harden Supabase deploy flow for cross-cluster DB ILB, GKE storage class, and node selector fallback\n- migrate Helm chart path to knoe-supabase and make external DB host rendering IP-safe\n- disable Kerberos in prod unattended config to prevent Supabase GSS auth failures\n- add Supabase port-forward mappings and DB backup context handling improvements\n\nBuild status: k8s stable Co-authored-by: Junie <junie@jetbrains.com>
280 lines
12 KiB
YAML
280 lines
12 KiB
YAML
{{- if .Values.deployment.storage.enabled -}}
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: {{ include "supabase.storage.fullname" . }}
|
|
labels:
|
|
{{- include "supabase.labels" . | nindent 4 }}
|
|
spec:
|
|
{{- if not .Values.autoscaling.storage.enabled }}
|
|
replicas: {{ .Values.deployment.storage.replicaCount }}
|
|
{{- end }}
|
|
selector:
|
|
matchLabels:
|
|
{{- include "supabase.storage.selectorLabels" . | nindent 6 }}
|
|
template:
|
|
metadata:
|
|
{{- with .Values.deployment.storage.podAnnotations }}
|
|
annotations:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
labels:
|
|
{{- include "supabase.storage.selectorLabels" . | nindent 8 }}
|
|
spec:
|
|
restartPolicy: Always
|
|
{{- with .Values.image.storage.pullSecrets}}
|
|
imagePullSecrets:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
serviceAccountName: {{ include "supabase.storage.serviceAccountName" . }}
|
|
securityContext:
|
|
{{- toYaml .Values.deployment.storage.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"
|
|
{{- if .Values.deployment.minio.enabled }}
|
|
- name: init-bucket
|
|
image: cgr.dev/chainguard/minio-client:latest-dev
|
|
env:
|
|
- name: MINIO_ROOT_USER
|
|
valueFrom:
|
|
secretKeyRef:
|
|
{{- if .Values.secret.minio.secretRef }}
|
|
name: {{ .Values.secret.minio.secretRef }}
|
|
key: {{ .Values.secret.minio.secretRefKey.user | default "user" }}
|
|
{{- else }}
|
|
name: {{ include "supabase.secret.minio" . }}
|
|
key: user
|
|
{{- end }}
|
|
- name: MINIO_ROOT_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
{{- if .Values.secret.s3.secretRef }}
|
|
name: {{ .Values.secret.s3.secretRef }}
|
|
key: {{ .Values.secret.s3.secretRefKey.password | default "password" }}
|
|
{{- else }}
|
|
name: {{ include "supabase.secret.minio" . }}
|
|
key: password
|
|
{{- end }}
|
|
- name: GLOBAL_S3_BUCKET
|
|
value: {{ .Values.environment.storage.GLOBAL_S3_BUCKET }}
|
|
imagePullPolicy: IfNotPresent
|
|
command:
|
|
- /bin/sh
|
|
- -c
|
|
- |
|
|
until /usr/bin/mc alias set supa-minio http://{{ include "supabase.minio.fullname" . }}:{{ .Values.service.minio.port }} $MINIO_ROOT_USER $MINIO_ROOT_PASSWORD; do
|
|
echo "Waiting for minio to start..."
|
|
sleep 2
|
|
done
|
|
/usr/bin/mc mb --ignore-existing supa-minio/$GLOBAL_S3_BUCKET
|
|
{{- end }}
|
|
containers:
|
|
- name: {{ include "supabase.storage.name" $ }}
|
|
securityContext:
|
|
{{- toYaml .Values.deployment.storage.securityContext | nindent 12 }}
|
|
image: "{{ .Values.image.storage.repository }}:{{ .Values.image.storage.tag | default .Chart.AppVersion }}"
|
|
imagePullPolicy: {{ .Values.image.storage.pullPolicy }}
|
|
env:
|
|
{{- $storageEnv := (.Values.environment.storage | default dict) }}
|
|
{{- $storageBackend := (default (ternary "s3" "file" .Values.deployment.minio.enabled) (get $storageEnv "STORAGE_BACKEND")) }}
|
|
{{- range $key, $value := $storageEnv }}
|
|
{{- 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 }}
|
|
{{- if .Values.deployment.rest.enabled }}
|
|
- name: POSTGREST_URL
|
|
value: {{ printf "http://%s:%v" (include "supabase.rest.fullname" .) .Values.service.rest.port | quote }}
|
|
{{- end }}
|
|
- 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: DATABASE_URL
|
|
value: $(DB_DRIVER)://$(DB_USER):$(DB_PASSWORD_ENC)@{{ include "supabase.database.host" . }}:{{ include "supabase.database.port" . }}/{{ include "supabase.database.name" . }}?search_path=storage,public&sslmode={{ include "supabase.database.ssl" . }}
|
|
- name: PGRST_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: ANON_KEY
|
|
valueFrom:
|
|
secretKeyRef:
|
|
{{- if .Values.secret.jwt.secretRef }}
|
|
name: {{ .Values.secret.jwt.secretRef }}
|
|
key: {{ .Values.secret.jwt.secretRefKey.anonKey | default "anonKey" }}
|
|
{{- else }}
|
|
name: {{ include "supabase.secret.jwt" . }}
|
|
key: anonKey
|
|
{{- end }}
|
|
- name: SERVICE_KEY
|
|
valueFrom:
|
|
secretKeyRef:
|
|
{{- if .Values.secret.jwt.secretRef }}
|
|
name: {{ .Values.secret.jwt.secretRef }}
|
|
key: {{ .Values.secret.jwt.secretRefKey.serviceKey | default "serviceKey" }}
|
|
{{- else }}
|
|
name: {{ include "supabase.secret.jwt" . }}
|
|
key: serviceKey
|
|
{{- end }}
|
|
- name: S3_PROTOCOL_ACCESS_KEY_ID
|
|
valueFrom:
|
|
secretKeyRef:
|
|
{{- if .Values.secret.s3.secretRef }}
|
|
name: {{ .Values.secret.s3.secretRef }}
|
|
key: {{ .Values.secret.s3.secretRefKey.keyId | default "keyId" }}
|
|
{{- else }}
|
|
name: {{ include "supabase.secret.s3" . }}
|
|
key: keyId
|
|
{{- end }}
|
|
- name: S3_PROTOCOL_ACCESS_KEY_SECRET
|
|
valueFrom:
|
|
secretKeyRef:
|
|
{{- if .Values.secret.s3.secretRef }}
|
|
name: {{ .Values.secret.s3.secretRef }}
|
|
key: {{ .Values.secret.s3.secretRefKey.accessKey | default "accessKey" }}
|
|
{{- else }}
|
|
name: {{ include "supabase.secret.s3" . }}
|
|
key: accessKey
|
|
{{- end }}
|
|
{{- if .Values.deployment.imgproxy.enabled }}
|
|
- name: IMGPROXY_URL
|
|
value: {{ printf "http://%s:%v" (include "supabase.imgproxy.fullname" .) (.Values.service.imgproxy.port | int) | quote }}
|
|
{{- end }}
|
|
|
|
{{- if not (hasKey $storageEnv "STORAGE_BACKEND") }}
|
|
- name: STORAGE_BACKEND
|
|
value: {{ $storageBackend }}
|
|
{{- end }}
|
|
|
|
{{- if .Values.deployment.minio.enabled }}
|
|
{{- if not (hasKey $storageEnv "GLOBAL_S3_ENDPOINT") }}
|
|
- name: GLOBAL_S3_ENDPOINT
|
|
value: {{ printf "http://%s:%v" (include "supabase.minio.fullname" .) (default 9000 .Values.service.minio.port) | quote }}
|
|
{{- end }}
|
|
{{- if not (hasKey $storageEnv "GLOBAL_S3_PROTOCOl") }}
|
|
- name: GLOBAL_S3_PROTOCOl
|
|
value: http
|
|
{{- end }}
|
|
{{- if not (hasKey $storageEnv "GLOBAL_S3_FORCE_PATH_STYLE") }}
|
|
- name: GLOBAL_S3_FORCE_PATH_STYLE
|
|
value: "true"
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- if eq $storageBackend "s3" }}
|
|
- name: AWS_ACCESS_KEY_ID
|
|
valueFrom:
|
|
secretKeyRef:
|
|
{{- if .Values.secret.s3.secretRef }}
|
|
name: {{ .Values.secret.s3.secretRef }}
|
|
key: {{ .Values.secret.s3.secretRefKey.keyId | default "keyId" }}
|
|
{{- else }}
|
|
name: {{ include "supabase.secret.s3" . }}
|
|
key: keyId
|
|
{{- end }}
|
|
- name: AWS_SECRET_ACCESS_KEY
|
|
valueFrom:
|
|
secretKeyRef:
|
|
{{- if .Values.secret.s3.secretRef }}
|
|
name: {{ .Values.secret.s3.secretRef }}
|
|
key: {{ .Values.secret.s3.secretRefKey.accessKey | default "accessKey" }}
|
|
{{- else }}
|
|
name: {{ include "supabase.secret.s3" . }}
|
|
key: accessKey
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- with .Values.deployment.storage.livenessProbe }}
|
|
livenessProbe:
|
|
{{- toYaml . | nindent 12 }}
|
|
{{- end }}
|
|
{{- with .Values.deployment.storage.readinessProbe }}
|
|
readinessProbe:
|
|
{{- toYaml . | nindent 12 }}
|
|
{{- end }}
|
|
ports:
|
|
- name: http
|
|
containerPort: 5000
|
|
protocol: TCP
|
|
{{- with .Values.deployment.storage.resources }}
|
|
resources:
|
|
{{- toYaml . | nindent 12 }}
|
|
{{- end }}
|
|
volumeMounts:
|
|
{{- with .Values.deployment.storage.volumeMounts }}
|
|
{{- toYaml . | nindent 12 }}
|
|
{{- end }}
|
|
- mountPath: /var/lib/storage
|
|
name: storage-data
|
|
{{- include "supabase.enforcedGeneralNodeSelector" (dict "nodeSelector" .Values.deployment.storage.nodeSelector) | nindent 6 }}
|
|
{{- include "supabase.enforcedGeneralAffinity" (dict "affinity" .Values.deployment.storage.affinity) | nindent 6 }}
|
|
{{- with .Values.deployment.storage.tolerations }}
|
|
tolerations:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
volumes:
|
|
- name: storage-data
|
|
{{- if .Values.persistence.storage.enabled }}
|
|
persistentVolumeClaim:
|
|
claimName: {{ include "supabase.pvc.name" (dict "root" $ "name" "storage") }}
|
|
{{- else }}
|
|
emptyDir:
|
|
medium: ""
|
|
{{- end }}
|
|
{{- with .Values.deployment.storage.volumes }}
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- end }}
|