Skip to content

Commit

Permalink
[kube-prometheus-stack] Add RBAC Proxy rule to Prom ClusterRole
Browse files Browse the repository at this point in the history
We need to add a rule into the prometheus ClusterRole if we want to
scrap the node-exporter via the RBAC Proxy.

fixes 3338

Signed-off-by: Alexandre Nicolaie <[email protected]>
  • Loading branch information
xunleii committed Oct 27, 2023
1 parent a04e17c commit 7691ea1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion charts/kube-prometheus-stack/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ name: kube-prometheus-stack
sources:
- https://github.com/prometheus-community/helm-charts
- https://github.com/prometheus-operator/kube-prometheus
version: 52.1.0
version: 52.1.1
appVersion: v0.68.0
kubeVersion: ">=1.19.0-0"
home: https://github.com/prometheus-operator/kube-prometheus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ rules:
verbs: ["get", "list", "watch"]
- nonResourceURLs: ["/metrics", "/metrics/cadvisor"]
verbs: ["get"]
{{/* fix(#3338): add required rules to use node-exporter with the RBAC proxy */}}
{{- if (index .Values "prometheus-node-exporter").kubeRBACProxy.enabled }}
{{- $nodeExporterCtx := (dict "Values" (index .Values "prometheus-node-exporter") "Chart" (dict "Name" "prometheus-node-exporter") "Release" .Release) }}
- apiGroups: [ "" ]
resources:
- services/{{ include "prometheus-node-exporter.fullname" $nodeExporterCtx }}
verbs: [ "get", "list", "watch" ]
{{- end }}
{{- if .Values.prometheus.additionalRulesForClusterRole }}
{{ toYaml .Values.prometheus.additionalRulesForClusterRole | indent 0 }}
{{- end }}
Expand Down

0 comments on commit 7691ea1

Please sign in to comment.