Skip to content

Commit

Permalink
Add monitor for gitops-dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff-french committed Jan 10, 2024
1 parent b994e84 commit 953a31f
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{{ $weave_gitops := index .Values "weave-gitops" }}
{{- if and $weave_gitops.enabled $weave_gitops.metrics.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "moonswitch-agent.fullname" . }}-weave-gitops
labels:
{{- include "moonswitch-agent.labels" . | nindent 4 }}
{{- with $weave_gitops.metrics.serviceMonitor.additionalLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
jobLabel: {{ template "moonswitch-agent.fullname" . }}-weave-gitops
endpoints:
- port: http-metrics
{{- if $weave_gitops.metrics.serviceMonitor.path }}
path: {{ $weave_gitops.metrics.serviceMonitor.path }}
{{- end }}
{{- if $weave_gitops.metrics.serviceMonitor.interval }}
interval: {{ $weave_gitops.metrics.serviceMonitor.interval }}
{{- end }}
{{- if $weave_gitops.metrics.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ $weave_gitops.metrics.serviceMonitor.scrapeTimeout }}
{{- end }}
{{- if $weave_gitops.metrics.serviceMonitor.metricRelabelings }}
metricRelabelings:
{{ toYaml $weave_gitops.metrics.serviceMonitor.metricRelabelings | indent 4 }}
{{- end }}
{{- if $weave_gitops.metrics.serviceMonitor.relabelings }}
relabelings:
{{ toYaml $weave_gitops.metrics.serviceMonitor.relabelings | indent 4 }}
{{- end }}
{{- if $weave_gitops.metrics.serviceMonitor.honorLabels }}
honorLabels: true
{{- end }}
selector:
matchLabels:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/name: weave-gitops
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
{{- end }}
14 changes: 13 additions & 1 deletion charts/moonswitch-agent/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,19 @@ weave-gitops:
metrics:
enabled: true
annotations: {}
# TODO: Write our own ServiceMonitor for this :2112/metrics
serviceMonitor:
enabled: true
# -- Interval at which endpoints should be scraped.
interval: 30s
# -- Add custom labels to the ServiceMonitor resource
additionalLabels:
monitored-by: moonswitch-agent
# -- Chooses the metric’s labels on collisions with target labels.
honorLabels: false
# -- Path to scrape metrics
path: /metrics
# -- Timeout for scrape metrics request
scrapeTimeout: 10s
resources:
requests:
cpu: 10m
Expand Down

0 comments on commit 953a31f

Please sign in to comment.