helm-charts/charts/library/common/templates/lib/serviceMonitor/_getByIdentifier.tpl
Bernd Schorgers a01a89cb13
feat(common): Release common 4.0.0 (#398)
Co-authored-by: lab-assistant[bot] <180935599+lab-assistant[bot]@users.noreply.github.com>
2025-05-16 08:55:14 +02:00

13 lines
666 B
Smarty

{{/*
Return a ServiceMonitor Object by its Identifier.
*/}}
{{- define "bjw-s.common.lib.serviceMonitor.getByIdentifier" -}}
{{- $rootContext := .rootContext -}}
{{- $identifier := .id -}}
{{- $enabledServiceMonitors := (include "bjw-s.common.lib.serviceMonitor.enabledServiceMonitors" (dict "rootContext" $rootContext) | fromYaml ) }}
{{- if (hasKey $enabledServiceMonitors $identifier) -}}
{{- $objectValues := get $enabledServiceMonitors $identifier -}}
{{- include "bjw-s.common.lib.valuesToObject" (dict "rootContext" $rootContext "id" $identifier "values" $objectValues "itemCount" (len $enabledServiceMonitors)) -}}
{{- end -}}
{{- end -}}