From 365443768bfe85d3fec5045d2406bab53ee38ce7 Mon Sep 17 00:00:00 2001 From: brandonbutler Date: Sat, 9 Mar 2024 18:09:50 +0000 Subject: [PATCH] Fix servicemonitor in helm chart --- chart/proxmox-exporter/Chart.yaml | 2 +- chart/proxmox-exporter/templates/servicemonitor.yaml | 12 +++++++++++- chart/proxmox-exporter/values.yaml | 5 +++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/chart/proxmox-exporter/Chart.yaml b/chart/proxmox-exporter/Chart.yaml index 82b812a..edc92f2 100644 --- a/chart/proxmox-exporter/Chart.yaml +++ b/chart/proxmox-exporter/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.0 +version: 0.1.1 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/chart/proxmox-exporter/templates/servicemonitor.yaml b/chart/proxmox-exporter/templates/servicemonitor.yaml index a8cf72c..36f3523 100644 --- a/chart/proxmox-exporter/templates/servicemonitor.yaml +++ b/chart/proxmox-exporter/templates/servicemonitor.yaml @@ -5,6 +5,12 @@ metadata: name: {{ include "proxmox-exporter.fullname" . }} labels: {{- include "proxmox-exporter.labels" . | nindent 4 }} + {{- if .Values.serviceMonitor.additionalLabels }} + {{- toYaml .Values.serviceMonitor.additionalLabels | nindent 4 }} + {{- end }} + {{- if .Values.serviceMonitor.annotations }} + annotations: {{ toYaml .Values.serviceMonitor.annotations | nindent 4 }} + {{- end }} spec: endpoints: - interval: 30s @@ -15,9 +21,13 @@ spec: {{- if .Values.serviceMonitor.metricRelabelings }} metricRelabelings: {{ toYaml .Values.serviceMonitor.metricRelabelings | nindent 8 }} {{- end }} +{{- if .Values.serviceMonitor.namespaceSelector }} + namespaceSelector: {{ toYaml .Values.serviceMonitor.namespaceSelector | nindent 4 }} +{{- else }} namespaceSelector: matchNames: - - {{ include "proxmox-exporter.namespace" . }} + - {{ .Release.Namespace }} +{{- end }} {{- if .Values.serviceMonitor.jobLabel }} jobLabel: {{ .Values.serviceMonitor.jobLabel | quote }} {{- end }} diff --git a/chart/proxmox-exporter/values.yaml b/chart/proxmox-exporter/values.yaml index c31d361..5e87c84 100644 --- a/chart/proxmox-exporter/values.yaml +++ b/chart/proxmox-exporter/values.yaml @@ -38,6 +38,11 @@ serviceMonitor: ## jobLabel: "app.kubernetes.io/name" additionalLabels: {} annotations: {} + namespaceSelector: {} + ## Default: scrape .Release.Namespace or namespaceOverride only + ## To scrape all, use the following: + ## namespaceSelector: + ## any: true targetLabels: [] relabelings: [] metricRelabelings: []