mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-04 00:47:04 +02:00
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>
25 lines
803 B
Smarty
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 -}}
|