Add support for prometheus
[ric-plt/ric-dep.git] / helm / infrastructure / subcharts / prometheus / templates / node-exporter-rolebinding.yaml
diff --git a/helm/infrastructure/subcharts/prometheus/templates/node-exporter-rolebinding.yaml b/helm/infrastructure/subcharts/prometheus/templates/node-exporter-rolebinding.yaml
new file mode 100644 (file)
index 0000000..42c90d0
--- /dev/null
@@ -0,0 +1,19 @@
+{{- if and .Values.nodeExporter.enabled .Values.rbac.create }}
+{{- if .Values.podSecurityPolicy.enabled }}
+apiVersion: rbac.authorization.k8s.io/v1
+kind: RoleBinding
+metadata:
+  name: {{ template "prometheus.nodeExporter.fullname" . }}
+  labels:
+    {{- include "prometheus.nodeExporter.labels" . | nindent 4 }}
+{{ include "prometheus.namespace" . | indent 2 }}
+roleRef:
+  kind: Role
+  name: {{ template "prometheus.nodeExporter.fullname" . }}
+  apiGroup: rbac.authorization.k8s.io
+subjects:
+- kind: ServiceAccount
+  name: {{ template "prometheus.serviceAccountName.nodeExporter" . }}
+{{ include "prometheus.namespace" . | indent 2 }}
+{{- end }}
+{{- end }}