-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add ServiceMonitor for Prometheus operator (#58)
* feat: Add ServiceMonitor for Prometheus operator Backstage instances with the Prometheus /metrics endpoint configured [1] can set `serviceMonitor.enabled` to allow prometheus to scrape it's metrics Disabled by default. [1] https://github.com/backstage/backstage/blob/master/contrib/docs/tutorials/prometheus-metrics.md Signed-off-by: Nikolai R Kristiansen <nikolai.kristiansen@remarkable.no> * chore: Adress review feedback - Move to `metrics.serviceMonitor - Document prometheus-operator and /metrics endpoint requirements - Remove namespaceSelector config option - Add commonLabels and commonAnnotations Signed-off-by: Nikolai R Kristiansen <nikolai.kristiansen@remarkable.no> * chore: Roll chart version Signed-off-by: Nikolai R Kristiansen <nikolai.kristiansen@remarkable.no> * chore: Link to latest master version of /metrics tutorial Co-authored-by: Vincenzo Scamporlino <me@vinzscam.dev> Signed-off-by: Nikolai R Kristiansen <nikolai.kristiansen@remarkable.no> * fix: allow templating for labels and annotations Signed-off-by: Nikolai R Kristiansen <nikolai.kristiansen@remarkable.no> --------- Signed-off-by: Nikolai R Kristiansen <nikolai.kristiansen@remarkable.no> Co-authored-by: Vincenzo Scamporlino <me@vinzscam.dev>
- Loading branch information
Showing
5 changed files
with
74 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
dependencies: | ||
- name: common | ||
repository: https://charts.bitnami.com/bitnami | ||
version: 1.16.0 | ||
version: 1.17.1 | ||
- name: postgresql | ||
repository: https://charts.bitnami.com/bitnami | ||
version: 11.6.6 | ||
digest: sha256:5f0f118ac2ae2be90edd9c6952da4bcb41feb815b39a575e23ec2a0a9244d9cd | ||
generated: "2022-06-14T21:14:00.148159+01:00" | ||
version: 11.9.13 | ||
digest: sha256:e24333442ed7bee23fd4d0ae522d3e8c56fd212e4ff33f020ad12f1528ae78e9 | ||
generated: "2023-02-09T14:22:13.567819+01:00" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{{- if .Values.metrics.serviceMonitor.enabled }} | ||
apiVersion: monitoring.coreos.com/v1 | ||
kind: ServiceMonitor | ||
metadata: | ||
name: {{ include "common.names.fullname" $ }} | ||
namespace: {{ .Release.Namespace | quote }} | ||
{{- if or .Values.commonAnnotations .Values.metrics.serviceMonitor.annotations }} | ||
annotations: | ||
{{- if $.Values.commonAnnotations }} | ||
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} | ||
{{- end }} | ||
{{- if .Values.metrics.serviceMonitor.annotations }} | ||
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.serviceMonitor.annotations "context" $ ) | nindent 4 }} | ||
{{- end }} | ||
{{- end }} | ||
labels: {{ include "common.labels.standard" . | nindent 4 }} | ||
app.kubernetes.io/component: backstage | ||
{{- if .Values.commonLabels }} | ||
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} | ||
{{- end }} | ||
{{- if .Values.metrics.serviceMonitor.labels }} | ||
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.serviceMonitor.labels "context" $) | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
namespaceSelector: | ||
matchNames: | ||
- {{ .Release.Namespace | quote }} | ||
selector: | ||
matchLabels: {{ include "common.labels.standard" . | nindent 6 }} | ||
app.kubernetes.io/component: backstage | ||
endpoints: | ||
- port: http-backend | ||
path: {{ .Values.metrics.serviceMonitor.path }} | ||
{{- with .Values.metrics.serviceMonitor.interval }} | ||
interval: {{ . }} | ||
{{- end }} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters