mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-04 00:47:04 +02:00
feat(common): Release 3.7.3 (#393)
This commit is contained in:
parent
ade6955579
commit
245e1631c9
14 changed files with 167 additions and 99 deletions
|
@ -43,8 +43,8 @@ metadata:
|
|||
spec:
|
||||
parentRefs:
|
||||
{{- range $routeObject.parentRefs }}
|
||||
- group: {{ default "gateway.networking.k8s.io" .group }}
|
||||
kind: {{ default "Gateway" .kind }}
|
||||
- group: {{ .group | default "gateway.networking.k8s.io" }}
|
||||
kind: {{ .kind | default "Gateway" }}
|
||||
name: {{ required (printf "parentRef name is required for %v %v" $routeKind $routeObject.name) .name }}
|
||||
namespace: {{ required (printf "parentRef namespace is required for %v %v" $routeKind $routeObject.name) .namespace }}
|
||||
{{- if .sectionName }}
|
||||
|
@ -66,11 +66,11 @@ spec:
|
|||
{{ if $service -}}
|
||||
{{ $servicePrimaryPort = include "bjw-s.common.lib.service.primaryPort" (dict "rootContext" $rootContext "serviceObject" $service) | fromYaml -}}
|
||||
{{- end }}
|
||||
- group: {{ default "" .group | quote}}
|
||||
kind: {{ default "Service" .kind }}
|
||||
name: {{ default .name $service.name }}
|
||||
namespace: {{ default $rootContext.Release.Namespace .namespace }}
|
||||
port: {{ default .port $servicePrimaryPort.port }}
|
||||
- group: {{ .group | default "" | quote}}
|
||||
kind: {{ .kind | default "Service" }}
|
||||
name: {{ $service.name | default .name }}
|
||||
namespace: {{ .namespace | default $rootContext.Release.Namespace }}
|
||||
port: {{ .port | default $servicePrimaryPort.port }}
|
||||
weight: {{ include "bjw-s.common.lib.defaultKeepNonNullValue" (dict "value" .weight "default" 1) }}
|
||||
{{- end }}
|
||||
{{- if or (eq $routeKind "HTTPRoute") (eq $routeKind "GRPCRoute") }}
|
||||
|
|
|
@ -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" -}}
|
||||
|
|
|
@ -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") -}}
|
||||
|
|
|
@ -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 -}}
|
|
@ -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 -}}
|
|
@ -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 -}}
|
||||
|
|
|
@ -1,24 +1,19 @@
|
|||
{{/* Renders the Route objects required by the chart */}}
|
||||
{{/*
|
||||
Renders the Route objects required by the chart
|
||||
*/}}
|
||||
{{- define "bjw-s.common.render.routes" -}}
|
||||
{{- /* Generate named routes as required */ -}}
|
||||
{{- range $key, $route := .Values.route }}
|
||||
{{- /* Enable Route by default, but allow override */ -}}
|
||||
{{- $routeEnabled := true -}}
|
||||
{{- if hasKey $route "enabled" -}}
|
||||
{{- $routeEnabled = $route.enabled -}}
|
||||
{{- end -}}
|
||||
{{- $enabledRoutes := (include "bjw-s.common.lib.route.enabledRoutes" (dict "rootContext" $) | fromYaml ) -}}
|
||||
{{- range $key, $route := $enabledRoutes -}}
|
||||
{{- $routeValues := (mustDeepCopy $route) -}}
|
||||
|
||||
{{- if $routeEnabled -}}
|
||||
{{- $routeValues := (mustDeepCopy $route) -}}
|
||||
{{- /* Create object from the raw Route values */ -}}
|
||||
{{- $routeObject := (include "bjw-s.common.lib.route.valuesToObject" (dict "rootContext" $ "id" $key "values" $routeValues)) | fromYaml -}}
|
||||
|
||||
{{- /* Create object from the raw Route values */ -}}
|
||||
{{- $routeObject := (include "bjw-s.common.lib.route.valuesToObject" (dict "rootContext" $ "id" $key "values" $routeValues)) | fromYaml -}}
|
||||
{{- /* Perform validations on the Route before rendering */ -}}
|
||||
{{- include "bjw-s.common.lib.route.validate" (dict "rootContext" $ "object" $routeObject) -}}
|
||||
|
||||
{{- /* Perform validations on the Route before rendering */ -}}
|
||||
{{- include "bjw-s.common.lib.route.validate" (dict "rootContext" $ "object" $routeObject) -}}
|
||||
|
||||
{{- /* Include the Route class */ -}}
|
||||
{{- include "bjw-s.common.class.route" (dict "rootContext" $ "object" $routeObject) | nindent 0 -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- /* Include the Route class */ -}}
|
||||
{{- include "bjw-s.common.class.route" (dict "rootContext" $ "object" $routeObject) | nindent 0 -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue