Skip to content

Commit 0f6d22c

Browse files
committed
feat(documentdb): Grant permissions on DocumentDB schemas to app owner
This adds comprehensive permission grants to the DocumentDB extension schemas (documentdb_api, documentdb_core, documentdb_api_catalog, documentdb_api_internal, documentdb_data) for the app owner during bootstrap initialization. Signed-off-by: P-Louw <[email protected]>
1 parent 95a658f commit 0f6d22c

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

charts/cluster/templates/_bootstrap.tpl

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,36 @@ bootstrap:
2020
{{- else if eq .Values.type "timescaledb" }}
2121
- CREATE EXTENSION IF NOT EXISTS timescaledb;
2222
{{- else if eq .Values.type "documentdb" }}
23+
{{- $owner := .Values.cluster.initdb.owner | default .Values.cluster.initdb.database | default "app" }}
2324
- CREATE EXTENSION IF NOT EXISTS pg_cron CASCADE;
2425
- CREATE EXTENSION IF NOT EXISTS documentdb CASCADE;
26+
- GRANT documentdb_admin_role TO {{ $owner }};
27+
- GRANT USAGE ON SCHEMA documentdb_api TO {{ $owner }};
28+
- GRANT USAGE ON SCHEMA documentdb_core TO {{ $owner }};
29+
- GRANT USAGE ON SCHEMA documentdb_api_catalog TO {{ $owner }};
30+
- GRANT USAGE ON SCHEMA documentdb_api_internal TO {{ $owner }};
31+
- GRANT USAGE ON SCHEMA documentdb_data TO {{ $owner }};
32+
- GRANT ALL ON ALL TABLES IN SCHEMA documentdb_api TO {{ $owner }};
33+
- GRANT ALL ON ALL SEQUENCES IN SCHEMA documentdb_api TO {{ $owner }};
34+
- GRANT ALL ON ALL TABLES IN SCHEMA documentdb_core TO {{ $owner }};
35+
- GRANT ALL ON ALL SEQUENCES IN SCHEMA documentdb_core TO {{ $owner }};
36+
- GRANT ALL ON ALL TABLES IN SCHEMA documentdb_api_catalog TO {{ $owner }};
37+
- GRANT ALL ON ALL SEQUENCES IN SCHEMA documentdb_api_catalog TO {{ $owner }};
38+
- GRANT ALL ON ALL TABLES IN SCHEMA documentdb_api_internal TO {{ $owner }};
39+
- GRANT ALL ON ALL SEQUENCES IN SCHEMA documentdb_api_internal TO {{ $owner }};
40+
- GRANT ALL ON ALL TABLES IN SCHEMA documentdb_data TO {{ $owner }};
41+
- GRANT ALL ON ALL SEQUENCES IN SCHEMA documentdb_data TO {{ $owner }};
42+
- GRANT CREATE ON SCHEMA documentdb_data TO {{ $owner }};
43+
- ALTER DEFAULT PRIVILEGES IN SCHEMA documentdb_api GRANT ALL ON TABLES TO {{ $owner }};
44+
- ALTER DEFAULT PRIVILEGES IN SCHEMA documentdb_api GRANT ALL ON SEQUENCES TO {{ $owner }};
45+
- ALTER DEFAULT PRIVILEGES IN SCHEMA documentdb_core GRANT ALL ON TABLES TO {{ $owner }};
46+
- ALTER DEFAULT PRIVILEGES IN SCHEMA documentdb_core GRANT ALL ON SEQUENCES TO {{ $owner }};
47+
- ALTER DEFAULT PRIVILEGES IN SCHEMA documentdb_api_catalog GRANT ALL ON TABLES TO {{ $owner }};
48+
- ALTER DEFAULT PRIVILEGES IN SCHEMA documentdb_api_catalog GRANT ALL ON SEQUENCES TO {{ $owner }};
49+
- ALTER DEFAULT PRIVILEGES IN SCHEMA documentdb_api_internal GRANT ALL ON TABLES TO {{ $owner }};
50+
- ALTER DEFAULT PRIVILEGES IN SCHEMA documentdb_api_internal GRANT ALL ON SEQUENCES TO {{ $owner }};
51+
- ALTER DEFAULT PRIVILEGES IN SCHEMA documentdb_data GRANT ALL ON TABLES TO {{ $owner }};
52+
- ALTER DEFAULT PRIVILEGES IN SCHEMA documentdb_data GRANT ALL ON SEQUENCES TO {{ $owner }};
2553
{{- end }}
2654
{{- with .Values.cluster.initdb }}
2755
{{- range .postInitApplicationSQL }}

0 commit comments

Comments
 (0)