From 83f4ef71fca3103f1ee00b923074ad49967a42cf Mon Sep 17 00:00:00 2001 From: Julien Bouquillon Date: Sun, 12 Nov 2023 01:33:57 +0100 Subject: [PATCH 1/3] feat(cnpg-cluster): add Values.logLevel --- charts/cnpg-cluster/templates/cluster.cnpg.yaml | 1 + charts/cnpg-cluster/values.schema.json | 15 ++++++++++----- charts/cnpg-cluster/values.yaml | 3 +++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/charts/cnpg-cluster/templates/cluster.cnpg.yaml b/charts/cnpg-cluster/templates/cluster.cnpg.yaml index 4fc1bb3..2e12992 100644 --- a/charts/cnpg-cluster/templates/cluster.cnpg.yaml +++ b/charts/cnpg-cluster/templates/cluster.cnpg.yaml @@ -7,6 +7,7 @@ metadata: annotations: {{- include "cnpg-cluster.annotations" . | nindent 4 }} spec: + logLevel: {{ .Values.logLevel }} instances: {{ .Values.instances }} {{- if .Values.image.repository }} imageName: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" diff --git a/charts/cnpg-cluster/values.schema.json b/charts/cnpg-cluster/values.schema.json index 826d075..c85124f 100644 --- a/charts/cnpg-cluster/values.schema.json +++ b/charts/cnpg-cluster/values.schema.json @@ -1,7 +1,7 @@ { "type": "object", - "$id": "https://raw.githubusercontent.com/socialgouv/helm-charts/v1/charts/cnpg-cluster/values.schema.json", "$schema": "http://json-schema.org/draft-07/schema", + "$id": "https://raw.githubusercontent.com/socialgouv/helm-charts/v1/charts/cnpg-cluster/values.schema.json", "required": [], "properties": { "instances": { @@ -9,6 +9,11 @@ "title": "Number of Postgres instances in the cluster", "default": "1" }, + "logLevel": { + "type": ["string"], + "title": "The instances log level, one of the following values: error, warning, info (default), debug, trace", + "default": "info" + }, "annotations": { "type": ["object"], "title": "CNPG cluster annotations" @@ -260,11 +265,11 @@ } }, "postInitApplicationSQL": { - "type": ["array"], + "type": "array", + "title": "List of SQL queries to be executed as a superuser in the application database right after is created - to be used with extreme care (by default empty)", "items": { - "type": "string" - }, - "title": "List of SQL queries to be executed as a superuser in the application database right after is created - to be used with extreme care (by default empty)" + "type": ["string"] + } }, "postInitApplicationSQLRefs": { "type": ["object", "null"], diff --git a/charts/cnpg-cluster/values.yaml b/charts/cnpg-cluster/values.yaml index d928ff7..3edb68c 100644 --- a/charts/cnpg-cluster/values.yaml +++ b/charts/cnpg-cluster/values.yaml @@ -7,6 +7,9 @@ # @param {number} [instances] Number of Postgres instances in the cluster instances: 1 +# @param {string} [logLevel] The instances log level, one of the following values: error, warning, info (default), debug, trace +logLevel: info + # @param {object} [annotations] CNPG cluster annotations annotations: {} From 694e406710c44fc5ef6e6a6fdc5fb4e33217e512 Mon Sep 17 00:00:00 2001 From: Julien Bouquillon Date: Sun, 12 Nov 2023 01:35:11 +0100 Subject: [PATCH 2/3] fix --- charts/cnpg-cluster/values.schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/cnpg-cluster/values.schema.json b/charts/cnpg-cluster/values.schema.json index c85124f..79f7ee7 100644 --- a/charts/cnpg-cluster/values.schema.json +++ b/charts/cnpg-cluster/values.schema.json @@ -1,7 +1,7 @@ { "type": "object", - "$schema": "http://json-schema.org/draft-07/schema", "$id": "https://raw.githubusercontent.com/socialgouv/helm-charts/v1/charts/cnpg-cluster/values.schema.json", + "$schema": "http://json-schema.org/draft-07/schema", "required": [], "properties": { "instances": { From 5ff667ff7fc317e8088632884d38c143ef06fd40 Mon Sep 17 00:00:00 2001 From: Julien Bouquillon Date: Sun, 12 Nov 2023 01:40:00 +0100 Subject: [PATCH 3/3] fif --- .../tests/__snapshot__/cnpg-cluster_test.yaml.snap | 4 ++++ charts/cnpg-cluster/tests/cnpg-cluster_test.yaml | 4 ++++ charts/cnpg-cluster/tests/values/monitor.yaml | 2 ++ 3 files changed, 10 insertions(+) diff --git a/charts/cnpg-cluster/tests/__snapshot__/cnpg-cluster_test.yaml.snap b/charts/cnpg-cluster/tests/__snapshot__/cnpg-cluster_test.yaml.snap index 00775ef..25a599a 100644 --- a/charts/cnpg-cluster/tests/__snapshot__/cnpg-cluster_test.yaml.snap +++ b/charts/cnpg-cluster/tests/__snapshot__/cnpg-cluster_test.yaml.snap @@ -60,6 +60,7 @@ cluster with enabled backup and recovery: imageName: ghcr.io/cloudnative-pg/postgis:15 imagePullPolicy: IfNotPresent instances: 1 + logLevel: info maxSyncReplicas: 0 minSyncReplicas: 0 monitoring: @@ -158,6 +159,7 @@ cluster with latest recovery enabled: imageName: ghcr.io/cloudnative-pg/postgis:15 imagePullPolicy: IfNotPresent instances: 1 + logLevel: info maxSyncReplicas: 0 minSyncReplicas: 0 monitoring: @@ -213,6 +215,7 @@ cluster with recovery enabled: imageName: ghcr.io/cloudnative-pg/postgis:15 imagePullPolicy: IfNotPresent instances: 1 + logLevel: info maxSyncReplicas: 0 minSyncReplicas: 0 monitoring: @@ -264,6 +267,7 @@ cluster with scheduled backup enabled: imageName: ghcr.io/cloudnative-pg/postgis:15 imagePullPolicy: IfNotPresent instances: 1 + logLevel: info maxSyncReplicas: 0 minSyncReplicas: 0 monitoring: diff --git a/charts/cnpg-cluster/tests/cnpg-cluster_test.yaml b/charts/cnpg-cluster/tests/cnpg-cluster_test.yaml index 0927d94..f8f6906 100644 --- a/charts/cnpg-cluster/tests/cnpg-cluster_test.yaml +++ b/charts/cnpg-cluster/tests/cnpg-cluster_test.yaml @@ -137,3 +137,7 @@ tests: - template: pooler.cnpg.yaml matchSnapshot: path: spec + - template: cluster.cnpg.yaml + equal: + path: spec.logLevel + value: "debug" diff --git a/charts/cnpg-cluster/tests/values/monitor.yaml b/charts/cnpg-cluster/tests/values/monitor.yaml index 1356743..9522f25 100644 --- a/charts/cnpg-cluster/tests/values/monitor.yaml +++ b/charts/cnpg-cluster/tests/values/monitor.yaml @@ -1,6 +1,8 @@ monitoring: enablePodMonitor: true +logLevel: debug + poolers: rw: instances: 3