From 6567a336a7854477402c0335b95ffadea6593d05 Mon Sep 17 00:00:00 2001 From: Michael Blickenstorfer <42797589+pieveee@users.noreply.github.com> Date: Sun, 7 May 2023 18:50:31 +0200 Subject: [PATCH 1/6] Fix missing if-clause when database is disabled If the database provided is being disabled in values.yaml (e.g. because of using a replicated database solution) the helm installation would fail with: Error: INSTALLATION FAILED: template: supabase/templates/db/storage.yaml:1:14: executing "supabase/templates/db/storage.yaml" at <.Values.db.persistence.enabled>: nil pointer evaluating interface {}.enabled --- charts/supabase/templates/db/storage.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/supabase/templates/db/storage.yaml b/charts/supabase/templates/db/storage.yaml index 28ad48f0..356cacad 100644 --- a/charts/supabase/templates/db/storage.yaml +++ b/charts/supabase/templates/db/storage.yaml @@ -1,3 +1,4 @@ +{{- if .Values.db.enabled -}} {{- if .Values.db.persistence.enabled -}} kind: PersistentVolumeClaim apiVersion: v1 @@ -17,5 +18,4 @@ spec: requests: storage: {{ .Values.db.storage.size }} {{- end }} - - +{{- end }} From bf525571af14c129ae01304cf01bae97a35d4137 Mon Sep 17 00:00:00 2001 From: Michael Blickenstorfer <42797589+pieveee@users.noreply.github.com> Date: Mon, 8 May 2023 15:42:52 +0200 Subject: [PATCH 2/6] Change shebang from sh to bash Currently, the container for kong would not start as wrapper.sh fails in its execution with "Illegal option -o pipefail" (See: https://www.baeldung.com/linux/illegal-option-o-pipefail#how-to-avoid-the-error). --- charts/supabase/templates/kong/config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/supabase/templates/kong/config.yaml b/charts/supabase/templates/kong/config.yaml index fc4f22fc..cfbf54e2 100644 --- a/charts/supabase/templates/kong/config.yaml +++ b/charts/supabase/templates/kong/config.yaml @@ -8,7 +8,7 @@ metadata: data: {{- toYaml .Values.kong.environment | nindent 2 }} wrapper.sh: | - #!/bin/sh + #!/bin/bash set -euo pipefail @@ -162,4 +162,4 @@ data: allow: - admin {{- end }} -{{- end }} \ No newline at end of file +{{- end }} From 081339ce72dfde5d93297d98ae8f83f7e7f1ecae Mon Sep 17 00:00:00 2001 From: Michael Blickenstorfer <42797589+pieveee@users.noreply.github.com> Date: Mon, 8 May 2023 15:47:23 +0200 Subject: [PATCH 3/6] Adjust kong.yml filepath to writeable directory The /home/kong/ directory doesn't exist in the newest Docker image of kong. Hence, the kong.yml should be stored at an existing and writeable directory. --- charts/supabase/templates/kong/config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/charts/supabase/templates/kong/config.yaml b/charts/supabase/templates/kong/config.yaml index cfbf54e2..a58f5a11 100644 --- a/charts/supabase/templates/kong/config.yaml +++ b/charts/supabase/templates/kong/config.yaml @@ -12,13 +12,13 @@ data: set -euo pipefail - echo "Replacing env placeholders of /home/kong/kong.yml" + echo "Replacing env placeholders of /usr/local/kong/kong.yml" sed \ -e "s/\${SUPABASE_ANON_KEY}/${SUPABASE_ANON_KEY}/" \ -e "s/\${SUPABASE_SERVICE_KEY}/${SUPABASE_SERVICE_KEY}/" \ - /home/kong/template.yml \ - > /home/kong/kong.yml + /usr/local/kong/template.yml \ + > /usr/local/kong/kong.yml exec /docker-entrypoint.sh kong docker-start {{- if .Values.kong.config -}} From 840f23f5495c4f956aeb81ae1a47c986479e0527 Mon Sep 17 00:00:00 2001 From: Michael Blickenstorfer <42797589+pieveee@users.noreply.github.com> Date: Mon, 8 May 2023 15:49:00 +0200 Subject: [PATCH 4/6] Adjust KONG_DECLARATIVE_CONFIG to writeable path --- charts/supabase/values.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/supabase/values.yaml b/charts/supabase/values.yaml index 3dd2c159..5ed84328 100644 --- a/charts/supabase/values.yaml +++ b/charts/supabase/values.yaml @@ -667,7 +667,7 @@ kong: port: 8000 environment: KONG_DATABASE: "off" - KONG_DECLARATIVE_CONFIG: /home/kong/kong.yml + KONG_DECLARATIVE_CONFIG: /usr/local/kong/kong.yml # https://github.com/supabase/cli/issues/14 KONG_DNS_ORDER: LAST,A,CNAME KONG_PLUGINS: request-transformer,cors,key-auth,acl @@ -869,4 +869,4 @@ kong: # config: # hide_groups_header: true # allow: - # - admin \ No newline at end of file + # - admin From 4a6035ca25a5b84102a92000adee472ab54c1604 Mon Sep 17 00:00:00 2001 From: Michael Blickenstorfer <42797589+pieveee@users.noreply.github.com> Date: Mon, 8 May 2023 15:57:38 +0200 Subject: [PATCH 5/6] Adjust volume mount for kong template.yml --- charts/supabase/templates/kong/deployment.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/supabase/templates/kong/deployment.yaml b/charts/supabase/templates/kong/deployment.yaml index 4981bddc..2a14a40d 100644 --- a/charts/supabase/templates/kong/deployment.yaml +++ b/charts/supabase/templates/kong/deployment.yaml @@ -63,7 +63,7 @@ spec: {{- toYaml . | nindent 12 }} {{- end }} volumeMounts: - - mountPath: /home/kong/template.yml + - mountPath: /usr/local/kong/template.yml name: config subPath: template.yml - mountPath: /scripts @@ -101,4 +101,4 @@ spec: {{- with .Values.kong.volumes }} {{- toYaml . | nindent 8 }} {{- end }} -{{- end }} \ No newline at end of file +{{- end }} From 32a5a25b26f08258f38b4d740c3049ede687140e Mon Sep 17 00:00:00 2001 From: Michael Blickenstorfer <42797589+pieveee@users.noreply.github.com> Date: Mon, 8 May 2023 16:12:13 +0200 Subject: [PATCH 6/6] Change wrapper.sh execution from sh to bash --- charts/supabase/templates/kong/deployment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/supabase/templates/kong/deployment.yaml b/charts/supabase/templates/kong/deployment.yaml index 2a14a40d..2e5e6dcf 100644 --- a/charts/supabase/templates/kong/deployment.yaml +++ b/charts/supabase/templates/kong/deployment.yaml @@ -34,7 +34,7 @@ spec: {{- toYaml .Values.kong.securityContext | nindent 12 }} image: "{{ .Values.kong.image.repository }}:{{ .Values.kong.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.kong.image.pullPolicy }} - command: ["/bin/sh"] + command: ["/bin/bash"] args: ["/scripts/wrapper.sh"] env: {{- range $key, $value := .Values.kong.environment }}