helm-charts/charts/library/common/templates/lib/routes/_validate.tpl
Bernd Schorgers 3d3028b889
feat(common): Release v2.4.0 (#245)
Signed-off-by: Christopher Larivière <lariviere.c@gmail.com>
Co-authored-by: Christopher Larivière <lariviere.c@gmail.com>
Co-authored-by: Markus Reiter <me@reitermark.us>
2023-12-10 08:56:08 +00:00

25 lines
803 B
Smarty

{{/*
Validate Route values
*/}}
{{- define "bjw-s.common.lib.route.validate" -}}
{{- $rootContext := .rootContext -}}
{{- $routeObject := .object -}}
{{/* Route Types */}}
{{- $routeKind := $routeObject.kind | default "HTTPRoute"}}
{{- if and (ne $routeKind "GRPCRoute") (ne $routeKind "HTTPRoute") (ne $routeKind "TCPRoute") (ne $routeKind "TLSRoute") (ne $routeKind "UDPRoute") }}
{{- fail (printf "Not a valid route kind (%s)" $routeKind) }}
{{- end }}
{{/* Route Rules */}}
{{- range $routeObject.rules }}
{{- if and (.filters) (.backendRefs) }}
{{- range .filters }}
{{- if eq .type "RequestRedirect" }}
{{- fail (printf "backend refs and request redirect filters cannot co-exist.")}}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end -}}