Skip to content

Commit

Permalink
Add support for attaching node metadata (#3820)
Browse files Browse the repository at this point in the history
* Add support for attachMetadata in service monitor for kubelet
  endpoint available since Prometheus 2.45.0

Signed-off-by: zeritti <[email protected]>
  • Loading branch information
zeritti authored Sep 23, 2023
1 parent 93a2364 commit 1a60cd7
Show file tree
Hide file tree
Showing 3 changed files with 10 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: 51.1.1
version: 51.2.0
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 @@ -12,6 +12,10 @@ metadata:
{{- include "kube-prometheus-stack.labels" . | indent 4 }}
spec:
{{- include "servicemonitor.scrapeLimits" .Values.kubelet.serviceMonitor | nindent 2 }}
{{- with .Values.kubelet.serviceMonitor.attachMetadata }}
attachMetadata:
{{- toYaml . | nindent 4 }}
{{- end }}
endpoints:
{{- if .Values.kubelet.serviceMonitor.https }}
- port: https-metrics
Expand Down
5 changes: 5 additions & 0 deletions charts/kube-prometheus-stack/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1150,6 +1150,11 @@ kubelet:
namespace: kube-system

serviceMonitor:
## Attach metadata to discovered targets. Requires Prometheus v2.45 for endpoints created by the operator.
##
attachMetadata:
node: false

## Scrape interval. If not set, the Prometheus default scrape interval is used.
##
interval: ""
Expand Down

0 comments on commit 1a60cd7

Please sign in to comment.