helm-charts/charts/library/common/templates/lib/ingress/_validate.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

23 lines
928 B
Smarty

{{/*
Validate Ingress values
*/}}
{{- define "bjw-s.common.lib.ingress.validate" -}}
{{- $rootContext := .rootContext -}}
{{- $ingressObject := .object -}}
{{- $enabledServices := (include "bjw-s.common.lib.service.enabledServices" (dict "rootContext" $rootContext) | fromYaml ) -}}
{{/* Verify automatic service detection */}}
{{- if not (eq 1 (len $enabledServices)) -}}
{{- range $ingressObject.hosts -}}
{{- $host := . -}}
{{- range $host.paths -}}
{{- $path := . -}}
{{- if or (not (has "service" (keys .))) (and (not $path.service.name) (not $path.service.identifier)) -}}
{{- fail (printf "Either service.name or service.identifier is required because automatic Service detection is not possible. (ingress: %s, host: %s, path: %s)" $ingressObject.identifier $host.host $path.path ) -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}