-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathconfig.yaml
More file actions
309 lines (296 loc) · 13.3 KB
/
config.yaml
File metadata and controls
309 lines (296 loc) · 13.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "pgdog.fullname" . }}
data:
# This is pgdog.toml. You can configure anything here, incl. databases.
# Note: don't change the port value, since it's pulled from Values.
pgdog.toml: |
[general]
port = {{ .Values.port }}
workers = {{ .Values.workers | default "2" }}
default_pool_size = {{ .Values.defaultPoolSize | default "10" }}
{{- if hasKey .Values "minPoolSize" }}
min_pool_size = {{ .Values.minPoolSize }}
{{- end }}
pooler_mode = {{ .Values.poolerMode | default "transaction" | quote }}
{{- if .Values.healthcheckPort }}
healthcheck_port = {{ .Values.healthcheckPort }}
{{- end }}
healthcheck_interval = {{ .Values.healthcheckInterval | default "30_000" }}
idle_healthcheck_interval = {{ .Values.idleHealthcheckInterval | default "30_000" }}
idle_healthcheck_delay = {{ .Values.idleHealthcheckDelay | default "5_000" }}
healthcheck_timeout = {{ .Values.healthcheckTimeout | default "5_000" }}
{{- if hasKey .Values "banTimeout" }}
ban_timeout = {{ .Values.banTimeout }}
{{- end }}
rollback_timeout = {{ .Values.rollbackTimeout | default "5_000" }}
load_balancing_strategy = {{ .Values.loadBalancingStrategy | default "round_robin" | quote }}
read_write_strategy = {{ .Values.readWriteStrategy | default "conservative" | quote }}
{{- if .Values.readWriteSplit }}
read_write_split = {{ .Values.readWriteSplit | quote }}
{{- end }}
{{- if .Values.tlsCertificate }}
tls_certificate = {{ .Values.tlsCertificate | quote }}
{{- end }}
{{- if .Values.tlsPrivateKey }}
tls_private_key = {{ .Values.tlsPrivateKey | quote }}
{{- end }}
tls_client_required = {{ .Values.tlsClientRequired | default "false" }}
tls_verify = {{ .Values.tlsVerify | default "prefer" | quote }}
{{- if .Values.tlsServerCaCertificate }}
tls_server_ca_certificate = {{ .Values.tlsServerCaCertificate | quote }}
{{- end}}
shutdown_timeout = {{ .Values.shutdownTimeout | default "60_000" }}
{{- if .Values.shutdownTerminationTimeout }}
shutdown_termination_timeout = {{ .Values.shutdownTerminationTimeout }}
{{- end }}
prepared_statements = {{ .Values.preparedStatements | default "extended" | quote }}
{{- with .Values.queryParser }}
query_parser = {{ . | quote }}
{{- else }}
{{- with .Values.queryParserEnabled }}
query_parser_enabled = {{ . }}
{{- end }}
{{- end }}
{{- if .Values.queryParserEngine }}
query_parser_engine = {{ .Values.queryParserEngine | quote }}
{{- end }}
{{- if .Values.preparedStatementsLimit }}
prepared_statements_limit = {{ .Values.preparedStatementsLimit }}
{{- end}}
{{- if .Values.queryCacheLimit }}
query_cache_limit = {{ .Values.queryCacheLimit }}
{{- end }}
passthrough_auth = {{ .Values.passthroughAuth | default "disabled" | quote }}
connect_timeout = {{ .Values.connectTimeout | default "5_000" }}
connect_attempts = {{ .Values.connectAttempts | default "1" }}
connect_attempt_delay = {{ .Values.connectAttemptDelay | default "0" }}
{{- if .Values.queryTimeout }}
query_timeout = {{ .Values.queryTimeout }}
{{- end }}
{{- if .Values.clientIdleInTransactionTimeout }}
client_idle_in_transaction_timeout = {{ .Values.clientIdleInTransactionTimeout }}
{{- end }}
checkout_timeout = {{ .Values.checkoutTimeout | default "5_000" }}
dry_run = {{ .Values.dryRun | default "false" }}
{{- if hasKey .Values "twoPhaseCommit" }}
two_phase_commit = {{ .Values.twoPhaseCommit }}
{{- end }}
{{- if hasKey .Values "twoPhaseCommitAuto" }}
two_phase_commit_auto = {{ .Values.twoPhaseCommitAuto }}
{{- end }}
{{- if .Values.systemCatalogs }}
system_catalogs = {{ .Values.systemCatalogs | quote }}
{{- end }}
{{- if hasKey .Values "omnishardedSticky" }}
omnisharded_sticky = {{ .Values.omnishardedSticky }}
{{- end }}
{{- if .Values.reshardingCopyFormat }}
resharding_copy_format = {{ .Values.reshardingCopyFormat | quote }}
{{- end }}
{{- if hasKey .Values "reloadSchemaOnDdl" }}
reload_schema_on_ddl = {{ .Values.reloadSchemaOnDdl }}
{{- end }}
{{- if .Values.loadSchema }}
load_schema = {{ .Values.loadSchema | quote }}
{{- end }}
{{- if .Values.idleTimeout }}
idle_timeout = {{ .Values.idleTimeout }}
{{- end }}
{{- if .Values.clientIdleTimeout }}
client_idle_timeout = {{ .Values.clientIdleTimeout }}
{{- end }}
{{- if .Values.clientLoginTimeout }}
client_login_timeout = {{ .Values.clientLoginTimeout }}
{{- end }}
mirror_queue = {{ .Values.mirrorQueue | default "128" }}
mirror_exposure = {{ .Values.mirrorExposure | default "1.0" }}
auth_type = {{ .Values.authType | default "scram" | quote }}
cross_shard_disabled = {{ .Values.crossShardDisabled | default "false" }}
{{- if .Values.dnsTtl }}
dns_ttl = {{ .Values.dnsTtl }}
{{- end }}
{{- if .Values.pubSubChannelSize }}
pub_sub_channel_size = {{ .Values.pubSubChannelSize }}
{{- end }}
openmetrics_port = {{ .Values.openMetricsPort | default "9090" }}
openmetrics_namespace = {{ .Values.openMetricsNamespace | default "pgdog_" | quote }}
server_lifetime = {{ .Values.serverLifetime | default "86400000" }}
log_connections = {{ .Values.logConnections | default "true" }}
log_disconnections = {{ .Values.logDisconnections | default "true" }}
{{- if .Values.statsPeriod }}
stats_period = {{ .Values.statsPeriod }}
{{- end }}
{{- if .Values.connectionRecovery }}
connection_recovery = {{ .Values.connectionRecovery | quote }}
{{- end }}
{{- if .Values.clientConnectionRecovery }}
client_connection_recovery = {{ .Values.clientConnectionRecovery | quote }}
{{- end }}
expanded_explain = {{ .Values.expandedExplain | default "false" }}
{{- if hasKey .Values "lsnCheckDelay" }}
lsn_check_delay = {{ .Values.lsnCheckDelay }}
{{- end }}
{{- if hasKey .Values "lsnCheckInterval" }}
lsn_check_interval = {{ .Values.lsnCheckInterval }}
{{- end }}
{{- if hasKey .Values "lsnCheckTimeout" }}
lsn_check_timeout = {{ .Values.lsnCheckTimeout }}
{{- end }}
{{- range .Values.databases }}
[[databases]]
name = {{ .name | quote }}
host = {{ .host | quote }}
port = {{ .port | default "5432" }}
shard = {{ .shard | default "0" }}
{{- if .databaseName }}
database_name = {{ .databaseName | quote }}
{{- end }}
{{- if .user }}
user = {{ .user | quote }}
{{- end }}
{{- if .password }}
password = {{ .password | quote }}
{{- end }}
{{- if .poolSize }}
pool_size = {{ .poolSize }}
{{- end }}
{{- if .minPoolSize }}
min_pool_size = {{ .minPoolSize }}
{{- end }}
{{- if .poolerMode }}
pooler_mode = {{ .poolerMode | quote }}
{{- end }}
{{- if .statementTimeout }}
statement_timeout = {{ .statementTimeout }}
{{- end }}
{{- if .idleTimeout }}
idle_timeout = {{ .idleTimeout }}
{{- end }}
{{- if .readOnly }}
read_only = {{ .readOnly }}
{{- end }}
{{- if .role }}
role = {{ .role | quote }}
{{- end }}
{{- if .serverLifetime }}
server_lifetime = {{ .serverLifetime }}
{{- end }}
{{- end }}
{{- range .Values.mirrors }}
[[mirroring]]
source_db = {{ .sourceDb | quote }}
destination_db = {{ .destinationDb | quote }}
{{- if .queueDepth }}
queue_depth = {{ .queueDepth }}
{{- end}}
{{- if .exposure }}
exposure = {{ .exposure }}
{{- end }}
{{- end }}
{{- range .Values.shardedSchemas }}
[[sharded_schemas]]
database = {{ .database | quote }}
{{- if .name }}
name = {{ .name | quote }}
{{- end }}
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 }}
{{- range .Values.omnishardedTables }}
[[omnisharded_tables]]
database = {{ .database | quote }}
{{- if .sticky }}
sticky = {{ .sticky }}
{{- end }}
tables = {{ .tables | toToml }}
{{- end }}
{{- if or (hasKey .Values "tcpKeepalive") (hasKey .Values "tcpTime") (hasKey .Values "tcpInterval") (hasKey .Values "tcpRetries") }}
[tcp]
{{- if hasKey .Values "tcpKeepalives" }}
keepalive = {{ .Values.tcpKeepalive }}
{{- end }}
{{- if hasKey .Values "tcpTime" }}
time = {{ .Values.tcpTime }}
{{- end }}
{{- if hasKey .Values "tcpInterval" }}
interval = {{ .Values.tcpInterval }}
{{- end }}
{{- if hasKey .Values "tcpRetries" }}
retries = {{ .Values.tcpRetries }}
{{- end }}
{{- end }}
{{- if or (hasKey .Values "memoryNetBuffer") (hasKey .Values "memoryMessageBuffer") (hasKey .Values "memoryStackSize") }}
[memory]
{{- if hasKey .Values "memoryNetBuffer" }}
net_buffer = {{ .Values.memoryNetBuffer | int }}
{{- end }}
{{- if hasKey .Values "memoryMessageBuffer" }}
message_buffer = {{ .Values.memoryMessageBuffer | int }}
{{- end }}
{{- if hasKey .Values "memoryStackSize" }}
stack_size = {{ .Values.memoryStackSize | int }}
{{- end }}
{{- end }}
{{- if .Values.adminPassword }}
[admin]
password = {{ .Values.adminPassword | quote }}
{{- end }}
{{- if and .Values.gateway.enabled .Values.gateway.connectFromPgdog }}
[gateway]
address = "{{ include "pgdog.fullname" . }}-gateway.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.gateway.port | default 8443 }}"
{{- end }}
{{- if .Values.queryStats.enabled }}
[query_stats]
enabled = {{ .Values.queryStats.enabled }}
max_entries = {{ .Values.queryStats.maxEntries | default "10_000" }}
query_plan_threshold = {{ .Values.queryStats.queryPlanThreshold | default "250" }}
query_plans_cache = {{ .Values.queryStats.queryPlansCache | default "100" }}
query_plan_max_age = {{ .Values.queryStats.queryPlanMaxAge | default "15_000" }}
max_errors = {{ .Values.queryStats.maxErrors | default "100" }}
max_error_age = {{ .Values.queryStats.maxErrorAge | default "300_000" }}
{{- end }}
{{- if .Values.control.enabled }}
[control]
endpoint = {{ .Values.control.endpoint | quote }}
token = {{ .Values.control.token | quote }}
metrics_interval = {{ .Values.control.metricsInterval | default "1_000" }}
stats_interval = {{ .Values.control.statsInterval | default "5_000" }}
active_queries_interval = {{ .Values.control.activeQueriesInterval | default "5_000" }}
errors_interval = {{ .Values.control.errorsInterval | default "5_000" }}
request_timeout = {{ .Values.control.requestTimeout | default "1_000" }}
query_timings_chunk_size = {{ .Values.control.queryTimingsChunkSize | default "25" }}
query_timings_new_query_queue_size = {{ .Values.control.queryTimingsNewQueryQueueSize | default "1_000" }}
{{- end }}
{{- if .Values.rewrite }}
[rewrite]
enabled = {{ .Values.rewrite.enabled | default "false" }}
shard_key = {{ .Values.rewrite.shardKey | default "error" | quote }}
split_inserts = {{ .Values.rewrite.splitInserts | default "error" | quote }}
primary_key = {{ .Values.rewrite.primaryKey | default "ignore" | quote }}
{{- end }}