mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-04 08:57:04 +02:00
26 lines
1.2 KiB
Smarty
26 lines
1.2 KiB
Smarty
{{/*
|
|
Renders the serviceMonitor objects required by the chart.
|
|
*/}}
|
|
{{- define "bjw-s.common.render.serviceMonitors" -}}
|
|
{{- /* Generate named serviceMonitors as required */ -}}
|
|
{{- range $key, $serviceMonitor := .Values.serviceMonitor -}}
|
|
{{- /* Enable ServiceMonitor by default, but allow override */ -}}
|
|
{{- $serviceMonitorEnabled := true -}}
|
|
{{- if hasKey $serviceMonitor "enabled" -}}
|
|
{{- $serviceMonitorEnabled = $serviceMonitor.enabled -}}
|
|
{{- end -}}
|
|
|
|
{{- if $serviceMonitorEnabled -}}
|
|
{{- $serviceMonitorValues := (mustDeepCopy $serviceMonitor) -}}
|
|
|
|
{{- /* Create object from the raw ServiceMonitor values */ -}}
|
|
{{- $serviceMonitorObject := (include "bjw-s.common.lib.serviceMonitor.valuesToObject" (dict "rootContext" $ "id" $key "values" $serviceMonitorValues)) | fromYaml -}}
|
|
|
|
{{- /* Perform validations on the serviceMonitor before rendering */ -}}
|
|
{{- include "bjw-s.common.lib.serviceMonitor.validate" (dict "rootContext" $ "object" $serviceMonitorObject) -}}
|
|
|
|
{{/* Include the serviceMonitor class */}}
|
|
{{- include "bjw-s.common.class.serviceMonitor" (dict "rootContext" $ "object" $serviceMonitorObject) | nindent 0 -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end -}}
|