Skip to content

Commit 21380e7

Browse files
committed
feat(documentdb): Add db type documentdb
Signed-off-by: P-Louw <[email protected]>
1 parent cb3d056 commit 21380e7

File tree

5 files changed

+26
-2
lines changed

5 files changed

+26
-2
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
type: documentdb
2+
mode: standalone
3+
version:
4+
postgresql: "17"
5+
documentdb: "0.106.0"
6+
ferretdb: "2.5.0"
7+
cluster:
8+
instances: 1
9+
backups:
10+
enabled: false

charts/cluster/templates/_bootstrap.tpl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ bootstrap:
1010
{{- if .Values.cluster.initdb.owner }}
1111
owner: {{ tpl .Values.cluster.initdb.owner . }}
1212
{{- end }}
13-
{{- if or (eq .Values.type "postgis") (eq .Values.type "timescaledb") (not (empty .Values.cluster.initdb.postInitApplicationSQL)) }}
13+
{{- if or (eq .Values.type "postgis") (eq .Values.type "timescaledb") (eq .Values.type "documentdb") (not (empty .Values.cluster.initdb.postInitApplicationSQL)) }}
1414
postInitApplicationSQL:
1515
{{- if eq .Values.type "postgis" }}
1616
- CREATE EXTENSION IF NOT EXISTS postgis;
@@ -19,6 +19,9 @@ bootstrap:
1919
- CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;
2020
{{- else if eq .Values.type "timescaledb" }}
2121
- CREATE EXTENSION IF NOT EXISTS timescaledb;
22+
{{- else if eq .Values.type "documentdb" }}
23+
- CREATE EXTENSION IF NOT EXISTS pg_cron CASCADE;
24+
- CREATE EXTENSION IF NOT EXISTS documentdb CASCADE;
2225
{{- end }}
2326
{{- with .Values.cluster.initdb }}
2427
{{- range .postInitApplicationSQL }}

charts/cluster/templates/_helpers.tpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ If a custom imageName is available, use it, otherwise use the defaults based on
8787
{{- printf "ghcr.io/cloudnative-pg/postgresql:%s" .Values.version.postgresql -}}
8888
{{- else if eq .Values.type "postgis" -}}
8989
{{- printf "ghcr.io/cloudnative-pg/postgis:%s-%s" .Values.version.postgresql .Values.version.postgis -}}
90+
{{- else if eq .Values.type "documentdb" -}}
91+
{{- printf "ghcr.io/ferretdb/postgres-documentdb:%s-%s-ferretdb-%s" (include "cluster.postgresqlMajor" .) .Values.version.documentdb .Values.version.ferretdb -}}
9092
{{- else -}}
9193
{{ fail "Invalid cluster type!" }}
9294
{{- end }}

charts/cluster/templates/cluster.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,14 @@ spec:
6868
{{ end }}
6969
enablePDB: {{ .Values.cluster.enablePDB }}
7070
postgresql:
71-
{{- if or (eq .Values.type "timescaledb") (not (empty .Values.cluster.postgresql.shared_preload_libraries)) }}
71+
{{- if or (eq .Values.type "timescaledb") (eq .Values.type "documentdb") (not (empty .Values.cluster.postgresql.shared_preload_libraries)) }}
7272
shared_preload_libraries:
7373
{{- if eq .Values.type "timescaledb" }}
7474
- timescaledb
75+
{{- else if eq .Values.type "documentdb" }}
76+
- pg_cron
77+
- pg_documentdb_core
78+
- pg_documentdb
7579
{{- end }}
7680
{{- with .Values.cluster.postgresql.shared_preload_libraries }}
7781
{{- toYaml . | nindent 6 }}

charts/cluster/values.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ namespaceOverride: ""
1010
# * `postgresql`
1111
# * `postgis`
1212
# * `timescaledb`
13+
# * `documentdb`
1314
type: postgresql
1415

1516
version:
@@ -19,6 +20,10 @@ version:
1920
timescaledb: "2.15"
2021
# -- If using PostGIS, specify the version
2122
postgis: "3.4"
23+
# -- If using DocumentDB, specify the version
24+
documentdb: "0.106.0"
25+
# -- If using DocumentDB, specify the FerretDB version
26+
ferretdb: "2.5.0"
2227

2328
###
2429
# -- Cluster mode of operation. Available modes:

0 commit comments

Comments
 (0)