Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

Commit

Permalink
[stable/prometheus-node-exporter] Override of namespace
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Katsyuba <arruzk@gmail.com>
  • Loading branch information
arruzk committed Nov 18, 2019
1 parent ec61610 commit b27c5cb
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 8 deletions.
2 changes: 1 addition & 1 deletion stable/prometheus-node-exporter/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v1
appVersion: 0.18.1
description: A Helm chart for prometheus node-exporter
name: prometheus-node-exporter
version: 1.7.3
version: 1.7.4
home: /~https://github.com/prometheus/node_exporter/
sources:
- /~https://github.com/prometheus/node_exporter/
Expand Down
1 change: 1 addition & 0 deletions stable/prometheus-node-exporter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ The following table lists the configurable parameters of the Node Exporter chart
| `prometheus.monitor.namespace` | namespace where servicemonitor resource should be created | `the same namespace as prometheus node exporter` | |
| `prometheus.monitor.scrapeTimeout` | Timeout after which the scrape is ended | `10s` | |
| `configmaps` | Allow mounting additional configmaps. | `[]` | |
| `namespaceOverride` | Override the deployment namespace | `""` (`Release.Namespace`) | |

Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,

Expand Down
11 changes: 11 additions & 0 deletions stable/prometheus-node-exporter/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,14 @@ Create the name of the service account to use
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}

{{/*
Allow the release namespace to be overridden for multi-namespace deployments in combined charts
*/}}
{{- define "prometheus-node-exporter.namespace" -}}
{{- if .Values.namespaceOverride -}}
{{- .Values.namespaceOverride -}}
{{- else -}}
{{- .Release.Namespace -}}
{{- end -}}
{{- end -}}
1 change: 1 addition & 0 deletions stable/prometheus-node-exporter/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: apps/v1
kind: DaemonSet
metadata:
name: {{ template "prometheus-node-exporter.fullname" . }}
namespace: {{ template "prometheus-node-exporter.namespace" . }}
labels: {{ include "prometheus-node-exporter.labels" . | indent 4 }}
spec:
selector:
Expand Down
3 changes: 2 additions & 1 deletion stable/prometheus-node-exporter/templates/endpoints.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: Endpoints
metadata:
name: {{ template "prometheus-node-exporter.fullname" . }}
namespace: {{ template "prometheus-node-exporter.namespace" . }}
labels:
{{ include "prometheus-node-exporter.labels" . | indent 4 }}
subsets:
Expand All @@ -14,4 +15,4 @@ subsets:
- name: metrics
port: 9100
protocol: TCP
{{- end }}
{{- end }}
1 change: 1 addition & 0 deletions stable/prometheus-node-exporter/templates/monitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "prometheus-node-exporter.fullname" . }}
namespace: {{ template "prometheus-node-exporter.namespace" . }}
labels: {{ include "prometheus-node-exporter.labels" . | indent 4 }}
{{- if .Values.prometheus.monitor.additionalLabels }}
{{ toYaml .Values.prometheus.monitor.additionalLabels | indent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
labels: {{ include "prometheus-node-exporter.labels" . | indent 4 }}
name: psp-{{ template "prometheus-node-exporter.fullname" . }}
namespace: {{ template "prometheus-node-exporter.namespace" . }}
labels: {{ include "prometheus-node-exporter.labels" . | indent 4 }}
rules:
- apiGroups: ['extensions']
resources: ['podsecuritypolicies']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels: {{ include "prometheus-node-exporter.labels" . | indent 4 }}
name: psp-{{ template "prometheus-node-exporter.fullname" . }}
namespace: {{ template "prometheus-node-exporter.namespace" . }}
labels: {{ include "prometheus-node-exporter.labels" . | indent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
Expand Down
3 changes: 2 additions & 1 deletion stable/prometheus-node-exporter/templates/psp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
labels: {{ include "prometheus-node-exporter.labels" . | indent 4 }}
name: {{ template "prometheus-node-exporter.fullname" . }}
namespace: {{ template "prometheus-node-exporter.namespace" . }}
labels: {{ include "prometheus-node-exporter.labels" . | indent 4 }}
spec:
privileged: false
# Required to prevent escalations to root.
Expand Down
1 change: 1 addition & 0 deletions stable/prometheus-node-exporter/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ template "prometheus-node-exporter.fullname" . }}
namespace: {{ template "prometheus-node-exporter.namespace" . }}
{{- if .Values.service.annotations }}
annotations:
{{ toYaml .Values.service.annotations | indent 4 }}
Expand Down
7 changes: 4 additions & 3 deletions stable/prometheus-node-exporter/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ template "prometheus-node-exporter.serviceAccountName" . }}
namespace: {{ template "prometheus-node-exporter.namespace" . }}
labels:
app: {{ template "prometheus-node-exporter.name" . }}
chart: {{ template "prometheus-node-exporter.chart" . }}
chart: {{ template "prometheus-node-exporter.chart" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
imagePullSecrets:
imagePullSecrets:
{{ toYaml .Values.serviceAccount.imagePullSecrets | indent 2 }}
{{- end -}}
{{- end -}}
{{- end -}}
4 changes: 4 additions & 0 deletions stable/prometheus-node-exporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,7 @@ extraHostVolumeMounts: []
configmaps: []
# - name: <configMapName>
# mountPath: <mountPath>

## Override the deployment namespace
##
namespaceOverride: ""

0 comments on commit b27c5cb

Please sign in to comment.