Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(operator): Support ServiceMonitor #619

Merged
merged 3 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{{- if .Values.clickhouseOperator.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "clickhouseOperator.fullname" . }}-metrics
namespace: {{ include "clickhouse.namespace" . }}
labels:
{{- include "clickhouseOperator.labels" . | nindent 4 }}
{{- if .Values.clickhouseOperator.serviceMonitor.additionalLabels }}
{{- toYaml .Values.clickhouseOperator.serviceMonitor.additionalLabels | nindent 4 }}
{{- end }}
spec:
endpoints:
- port: {{ include "clickhouseOperator.fullname" $ }}-metrics
path: /metrics
scheme: http
honorLabels: true
selector:
matchLabels:
{{- include "clickhouseOperator.selectorLabels" $ | nindent 6 }}
{{- with .Values.clickhouseOperator.serviceMonitor.interval }}
interval: {{ . }}
{{- end }}
{{- with .Values.clickhouseOperator.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ . }}
{{- end }}
{{- with .Values.clickhouseOperator.serviceMonitor.relabelings }}
relabelings:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.clickhouseOperator.serviceMonitor.metricRelabelings }}
metricRelabelings:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
14 changes: 14 additions & 0 deletions charts/clickhouse/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -762,3 +762,17 @@ clickhouseOperator:
configs:
# -- ClickHouse Operator confd files
confdFiles: null

serviceMonitor:
# serviceMonitor.enabled -- ServiceMonitor Custom resource is created for a [prometheus-operator](https://github.com/prometheus-operator/prometheus-operator)
enabled: false
# serviceMonitor.additionalLabels -- additional labels for service monitor
additionalLabels: {}
# serviceMonitor.interval --
interval: 30s
# serviceMonitor.scrapeTimeout -- Prometheus ServiceMonitor scrapeTimeout. If empty, Prometheus uses the global scrape timeout unless it is less than the target's scrape interval value in which the latter is used.
scrapeTimeout: ""
# serviceMonitor.relabelings -- Prometheus [RelabelConfigs] to apply to samples before scraping
relabelings: []
# serviceMonitor.metricRelabelings -- Prometheus [MetricRelabelConfigs] to apply to samples before ingestio
metricRelabelings: []