From d9920ac0cc47554bb995315c9aadd7977d1cdc35 Mon Sep 17 00:00:00 2001 From: Leandro Rosa Date: Mon, 8 Dec 2025 09:15:07 -0300 Subject: [PATCH 1/3] Multitenancy support --- templates/config.yaml | 27 +++++++++++++++++++++++++++ values.yaml | 27 +++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/templates/config.yaml b/templates/config.yaml index 30fa1a3..e5edc48 100644 --- a/templates/config.yaml +++ b/templates/config.yaml @@ -154,6 +154,33 @@ data: shard = {{ .shard }} {{- end }} + {{- range .Values.shardedTables }} + [[sharded_tables]] + database = {{ .database | quote }} + {{- if .name }} + name = {{ .name | quote }} + {{- end }} + column = {{ .column | quote }} + data_type = {{ .dataType | quote }} + {{- end }} + + {{- range .Values.shardedMappings }} + [[sharded_mappings]] + database = {{ .database | quote }} + column = {{ .column | quote }} + kind = {{ .kind | quote }} + shard = {{ .shard}} + {{- if .values }} + values = {{ .values| toToml }} + {{- end }} + {{- if .start }} + start = {{ .start }} + {{- end }} + {{- if .end }} + end = {{ .end }} + {{- end}} + {{- end }} + {{- if or (hasKey .Values "tcpKeepalive") (hasKey .Values "tcpTime") (hasKey .Values "tcpInterval") (hasKey .Values "tcpRetries") }} [tcp] {{- if hasKey .Values "tcpKeepalives" }} diff --git a/values.yaml b/values.yaml index 50fdb3a..1e11b6a 100644 --- a/values.yaml +++ b/values.yaml @@ -112,6 +112,33 @@ mirrors: [] # shard: 0 shardedSchemas: [] +# shardedTables contains the list of sharded table entries in pgdog.toml +# Each entry requires: database, column and dataType; name is optional +# Example: +# shardedTables: +# - database: "prod" +# name: "users" +# column: "id" +# dataType: "bigint" +shardedTables: [] + +# shardedMappings contains the list of sharded mapping entries in pgdog.toml +# Each entry requires: database, column, kind, shard; values, start and end are optional +# Example: +# shardedMappings: +# - database: "prod" +# column: "tenant_id" +# kind: "list" +# values: = [1, 5, 1_000] +# shard: 0 +# - database: "prod" +# column: "tenant_id" +# kind: "range" +# start: 1 +# end: 100 +# shard: 1 +shardedMappings: [] + # service contains the Kubernetes service configuration service: # type specifies the type of Kubernetes service From bb6e3c06eca78f69a83007d115a54e89e6d76e82 Mon Sep 17 00:00:00 2001 From: Leandro Rosa Date: Mon, 8 Dec 2025 09:29:03 -0300 Subject: [PATCH 2/3] Multitenancy support --- values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/values.yaml b/values.yaml index 1e11b6a..18045ef 100644 --- a/values.yaml +++ b/values.yaml @@ -129,7 +129,7 @@ shardedTables: [] # - database: "prod" # column: "tenant_id" # kind: "list" -# values: = [1, 5, 1_000] +# values: [1, 5, 1_000] # shard: 0 # - database: "prod" # column: "tenant_id" From 787d5b0a02ffa77f8e578cb936a022ad3434298a Mon Sep 17 00:00:00 2001 From: Lev Kokotov Date: Tue, 9 Dec 2025 09:36:21 -0800 Subject: [PATCH 3/3] Apply suggestion from @levkk --- templates/config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/config.yaml b/templates/config.yaml index e5edc48..2953276 100644 --- a/templates/config.yaml +++ b/templates/config.yaml @@ -169,7 +169,7 @@ data: database = {{ .database | quote }} column = {{ .column | quote }} kind = {{ .kind | quote }} - shard = {{ .shard}} + shard = {{ .shard }} {{- if .values }} values = {{ .values| toToml }} {{- end }}