helm-charts/charts/library/common/templates/lib/controller/_enabled_controllers.tpl
2024-03-08 08:51:40 +01:00

23 lines
705 B
Smarty

{{/*
Return the enabled controllers.
*/}}
{{- define "bjw-s.common.lib.controller.enabledControllers" -}}
{{- $rootContext := .rootContext -}}
{{- $enabledControllers := dict -}}
{{- range $name, $controller := $rootContext.Values.controllers -}}
{{- if kindIs "map" $controller -}}
{{- /* Enable by default, but allow override */ -}}
{{- $controllerEnabled := true -}}
{{- if hasKey $controller "enabled" -}}
{{- $controllerEnabled = $controller.enabled -}}
{{- end -}}
{{- if $controllerEnabled -}}
{{- $_ := set $enabledControllers $name . -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- $enabledControllers | toYaml -}}
{{- end -}}