Skip to content

Commit

Permalink
[kube-prometheus-stack] - targetLabels for all exporters (#4973)
Browse files Browse the repository at this point in the history
Co-authored-by: Jan-Otto Kröpke <[email protected]>
  • Loading branch information
kranthikirang and jkroepke authored Nov 5, 2024
1 parent f828f54 commit 686ceff
Show file tree
Hide file tree
Showing 12 changed files with 75 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 @@ -23,7 +23,7 @@ name: kube-prometheus-stack
sources:
- https://github.com/prometheus-community/helm-charts
- https://github.com/prometheus-operator/kube-prometheus
version: 65.7.0
version: 65.8.0
appVersion: v0.77.2
kubeVersion: ">=1.19.0-0"
home: https://github.com/prometheus-operator/kube-prometheus
Expand Down
2 changes: 2 additions & 0 deletions charts/kube-prometheus-stack/ci/03-non-defaults-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ prometheusOperator:
operator: NotIn
values:
- "true"
extraArgs:
- --labels="cluster=talos-cluster"

alertmanager:
alertmanagerSpec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ metadata:
{{ include "kube-prometheus-stack.labels" . | indent 4 }}
spec:
jobLabel: {{ .Values.coreDns.serviceMonitor.jobLabel }}
{{- with .Values.coreDns.serviceMonitor.targetLabels }}
targetLabels:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- include "servicemonitor.scrapeLimits" .Values.coreDns.serviceMonitor | nindent 2 }}
selector:
{{- if .Values.coreDns.serviceMonitor.selector }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ spec:
serverName: {{ .Values.kubeApiServer.tlsConfig.serverName }}
insecureSkipVerify: {{ .Values.kubeApiServer.tlsConfig.insecureSkipVerify }}
jobLabel: {{ .Values.kubeApiServer.serviceMonitor.jobLabel }}
{{- with .Values.kubeApiServer.serviceMonitor.targetLabels }}
targetLabels:
{{- toYaml . | nindent 4 }}
{{- end }}
namespaceSelector:
matchNames:
- default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ metadata:
{{ include "kube-prometheus-stack.labels" . | indent 4 }}
spec:
jobLabel: {{ .Values.kubeControllerManager.serviceMonitor.jobLabel }}
{{- with .Values.kubeControllerManager.serviceMonitor.targetLabels }}
targetLabels:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- include "servicemonitor.scrapeLimits" .Values.kubeControllerManager.serviceMonitor | nindent 2 }}
selector:
{{- if .Values.kubeControllerManager.serviceMonitor.selector }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ metadata:
{{ include "kube-prometheus-stack.labels" . | indent 4 }}
spec:
jobLabel: {{ .Values.kubeDns.serviceMonitor.jobLabel }}
{{- with .Values.kubeDns.serviceMonitor.targetLabels }}
targetLabels:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- include "servicemonitor.scrapeLimits" .Values.kubeDns.serviceMonitor | nindent 2 }}
selector:
{{- if .Values.kubeDns.serviceMonitor.selector }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ metadata:
{{ include "kube-prometheus-stack.labels" . | indent 4 }}
spec:
jobLabel: {{ .Values.kubeEtcd.serviceMonitor.jobLabel }}
{{- with .Values.kubeEtcd.serviceMonitor.targetLabels }}
targetLabels:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- include "servicemonitor.scrapeLimits" .Values.kubeEtcd.serviceMonitor | nindent 4 }}
selector:
{{- if .Values.kubeEtcd.serviceMonitor.selector }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ metadata:
{{ include "kube-prometheus-stack.labels" . | indent 4 }}
spec:
jobLabel: {{ .Values.kubeProxy.serviceMonitor.jobLabel }}
{{- with .Values.kubeProxy.serviceMonitor.targetLabels }}
targetLabels:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- include "servicemonitor.scrapeLimits" .Values.kubeProxy.serviceMonitor | nindent 2 }}
selector:
{{- if .Values.kubeProxy.serviceMonitor.selector }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ metadata:
{{ include "kube-prometheus-stack.labels" . | indent 4 }}
spec:
jobLabel: {{ .Values.kubeScheduler.serviceMonitor.jobLabel }}
{{- with .Values.kubeScheduler.serviceMonitor.targetLabels }}
targetLabels:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- include "servicemonitor.scrapeLimits" .Values.kubeScheduler.serviceMonitor | nindent 2 }}
selector:
{{- if .Values.kubeScheduler.serviceMonitor.selector }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,10 @@ spec:
{{- end }}
{{- end }}
jobLabel: k8s-app
{{- with .Values.kubelet.serviceMonitor.targetLabels }}
targetLabels:
{{- toYaml . | nindent 4 }}
{{- end }}
namespaceSelector:
matchNames:
- {{ .Values.kubelet.namespace }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ spec:
- --web.key-file=/cert/{{ if .Values.prometheusOperator.admissionWebhooks.certManager.enabled }}tls.key{{ else }}key{{ end }}
- --web.listen-address=:{{ .Values.prometheusOperator.tls.internalPort }}
- --web.tls-min-version={{ .Values.prometheusOperator.tls.tlsMinVersion }}
{{- with .Values.prometheusOperator.extraArgs }}
{{- tpl (toYaml .) $ | nindent 12 }}
{{- end }}
ports:
- containerPort: {{ .Values.prometheusOperator.tls.internalPort }}
name: https
Expand Down
37 changes: 37 additions & 0 deletions charts/kube-prometheus-stack/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1294,6 +1294,10 @@ kubeApiServer:
additionalLabels: {}
# foo: bar

## defines the labels which are transferred from the associated Kubernetes Service object onto the ingested metrics.
## https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#servicemonitor
targetLabels: []

## Component scraping the kubelet and kubelet-hosted cAdvisor
##
kubelet:
Expand Down Expand Up @@ -1500,6 +1504,10 @@ kubelet:
additionalLabels: {}
# foo: bar

## defines the labels which are transferred from the associated Kubernetes Service object onto the ingested metrics.
## https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#servicemonitor
targetLabels: []

## Component scraping the kube controller manager
##
kubeControllerManager:
Expand Down Expand Up @@ -1603,6 +1611,10 @@ kubeControllerManager:
additionalLabels: {}
# foo: bar

## defines the labels which are transferred from the associated Kubernetes Service object onto the ingested metrics.
## https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#servicemonitor
targetLabels: []

## Component scraping coreDns. Use either this or kubeDns
##
coreDns:
Expand Down Expand Up @@ -1681,6 +1693,10 @@ coreDns:
additionalLabels: {}
# foo: bar

## defines the labels which are transferred from the associated Kubernetes Service object onto the ingested metrics.
## https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#servicemonitor
targetLabels: []

## Component scraping kubeDns. Use either this or coreDns
##
kubeDns:
Expand Down Expand Up @@ -1775,6 +1791,10 @@ kubeDns:
additionalLabels: {}
# foo: bar

## defines the labels which are transferred from the associated Kubernetes Service object onto the ingested metrics.
## https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#servicemonitor
targetLabels: []

## Component scraping etcd
##
kubeEtcd:
Expand Down Expand Up @@ -1880,6 +1900,10 @@ kubeEtcd:
additionalLabels: {}
# foo: bar

## defines the labels which are transferred from the associated Kubernetes Service object onto the ingested metrics.
## https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#servicemonitor
targetLabels: []

## Component scraping kube scheduler
##
kubeScheduler:
Expand Down Expand Up @@ -1982,6 +2006,10 @@ kubeScheduler:
additionalLabels: {}
# foo: bar

## defines the labels which are transferred from the associated Kubernetes Service object onto the ingested metrics.
## https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#servicemonitor
targetLabels: []

## Component scraping kube proxy
##
kubeProxy:
Expand Down Expand Up @@ -2070,6 +2098,10 @@ kubeProxy:
additionalLabels: {}
# foo: bar

## defines the labels which are transferred from the associated Kubernetes Service object onto the ingested metrics.
## https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#servicemonitor
targetLabels: []

## Component scraping kube state metrics
##
kubeStateMetrics:
Expand Down Expand Up @@ -2742,6 +2774,11 @@ prometheusOperator:
## Create EndpointSlice objects for kubelet targets.
kubeletEndpointSliceEnabled: false

## Extra arguments to pass to prometheusOperator
# https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/operator.md
extraArgs: []
# - --labels="cluster=talos-cluster"

## Create a servicemonitor for the operator
##
serviceMonitor:
Expand Down

0 comments on commit 686ceff

Please sign in to comment.