From 8c9e2e758ff520c70ebd7a720d7c7fc4a6d7db6f Mon Sep 17 00:00:00 2001 From: Francisco Esteveira <56481538+festeveira@users.noreply.github.com> Date: Wed, 27 Nov 2024 13:33:27 +0000 Subject: [PATCH 1/2] [prometheus-postgres-exporter] Implement ability to define an existing secret (#5011) * [prometheus-postgres-exporter] Implement ability to define an existing secret for the configuration file Signed-off-by: festeveira * Remove trailing whitespaces Signed-off-by: festeveira * Update Chart.yaml Signed-off-by: zeritti <47476160+zeritti@users.noreply.github.com> --------- Signed-off-by: festeveira Signed-off-by: MH Signed-off-by: zeritti <47476160+zeritti@users.noreply.github.com> Co-authored-by: MH Co-authored-by: zeritti <47476160+zeritti@users.noreply.github.com> --- charts/prometheus-postgres-exporter/Chart.yaml | 2 +- .../templates/deployment.yaml | 10 ++++++++-- charts/prometheus-postgres-exporter/values.yaml | 6 ++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/charts/prometheus-postgres-exporter/Chart.yaml b/charts/prometheus-postgres-exporter/Chart.yaml index eb653698ea57..84e8c3be94d8 100644 --- a/charts/prometheus-postgres-exporter/Chart.yaml +++ b/charts/prometheus-postgres-exporter/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 appVersion: "v0.16.0" description: A Helm chart for prometheus postgres-exporter name: prometheus-postgres-exporter -version: 6.5.0 +version: 6.6.0 home: https://github.com/prometheus-community/postgres_exporter sources: - https://github.com/prometheus-community/postgres_exporter diff --git a/charts/prometheus-postgres-exporter/templates/deployment.yaml b/charts/prometheus-postgres-exporter/templates/deployment.yaml index d7acda68696c..8c9165b5df94 100644 --- a/charts/prometheus-postgres-exporter/templates/deployment.yaml +++ b/charts/prometheus-postgres-exporter/templates/deployment.yaml @@ -159,7 +159,7 @@ spec: {{- toYaml . | nindent 12 }} {{- end }} volumeMounts: - {{- if .Values.config.postgresExporter }} + {{- if or .Values.config.postgresExporter .Values.config.existingSecret.enabled }} - name: postgres-exporter mountPath: /etc/postgres_exporter.yml subPath: postgres_exporter.yml @@ -195,7 +195,13 @@ spec: defaultMode: 420 name: {{ template "prometheus-postgres-exporter.fullname" . }} name: postgres-exporter - {{- end }} + {{- else if .Values.config.existingSecret.enabled }} + - secret: + defaultMode: 420 + secretName: {{ .Values.config.existingSecret.name }} + name: postgres-exporter + {{ end}} + {{- with .Values.extraVolumes }} {{ toYaml . | nindent 6 }} {{- end }} diff --git a/charts/prometheus-postgres-exporter/values.yaml b/charts/prometheus-postgres-exporter/values.yaml index 4686bce43e39..8d718f0ce717 100644 --- a/charts/prometheus-postgres-exporter/values.yaml +++ b/charts/prometheus-postgres-exporter/values.yaml @@ -189,6 +189,12 @@ config: # options: # sslmode: disable + # define an existing secret to be mounted as the config file + # needs to have the key 'postgres_exporter.yml' + existingSecret: + enabled: false + name: "" + nodeSelector: {} tolerations: [] From af068e7243e1a256da8d830b68f6c4413db6c6ab Mon Sep 17 00:00:00 2001 From: Matthew Mentlak <93769720+mentlak0@users.noreply.github.com> Date: Wed, 27 Nov 2024 13:44:11 +0000 Subject: [PATCH 2/2] [prometheus] pdb template values (#5001) * fix: bump chart v Signed-off-by: mentlak * chore: resolve requested changes Signed-off-by: mentlak * fix: uncomment default values Signed-off-by: mentlak * fix: brackets Signed-off-by: mentlak --------- Signed-off-by: mentlak --- charts/prometheus/Chart.yaml | 2 +- charts/prometheus/templates/pdb.yaml | 13 ++++++++++++- charts/prometheus/values.yaml | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/charts/prometheus/Chart.yaml b/charts/prometheus/Chart.yaml index b3552332ee29..b2e4c46907cc 100644 --- a/charts/prometheus/Chart.yaml +++ b/charts/prometheus/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 name: prometheus appVersion: v2.55.1 -version: 25.30.1 +version: 25.30.2 kubeVersion: ">=1.19.0-0" description: Prometheus is a monitoring system and time series database. home: https://prometheus.io/ diff --git a/charts/prometheus/templates/pdb.yaml b/charts/prometheus/templates/pdb.yaml index 7ffe67307116..fffbdc62fc87 100644 --- a/charts/prometheus/templates/pdb.yaml +++ b/charts/prometheus/templates/pdb.yaml @@ -11,5 +11,16 @@ spec: selector: matchLabels: {{- include "prometheus.server.matchLabels" . | nindent 6 }} - {{- toYaml $pdbSpec | nindent 2 }} + {{- if not (or (hasKey $pdbSpec "minAvailable") (hasKey $pdbSpec "maxUnavailable")) }} + maxUnavailable: 1 + {{- end }} + {{- if hasKey $pdbSpec "minAvailable" }} + minAvailable: {{ $pdbSpec.minAvailable }} + {{- end }} + {{- if hasKey $pdbSpec "maxUnavailable" }} + maxUnavailable: {{ $pdbSpec.maxUnavailable }} + {{- end }} + {{- if hasKey $pdbSpec "unhealthyPodEvictionPolicy" }} + unhealthyPodEvictionPolicy: {{ $pdbSpec.unhealthyPodEvictionPolicy }} + {{- end }} {{- end }} diff --git a/charts/prometheus/values.yaml b/charts/prometheus/values.yaml index 106db6d348d6..2ce96ef652d2 100644 --- a/charts/prometheus/values.yaml +++ b/charts/prometheus/values.yaml @@ -453,7 +453,7 @@ server: ## podDisruptionBudget: enabled: false - maxUnavailable: 1 + # maxUnavailable: 1 # minAvailable: 1 ## unhealthyPodEvictionPolicy is available since 1.27.0 (beta) ## https://kubernetes.io/docs/tasks/run-application/configure-pdb/#unhealthy-pod-eviction-policy