Skip to content

Commit

Permalink
[prometheus-node-exporter]Add availability to deploy ServiceMonitor o…
Browse files Browse the repository at this point in the history
…nto a specific namespace. (prometheus-community#1526)

* Add availability to deploy ServiceMonitor onto a specific namespace. prometheus-community#1515

Signed-off-by: RyuSA <[email protected]>

* bumps up node-exporter version

2.2.0 -> 2.2.1

Signed-off-by: RyuSA <[email protected]>
  • Loading branch information
RyuSA authored Nov 27, 2021
1 parent 1442841 commit 5d2f7ca
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/prometheus-node-exporter/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
appVersion: 1.2.2
description: A Helm chart for prometheus node-exporter
name: prometheus-node-exporter
version: 2.2.0
version: 2.2.1
type: application
home: https://github.com/prometheus/node_exporter/
sources:
Expand Down
15 changes: 15 additions & 0 deletions charts/prometheus-node-exporter/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,18 @@ Allow the release namespace to be overridden for multi-namespace deployments in
{{- .Release.Namespace -}}
{{- end -}}
{{- end -}}

{{/*
Create the namespace name of the service monitor
*/}}
{{- define "prometheus-node-exporter.monitor-namespace" -}}
{{- if .Values.namespaceOverride -}}
{{- .Values.namespaceOverride -}}
{{- else -}}
{{- if .Values.prometheus.monitor.namespace -}}
{{- .Values.prometheus.monitor.namespace -}}
{{- else -}}
{{- .Release.Namespace -}}
{{- end -}}
{{- end -}}
{{- end -}}
2 changes: 1 addition & 1 deletion charts/prometheus-node-exporter/templates/monitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "prometheus-node-exporter.fullname" . }}
namespace: {{ template "prometheus-node-exporter.namespace" . }}
namespace: {{ template "prometheus-node-exporter.monitor-namespace" . }}
labels: {{ include "prometheus-node-exporter.labels" . | indent 4 }}
{{- if .Values.prometheus.monitor.additionalLabels }}
{{ toYaml .Values.prometheus.monitor.additionalLabels | indent 4 }}
Expand Down

0 comments on commit 5d2f7ca

Please sign in to comment.