prole/supabase/helm/knoe-supabase/templates/kong/deployment.yaml
chrisfu c3fae73de3 fix(cnpg,kong): wire cnpg-backup-sa, migrate PodMonitor, drop DASHBOARD consumer
Three Junie briefs landed in one commit:

#07 — Wire cnpg-backup-sa into CNPG cluster spec (drift R8)
  deploy/gcp/gke/knoe-db.yaml: add spec.serviceAccountName: cnpg-backup-sa
  (requires CNPG v1.29+, which is the live operator version).
  etc/init_cnpg_gke.sh: operator install URL now uses CNPG_OPERATOR_VERSION
  variable (default 1.29.0); new §11 patches knoe-db and
  knoe-db-barman-cloud RoleBindings to add cnpg-backup-sa as a subject
  if not already present — matching the 2026-04-29 live stabilization.

#13 — Migrate off deprecated enablePodMonitor + podMonitorRelabelings
  Both deprecated fields removed from deploy/gcp/gke/knoe-db.yaml
  spec.monitoring. New deploy/gcp/gke/knoe-db-podmonitor.yaml carries
  the PodMonitor with the cluster relabeling rule (cnpg.io/cluster pod
  label → cluster label; required for all 85 CNPG Grafana panels).
  Apply alongside knoe-db.yaml on next cluster patch.

#15 — Remove dead DASHBOARD consumer + basicauth_credentials
  supabase/helm/knoe-supabase:
  - wrapper.sh: drop DASHBOARD_USERNAME / DASHBOARD_PASSWORD envsubst lines
  - config.yaml: drop DASHBOARD consumer + basicauth_credentials block
  - kong/deployment.yaml: drop both DASHBOARD env-var secret refs
  - values.yaml: rename secret.dashboard → secret.openai (apiKey only;
    username/password dropped — no enforcer since commit 25f1b2e)
  - secrets/dashboard.yaml + _helpers.tpl: renamed to openai /
    supabase.secret.openai
  - studio/deployment.yaml: reads from secret.openai.apiKey
  - ci/example.yaml: updated to secret.openai.apiKey
  helm template confirms knoe-supabase-openai secret referenced; no
  DASHBOARD output.

docs/TODO.md: queue items #7, #13, #15 + drift row R8 archived to Done.

Co-authored-by: Junie <junie@jetbrains.com>
2026-05-02 03:08:34 -07:00

124 lines
5.1 KiB
YAML

{{- if .Values.deployment.kong.enabled -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "supabase.kong.fullname" . }}
labels:
{{- include "supabase.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.kong.enabled }}
replicas: {{ .Values.deployment.kong.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "supabase.kong.selectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
# Tie pod spec to the ConfigMap content hash so `helm upgrade` triggers
# a rolling restart whenever kong/config.yaml changes. Without this,
# ConfigMap-only changes (like adding a new route) land silently: the
# file in /usr/local/kong/template.yml updates via the ConfigMap
# volume mount, but Kong loaded declarative config at startup and
# doesn't re-read the file on its own -- old pods keep serving stale
# config and the new route (e.g. /healthz) is never live. Learned this
# the hard way when `helm upgrade` added /healthz but the GCE LB
# health check kept getting 404 because live Kong didn't have it.
checksum/config: {{ include (print $.Template.BasePath "/kong/config.yaml") . | sha256sum }}
{{- with .Values.deployment.kong.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "supabase.kong.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.image.kong.pullSecrets}}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "supabase.kong.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.deployment.kong.podSecurityContext | nindent 8 }}
containers:
- name: {{ include "supabase.kong.name" $ }}
securityContext:
{{- toYaml .Values.deployment.kong.securityContext | nindent 12 }}
image: "{{ .Values.image.kong.repository }}:{{ .Values.image.kong.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.kong.pullPolicy }}
command: ["/bin/bash"]
args: ["/scripts/wrapper.sh"]
env:
{{- range $key, $value := .Values.environment.kong }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }}
- name: SUPABASE_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: SUPABASE_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 }}
{{- with .Values.deployment.kong.livenessProbe }}
livenessProbe:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.deployment.kong.readinessProbe }}
readinessProbe:
{{- toYaml . | nindent 12 }}
{{- end }}
ports:
- name: http
containerPort: 8000
protocol: TCP
{{- with .Values.deployment.kong.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
- mountPath: /usr/local/kong/template.yml
name: config
subPath: template.yml
- mountPath: /scripts
name: wrapper
{{- with .Values.deployment.kong.volumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- include "supabase.enforcedGeneralNodeSelector" (dict "nodeSelector" .Values.deployment.kong.nodeSelector "enforceGeneralNodeRole" .Values.scheduling.enforceGeneralNodeRole) | nindent 6 }}
{{- include "supabase.enforcedGeneralAffinity" (dict "affinity" .Values.deployment.kong.affinity "enforceGeneralNodeRole" .Values.scheduling.enforceGeneralNodeRole) | nindent 6 }}
{{- with .Values.deployment.kong.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: config
configMap:
name: {{ include "supabase.kong.fullname" $ }}
defaultMode: 0777
items:
- key: template.yml
path: template.yml
- name: wrapper
configMap:
name: {{ include "supabase.kong.fullname" $ }}
defaultMode: 0777
items:
- key: wrapper.sh
path: wrapper.sh
{{- with .Values.deployment.kong.volumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}