From 4c4ae43cb5adf63536db23cbb0c21f30b6a8cc5e Mon Sep 17 00:00:00 2001 From: Markus Pesch Date: Sun, 27 Oct 2024 19:31:31 +0100 Subject: [PATCH] [prometheus-postgres-exporter] support custom TLS config (#4941) Signed-off-by: Markus Pesch --- charts/prometheus-postgres-exporter/Chart.yaml | 2 +- .../templates/deployment.yaml | 16 ++++++---------- .../templates/servicemonitor.yaml | 7 +++++++ .../prometheus-postgres-exporter/values.yaml | 18 +++++++++++++++++- 4 files changed, 31 insertions(+), 12 deletions(-) diff --git a/charts/prometheus-postgres-exporter/Chart.yaml b/charts/prometheus-postgres-exporter/Chart.yaml index 4e3525296edc..cd8d4c80c24a 100644 --- a/charts/prometheus-postgres-exporter/Chart.yaml +++ b/charts/prometheus-postgres-exporter/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 appVersion: "v0.15.0" description: A Helm chart for prometheus postgres-exporter name: prometheus-postgres-exporter -version: 6.3.1 +version: 6.4.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 90ff66ec4ac5..d7acda68696c 100644 --- a/charts/prometheus-postgres-exporter/templates/deployment.yaml +++ b/charts/prometheus-postgres-exporter/templates/deployment.yaml @@ -144,18 +144,14 @@ spec: - name: http containerPort: {{ .Values.service.targetPort }} protocol: TCP + {{- with .Values.livenessProbe }} livenessProbe: - initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} - timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} - httpGet: - path: / - port: http + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.readinessProbe }} readinessProbe: - initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} - timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} - httpGet: - path: / - port: http + {{- toYaml . | nindent 12 }} + {{- end }} resources: {{ toYaml .Values.resources | indent 12 }} {{- with .Values.securityContext }} diff --git a/charts/prometheus-postgres-exporter/templates/servicemonitor.yaml b/charts/prometheus-postgres-exporter/templates/servicemonitor.yaml index 46c680a9850b..ca31a24e0c2b 100644 --- a/charts/prometheus-postgres-exporter/templates/servicemonitor.yaml +++ b/charts/prometheus-postgres-exporter/templates/servicemonitor.yaml @@ -20,6 +20,9 @@ spec: {{- if .Values.serviceMonitor.telemetryPath }} path: {{ .Values.serviceMonitor.telemetryPath }} {{- end }} +{{- if .Values.serviceMonitor.scheme }} + scheme: {{ .Values.serviceMonitor.scheme }} +{{- end }} {{- if .Values.serviceMonitor.timeout }} scrapeTimeout: {{ .Values.serviceMonitor.timeout }} {{- end }} @@ -30,6 +33,10 @@ spec: {{- if .Values.serviceMonitor.relabelings }} relabelings: {{ toYaml .Values.serviceMonitor.relabelings | nindent 4 }} +{{- end }} +{{- with .Values.serviceMonitor.tlsConfig }} + tlsConfig: +{{- toYaml . | nindent 6 }} {{- end }} jobLabel: {{ template "prometheus-postgres-exporter.fullname" . }} namespaceSelector: diff --git a/charts/prometheus-postgres-exporter/values.yaml b/charts/prometheus-postgres-exporter/values.yaml index 80c229dc24c7..df791aea4c75 100644 --- a/charts/prometheus-postgres-exporter/values.yaml +++ b/charts/prometheus-postgres-exporter/values.yaml @@ -45,6 +45,10 @@ serviceMonitor: # metricRelabelings: [] # Set relabel_configs as per https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config # relabelings: [] + # HTTP scheme to use for scraping. For example `http` or `https`. Default is `http`. + # scheme: http + # TLS configuration to use when scraping the metric endpoint by Prometheus. + # tlsConfig: {} prometheusRule: enabled: false @@ -195,13 +199,25 @@ annotations: {} podLabels: {} -# Configurable health checks +# Configurable probes. If TLS client authentication is enabled at the exporter, TCP probe must be used. livenessProbe: initialDelaySeconds: 0 + httpGet: + path: / + port: http + scheme: HTTP + # tcpSocket: + # port: http timeoutSeconds: 3 readinessProbe: initialDelaySeconds: 0 + httpGet: + path: / + port: http + scheme: HTTP + # tcpSocket: + # port: http timeoutSeconds: 1 # Labels and annotations to attach to the deployment resource