mirror of
https://github.com/nikdoof/helm-charts.git
synced 2025-12-23 06:39:23 +00:00
Add PrometheusRule and ServiceMonitor to common (#47)
* Add PrometheusRule and ServiceMonitor to common * Bump Kind version
This commit is contained in:
@@ -55,4 +55,12 @@ Main entrypoint for the common library chart. It will render all underlying temp
|
||||
{{- if .Values.secret -}}
|
||||
{{ include "common.secret" . | nindent 0 }}
|
||||
{{- end -}}
|
||||
|
||||
{{- if .Values.metrics.enabled -}}
|
||||
{{ include "common.serviceMonitor" . | nindent 0 }}
|
||||
{{- end -}}
|
||||
|
||||
{{- if and .Values.metrics.enabled .Values.metrics.prometheusRule.enabled -}}
|
||||
{{ include "common.prometheusRule" . | nindent 0 }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
19
charts/common/templates/_prometheusrule.tpl
Normal file
19
charts/common/templates/_prometheusrule.tpl
Normal file
@@ -0,0 +1,19 @@
|
||||
{{- define "common.prometheusRule" }}
|
||||
---
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: PrometheusRule
|
||||
metadata:
|
||||
name: {{ include "common.names.fullname" . }}
|
||||
labels:
|
||||
{{- include "common.labels" . | nindent 4 }}
|
||||
{{- with .Values.metrics.prometheusRule.labels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
groups:
|
||||
- name: {{ include "common.names.fullname" . }}
|
||||
rules:
|
||||
{{- with .Values.metrics.prometheusRule.rules }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
25
charts/common/templates/_servicemonitor.tpl
Normal file
25
charts/common/templates/_servicemonitor.tpl
Normal file
@@ -0,0 +1,25 @@
|
||||
{{- define "common.serviceMonitor" }}
|
||||
---
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: ServiceMonitor
|
||||
metadata:
|
||||
name: {{ include "common.names.fullname" . }}
|
||||
labels:
|
||||
{{- include "common.labels" . | nindent 4 }}
|
||||
{{- with .Values.metrics.serviceMonitor.labels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "common.labels.selectorLabels" . | nindent 6 }}
|
||||
endpoints:
|
||||
- port: metrics
|
||||
{{- with .Values.metrics.serviceMonitor.interval }}
|
||||
interval: {{ . }}
|
||||
{{- end }}
|
||||
{{- with .Values.metrics.serviceMonitor.scrapeTimeout }}
|
||||
scrapeTimeout: {{ . }}
|
||||
{{- end }}
|
||||
path: /metrics
|
||||
{{- end }}
|
||||
Reference in New Issue
Block a user