Skip to content

Commit

Permalink
fix: Double scraping with servicemonitor due to headless service (#2967)
Browse files Browse the repository at this point in the history
* fix: Double scraping with servicemonitor due to headless service

* fix: Always add match expression in servicemonitor

Co-authored-by: Anton Kolesnikov <anton.e.kolesnikov@gmail.com>

---------

Co-authored-by: Anton Kolesnikov <anton.e.kolesnikov@gmail.com>
  • Loading branch information
AndreZiviani and kolesnikovae committed Jan 26, 2024
1 parent bf110f5 commit ba9d6e7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Expand Up @@ -29,8 +29,12 @@ spec:
matchLabels:
{{- include "pyroscope.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: {{ $component | quote }}
{{- with $serviceMonitor.matchExpressions }}
matchExpressions:
- key: prometheus.io/service-monitor
operator: NotIn
values:
- "false"
{{- with $serviceMonitor.matchExpressions }}
{{- toYaml . | nindent 6 }}
{{- end }}
endpoints:
Expand Down
3 changes: 3 additions & 0 deletions operations/pyroscope/helm/pyroscope/templates/services.yaml
Expand Up @@ -34,6 +34,9 @@ metadata:
labels:
{{- include "pyroscope.labels" . | nindent 4 }}
app.kubernetes.io/component: {{ $component | quote }}
{{- if .Values.serviceMonitor.enabled }}
prometheus.io/service-monitor: "false"
{{- end }}
spec:
type: ClusterIP
clusterIP: None
Expand Down

0 comments on commit ba9d6e7

Please sign in to comment.