feat(common)!: Release common-3.0.0 (#284)

This commit is contained in:
Bernd Schorgers 2024-03-11 10:28:52 +01:00 committed by GitHub
parent a27c4f6124
commit 3981facca6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 124 additions and 116 deletions

View file

@ -56,9 +56,20 @@ spec:
pathType: {{ default "Prefix" .pathType }}
backend:
service:
{{ $service := include "bjw-s.common.lib.service.getByIdentifier" (dict "rootContext" $rootContext "id" .service.name) | fromYaml -}}
{{ $service := dict -}}
{{ $serviceName := "" -}}
{{ $servicePort := 0 -}}
{{ if .service.name -}}
{{ $serviceName = tpl .service.name $rootContext -}}
{{ else if .service.identifier -}}
{{ $service = (include "bjw-s.common.lib.service.getByIdentifier" (dict "rootContext" $rootContext "id" .service.identifier) | fromYaml ) -}}
{{ if not $service -}}
{{fail (printf "No service found with this identifier. (ingress: '%s', path: '%s', identifier: '%s')" $ingressObject.identifier .path .service.identifier)}}
{{ end -}}
{{ $serviceName = $service.name -}}
{{ end -}}
{{ if empty (dig "port" nil .service) -}}
{{/* Default to the Service primary port if no port has been specified */ -}}
{{ if $service -}}
@ -73,10 +84,10 @@ spec:
{{ $servicePort = .service.port -}}
{{ else if kindIs "string" .service.port -}}
{{/* If a port name is given, try to resolve to a number */ -}}
{{ $servicePort = include "bjw-s.common.lib.service.getPortNumberByName" (dict "rootContext" $rootContext "serviceID" .service.name "portName" .service.port) -}}
{{ $servicePort = include "bjw-s.common.lib.service.getPortNumberByName" (dict "rootContext" $rootContext "serviceID" .service.identifier "portName" .service.port) -}}
{{ end -}}
{{ end -}}
name: {{ default .service.name $service.name }}
name: {{ default .service.name $serviceName }}
port:
number: {{ $servicePort }}
{{- end }}

View file

@ -4,12 +4,4 @@ Validate Ingress values
{{- define "bjw-s.common.lib.ingress.validate" -}}
{{- $rootContext := .rootContext -}}
{{- $ingressValues := .object -}}
{{- range $ingressValues.hosts -}}
{{- range .paths -}}
{{- if empty (dig "service" "name" nil .) -}}
{{- fail (printf "No service name configured. (ingress: %s, path: %s)" $ingressValues.identifier .path) -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}