Skip to content

Commit f72b1a0

Browse files
chart: bump version to 0.4.4 and add post-init SQL configuration for recovery mode
1 parent a84c660 commit f72b1a0

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

charts/cnpg-cluster/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 0.4.3
18+
version: 0.4.4
1919

2020
# This is the version number of the application being deployed. This version number should be
2121
# incremented each time you make changes to the application. Versions are not expected to

charts/cnpg-cluster/templates/cnpg-cluster.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,26 @@ spec:
110110
localeCType: C
111111
localeCollate: C
112112
owner: app
113+
{{- $initSQL := .Values.recovery.postInitApplicationSQL | default list }}
114+
{{- if .Values.vault.enabled }}
115+
{{- $appRole := (index .Values.managedRoles 0).name | default "app" }}
116+
{{- $vaultSQL := list
117+
"create schema if not exists extensions"
118+
"create extension supabase_vault cascade"
119+
(printf "grant usage on schema vault to %s" $appRole)
120+
(printf "grant execute on all functions in schema vault to %s" $appRole)
121+
(printf "grant select on all tables in schema vault to %s" $appRole)
122+
(printf "grant delete on all tables in schema vault to %s" $appRole)
123+
(printf "grant references on all tables in schema vault to %s" $appRole)
124+
}}
125+
{{- $initSQL = concat $vaultSQL $initSQL }}
126+
{{- end }}
127+
{{- if $initSQL }}
128+
postInitApplicationSQL:
129+
{{- range $initSQL }}
130+
- {{ . | quote }}
131+
{{- end }}
132+
{{- end }}
113133
{{- end }}
114134

115135
{{- if or (eq .Values.recovery.mode "production") (eq .Values.recovery.mode "recovery") }}

charts/cnpg-cluster/values.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ recovery:
7777
# Mode 3: "recovery" - Recover from specific timeline
7878
#
7979
mode: "fresh" # Options: fresh, production, recovery
80+
# SQL statements to run after initdb (fresh mode only)
81+
postInitApplicationSQL: []
82+
# Example:
83+
# postInitApplicationSQL:
84+
# - create extension supabase_vault cascade;
8085
# https://cloudnative-pg.io/documentation/current/recovery/#recovery-targets
8186
target: {}
8287
# Timeline configuration

0 commit comments

Comments
 (0)