{{- 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: {{- with .Values.deployment.kong.podAnnotations }} annotations: {{- 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 }} {{- if .Values.secret.dashboard }} - name: DASHBOARD_USERNAME valueFrom: secretKeyRef: {{- if .Values.secret.dashboard.secretRef }} name: {{ .Values.secret.dashboard.secretRef }} key: {{ .Values.secret.dashboard.secretRefKey.username | default "username" }} {{- else }} name: {{ include "supabase.secret.dashboard" . }} key: username {{- end }} - name: DASHBOARD_PASSWORD valueFrom: secretKeyRef: {{- if .Values.secret.dashboard.secretRef }} name: {{ .Values.secret.dashboard.secretRef }} key: {{ .Values.secret.dashboard.secretRefKey.password | default "password" }} {{- else }} name: {{ include "supabase.secret.dashboard" . }} key: password {{- end }} {{- 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 }}