mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-04 00:47:04 +02:00
fix(common): Release common-4.0.1 (#415)
This commit is contained in:
parent
a01a89cb13
commit
9a478444a4
14 changed files with 163 additions and 15 deletions
|
@ -4,10 +4,26 @@ Return a Route object by its Identifier.
|
|||
{{- define "bjw-s.common.lib.route.getByIdentifier" -}}
|
||||
{{- $rootContext := .rootContext -}}
|
||||
{{- $identifier := .id -}}
|
||||
|
||||
{{- $enabledServices := (include "bjw-s.common.lib.service.enabledServices" (dict "rootContext" $rootContext) | fromYaml ) -}}
|
||||
{{- $enabledRoutes := (include "bjw-s.common.lib.route.enabledRoutes" (dict "rootContext" $rootContext) | fromYaml ) }}
|
||||
|
||||
{{- if (hasKey $enabledRoutes $identifier) -}}
|
||||
{{- $objectValues := get $enabledRoutes $identifier -}}
|
||||
{{- include "bjw-s.common.lib.valuesToObject" (dict "rootContext" $rootContext "id" $identifier "values" $objectValues "itemCount" (len $enabledRoutes)) -}}
|
||||
{{- $object := include "bjw-s.common.lib.valuesToObject" (dict "rootContext" $rootContext "id" $identifier "values" $objectValues "itemCount" (len $enabledRoutes)) | fromYaml -}}
|
||||
|
||||
{{- /* Try to automatically determine the default Service identifier if needed and possible */ -}}
|
||||
{{- if eq 1 (len $enabledServices) -}}
|
||||
{{- range $object.rules -}}
|
||||
{{- range .backendRefs }}
|
||||
{{- $backendRef := . -}}
|
||||
{{- if and (empty (dig "name" nil $backendRef)) (empty (dig "identifier" nil $backendRef)) -}}
|
||||
{{- $_ := set $backendRef "identifier" ($enabledServices | keys | first) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $object | toYaml -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
|
|
@ -5,6 +5,21 @@ Validate Route values
|
|||
{{- $rootContext := .rootContext -}}
|
||||
{{- $routeObject := .object -}}
|
||||
|
||||
{{- $enabledServices := (include "bjw-s.common.lib.service.enabledServices" (dict "rootContext" $rootContext) | fromYaml ) -}}
|
||||
|
||||
{{/* Verify automatic Service detection */}}
|
||||
{{- if not (eq 1 (len $enabledServices)) -}}
|
||||
{{- range $routeObject.rules -}}
|
||||
{{- $rule := . -}}
|
||||
{{- range $rule.backendRefs }}
|
||||
{{- $backendRef := . -}}
|
||||
{{- if and (empty (dig "name" nil $backendRef)) (empty (dig "identifier" nil $backendRef)) -}}
|
||||
{{- fail (printf "Either name or identifier is required because automatic Service detection is not possible. (route: %s)" $routeObject.identifier) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Route Types */}}
|
||||
{{- $routeKind := $routeObject.kind | default "HTTPRoute"}}
|
||||
{{- if and (ne $routeKind "GRPCRoute") (ne $routeKind "HTTPRoute") (ne $routeKind "TCPRoute") (ne $routeKind "TLSRoute") (ne $routeKind "UDPRoute") }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue