feat(common): Release 3.7.3 (#393)

This commit is contained in:
Bernd Schorgers 2025-03-14 10:38:35 +01:00 committed by GitHub
parent ade6955579
commit 245e1631c9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 167 additions and 99 deletions

View file

@ -9,7 +9,7 @@ Validate Role values
{{- $rules := $roleValues.rules -}}
{{- if not (mustHas $type $typeList) -}}
{{- fail (printf "You selected: `%s`. Type must be one of:\n%s\n" $type ($typeList|toYaml)) -}}
{{- fail (printf "\nYou selected: `%s`. Type must be one of:\n%s\n" $type ($typeList|toYaml)) -}}
{{- end -}}
{{- if not $rules -}}
{{- fail "Rules can't be empty" -}}

View file

@ -10,7 +10,7 @@ Validate RoleBinding values
{{- $roleRef := required "A roleRef is required" $roleBindingValues.roleRef -}}
{{- if not (mustHas $type $typeList) -}}
{{- fail (printf "You selected: `%s`. Type must be one of:\n%s\n" $type ($typeList|toYaml)) -}}
{{- fail (printf "\nYou selected: `%s`. Type must be one of:\n%s\n" $type ($typeList|toYaml)) -}}
{{- end -}}
{{- if not (hasKey $roleRef "identifier") -}}

View file

@ -0,0 +1,23 @@
{{/*
Return the enabled routes.
*/}}
{{- define "bjw-s.common.lib.route.enabledRoutes" -}}
{{- $rootContext := .rootContext -}}
{{- $enabledRoutes := dict -}}
{{- range $name, $route := $rootContext.Values.route -}}
{{- if kindIs "map" $route -}}
{{- /* Enable Route by default, but allow override */ -}}
{{- $routeEnabled := true -}}
{{- if hasKey $route "enabled" -}}
{{- $routeEnabled = $route.enabled -}}
{{- end -}}
{{- if $routeEnabled -}}
{{- $_ := set $enabledRoutes $name . -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- $enabledRoutes | toYaml -}}
{{- end -}}

View file

@ -1,21 +0,0 @@
{{/* Return the name of the primary route object */}}
{{- define "bjw-s.common.lib.route.primary" -}}
{{- $enabledRoutes := dict -}}
{{- range $name, $route := .Values.route -}}
{{- if $route.enabled -}}
{{- $_ := set $enabledRoutes $name . -}}
{{- end -}}
{{- end -}}
{{- $result := "" -}}
{{- range $name, $route := $enabledRoutes -}}
{{- if and (hasKey $route "primary") $route.primary -}}
{{- $result = $name -}}
{{- end -}}
{{- end -}}
{{- if not $result -}}
{{- $result = keys $enabledRoutes | first -}}
{{- end -}}
{{- $result -}}
{{- end -}}

View file

@ -15,7 +15,8 @@ Convert Route values to an object
{{- $objectName = printf "%s-%s" $objectName $override -}}
{{- end -}}
{{- else -}}
{{- if ne $identifier (include "bjw-s.common.lib.route.primary" $rootContext) -}}
{{- $enabledRoutes := (include "bjw-s.common.lib.route.enabledRoutes" (dict "rootContext" $rootContext) | fromYaml ) }}
{{- if and (not $objectValues.primary) (gt (len $enabledRoutes) 1) -}}
{{- if not (eq $objectName $identifier) -}}
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
{{- end -}}