Skip to content

Commit efbab1c

Browse files
Speissidrdrsh
andauthored
Helm chart improvements including allowing user password to be pulled from K8s secret (#753)
* Make user min_pool_size configurable * Set user server_lifetime only if specified * Increment chart version * Use default instea of or * Allow enabling server_tls * statement_timeout default value * Allow pulling password from existing secret --------- Co-authored-by: Mostafa Abdelraouf <mostafa.mohmmed@gmail.com>
1 parent 9f12d79 commit efbab1c

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

charts/pgcat/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ maintainers:
55
- name: Wildcard
66
email: support@w6d.io
77
appVersion: "1.2.0"
8-
version: 0.2.0
8+
version: 0.2.1

charts/pgcat/templates/secret.yaml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ stringData:
1515
connect_timeout = {{ .Values.configuration.general.connect_timeout }}
1616
idle_timeout = {{ .Values.configuration.general.idle_timeout | int }}
1717
server_lifetime = {{ .Values.configuration.general.server_lifetime | int }}
18+
server_tls = {{ .Values.configuration.general.server_tls }}
1819
idle_client_in_transaction_timeout = {{ .Values.configuration.general.idle_client_in_transaction_timeout | int }}
1920
healthcheck_timeout = {{ .Values.configuration.general.healthcheck_timeout }}
2021
healthcheck_delay = {{ .Values.configuration.general.healthcheck_delay }}
@@ -58,11 +59,21 @@ stringData:
5859
##
5960
[pools.{{ $pool.name | quote }}.users.{{ $index }}]
6061
username = {{ $user.username | quote }}
62+
{{- if $user.password }}
6163
password = {{ $user.password | quote }}
64+
{{- else if and $user.passwordSecret.name $user.passwordSecret.key }}
65+
{{- $secret := (lookup "v1" "Secret" $.Release.Namespace $user.passwordSecret.name) }}
66+
{{- if $secret }}
67+
{{- $password := index $secret.data $user.passwordSecret.key | b64dec }}
68+
password = {{ $password | quote }}
69+
{{- end }}
70+
{{- end }}
6271
pool_size = {{ $user.pool_size }}
63-
statement_timeout = {{ $user.statement_timeout }}
64-
min_pool_size = 3
65-
server_lifetime = 60000
72+
statement_timeout = {{ default 0 $user.statement_timeout }}
73+
min_pool_size = {{ default 3 $user.min_pool_size }}
74+
{{- if $user.server_lifetime }}
75+
server_lifetime = {{ $user.server_lifetime }}
76+
{{- end }}
6677
{{- if and $user.server_username $user.server_password }}
6778
server_username = {{ $user.server_username | quote }}
6879
server_password = {{ $user.server_password | quote }}

charts/pgcat/values.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ configuration:
175175
# Max connection lifetime before it's closed, even if actively used.
176176
server_lifetime: 86400000 # 24 hours
177177

178+
# Whether to use TLS for server connections or not.
179+
server_tls: false
180+
178181
# How long a client is allowed to be idle while in a transaction (ms).
179182
idle_client_in_transaction_timeout: 0 # milliseconds
180183

@@ -315,7 +318,9 @@ configuration:
315318
# ## Credentials for users that may connect to this cluster
316319
# ## @param users [array]
317320
# ## @param users[0].username Name of the env var (required)
318-
# ## @param users[0].password Value for the env var (required)
321+
# ## @param users[0].password Value for the env var (required) leave empty to use existing secret see passwordSecret.name and passwordSecret.key
322+
# ## @param users[0].passwordSecret.name Name of the secret containing the password
323+
# ## @param users[0].passwordSecret.key Key in the secret containing the password
319324
# ## @param users[0].pool_size Maximum number of server connections that can be established for this user
320325
# ## @param users[0].statement_timeout Maximum query duration. Dangerous, but protects against DBs that died in a non-obvious way.
321326
# users: []

0 commit comments

Comments
 (0)