Skip to content

Commit

Permalink
feat(helm): Add ServiceMonitor resource (#212)
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolas Lamirault <[email protected]>
  • Loading branch information
nlamirault authored Jul 11, 2024
1 parent bc5e00d commit 5f1ffc9
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
40 changes: 40 additions & 0 deletions charts/dragonfly-operator/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{{- if .Values.serviceMonitor.enabled }}
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
{{- include "dragonfly-operator.labels" . | nindent 4 }}
app.kubernetes.io/component: controller-manager-metrics
{{- if .Values.serviceMonitor.labels }}
{{- toYaml .Values.serviceMonitor.labels | nindent 4}}
{{- end }}
name: {{ include "dragonfly-operator.fullname" . }}-controller-manager-metrics
spec:
endpoints:
- targetPort: {{ .Values.service.port }}
{{- if .Values.serviceMonitor.interval }}
interval: {{ .Values.serviceMonitor.interval }}
{{- end }}
{{- if .Values.serviceMonitor.telemetryPath }}
path: {{ .Values.serviceMonitor.path }}
{{- end }}
{{- if .Values.serviceMonitor.timeout }}
scrapeTimeout: {{ .Values.serviceMonitor.timeout }}
{{- end }}
{{- if .Values.serviceMonitor.relabelings }}
relabelings:
{{ toYaml .Values.serviceMonitor.relabelings | indent 6 }}
{{- end }}
{{- if .Values.serviceMonitor.metricRelabelings }}
metricRelabelings:
{{ toYaml .Values.serviceMonitor.metricRelabelings | indent 6 }}
{{- end }}
jobLabel: {{ template "dragonfly-operator.fullname" . }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels:
{{- include "dragonfly-operator.selectorLabels" . | nindent 6 }}
{{- end }}
23 changes: 23 additions & 0 deletions charts/dragonfly-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,26 @@ manager:
# operator: In
# values:
# - linux


serviceMonitor:
# When set true then use a ServiceMonitor to configure scraping
enabled: false
# Set how frequently Prometheus should scrape
interval: 30s
# Set path to cloudwatch-exporter telemtery-path
path: /metrics
# Set labels for the ServiceMonitor, use this to define your scrape label for Prometheus Operator
labels: {}
# Set timeout for scrape
timeout: 10s
# Set relabelings for the ServiceMonitor, use to apply to samples before scraping
relabelings: []
# Set metricRelabelings for the ServiceMonitor, use to apply to samples for ingestion
metricRelabelings: []
# Example - note the Kubernetes convention of camelCase instead of Prometheus' snake_case
# metricRelabelings:
# - sourceLabels: [dbinstance_identifier]
# action: replace
# replacement: mydbname
# targetLabel: dbname

0 comments on commit 5f1ffc9

Please sign in to comment.