From 57918a350267e1f7d7ae5ece8523b3a008f34171 Mon Sep 17 00:00:00 2001 From: Joachim Burket Date: Wed, 18 Dec 2024 16:53:12 +0100 Subject: [PATCH] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Léo Colombaro --- charts/netbox/README.md | 4 +--- charts/netbox/templates/configmap.yaml | 7 +------ charts/netbox/values.yaml | 9 ++++++--- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/charts/netbox/README.md b/charts/netbox/README.md index c8427ff..3534563 100644 --- a/charts/netbox/README.md +++ b/charts/netbox/README.md @@ -208,11 +208,9 @@ The following table lists the configurable parameters for this chart and their d | `externalDatabase.password` | Password for external PostgreSQL (see also `existingSecret`) | `""` | | `externalDatabase.existingSecretName` | Fetch password for external PostgreSQL from a different `Secret` | `""` | | `externalDatabase.existingSecretKey` | Key to fetch the password in the above `Secret` | `postgresql-password` | -| `externalDatabase.sslMode` | PostgreSQL client SSL Mode setting | `prefer` | -| `externalDatabase.sslRootCert` | PostgreSQL client SSL Root Certificate setting | `""` | | `externalDatabase.connMaxAge` | The lifetime of a database connection, as an integer of seconds | `300` | | `externalDatabase.disableServerSideCursors` | Disable the use of server-side cursors transaction pooling | `false` | -| `externalDatabase.targetSessionAttrs` | Determines whether the session must have certain properties | `read-write` | +| `externalDatabase.options` | Additional PostgreSQL client parameters | `{}` | | `redis.enabled` | Deploy Redis using bundled Bitnami Redis chart | `true` | | `redis.*` | Values under this key are passed to the bundled Redis chart | n/a | | `tasksRedis.database` | Redis database number used for NetBox task queue | `0` | diff --git a/charts/netbox/templates/configmap.yaml b/charts/netbox/templates/configmap.yaml index df1b287..1036aaf 100644 --- a/charts/netbox/templates/configmap.yaml +++ b/charts/netbox/templates/configmap.yaml @@ -27,12 +27,7 @@ data: NAME: {{ .Values.externalDatabase.database | quote }} PORT: {{ .Values.externalDatabase.port | int }} {{- end }} - OPTIONS: - sslmode: {{ .Values.externalDatabase.sslMode | quote }} - {{- if .Values.externalDatabase.sslRootCert }} - sslrootcert: {{ .Values.externalDatabase.sslRootCert | quote }} - {{- end}} - target_session_attrs: {{ .Values.externalDatabase.targetSessionAttrs | default "read-write" | quote }} + OPTIONS: {{- include "common.tplvalues.render" (dict "value" .Values.externalDatabase.options "context" $) | nindent 8 }} CONN_MAX_AGE: {{ .Values.externalDatabase.connMaxAge | int }} DISABLE_SERVER_SIDE_CURSORS: {{ toJson .Values.externalDatabase.disableServerSideCursors }} diff --git a/charts/netbox/values.yaml b/charts/netbox/values.yaml index 7612131..3961fd1 100644 --- a/charts/netbox/values.yaml +++ b/charts/netbox/values.yaml @@ -1027,11 +1027,14 @@ externalDatabase: existingSecretKey: postgresql-password # The following settings also apply when using the bundled PostgreSQL chart: - sslMode: prefer - sslRootCert: "" connMaxAge: 300 disableServerSideCursors: false - targetSessionAttrs: read-write + ## @param externalDatabase.options Additional PostgreSQL client parameters + ## Ref: https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWORDS + ## + options: + sslmode: "prefer" + target_session_attrs: "read-write" ## Redis chart configuration ## https://github.com/bitnami/charts/blob/main/bitnami/redis/values.yaml