mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-03 16:37:04 +02:00
feat(common): Release version 2.0.0-beta.1 (#173)
This commit is contained in:
parent
19767d668c
commit
7b6ee00be6
189 changed files with 3110 additions and 3023 deletions
|
@ -3,24 +3,18 @@ This template serves as a blueprint for all Route objects that are created
|
|||
within the common library.
|
||||
*/}}
|
||||
{{- define "bjw-s.common.class.route" -}}
|
||||
{{- $values := .Values.route -}}
|
||||
{{- if hasKey . "ObjectValues" -}}
|
||||
{{- with .ObjectValues.route -}}
|
||||
{{- $values = . -}}
|
||||
{{- end -}}
|
||||
{{ end -}}
|
||||
{{- $rootContext := .rootContext -}}
|
||||
{{- $routeObject := .object -}}
|
||||
|
||||
{{- $fullName := include "bjw-s.common.lib.chart.names.fullname" . -}}
|
||||
{{- if and (hasKey $values "nameOverride") $values.nameOverride -}}
|
||||
{{- $fullName = printf "%v-%v" $fullName $values.nameOverride -}}
|
||||
{{ end -}}
|
||||
{{- $routeKind := $values.kind | default "HTTPRoute" -}}
|
||||
{{- $primaryService := get .Values.service (include "bjw-s.common.lib.service.primary" .) -}}
|
||||
{{- $defaultServiceName := $fullName -}}
|
||||
{{- if and (hasKey $primaryService "nameOverride") $primaryService.nameOverride -}}
|
||||
{{- $defaultServiceName = printf "%v-%v" $defaultServiceName $primaryService.nameOverride -}}
|
||||
{{- end -}}
|
||||
{{- $defaultServicePort := get $primaryService.ports (include "bjw-s.common.lib.service.primaryPort" (dict "values" $primaryService)) -}}
|
||||
{{- $routeKind := $routeObject.kind | default "HTTPRoute" -}}
|
||||
{{- $labels := merge
|
||||
($routeObject.labels | default dict)
|
||||
(include "bjw-s.common.lib.metadata.allLabels" $rootContext | fromYaml)
|
||||
-}}
|
||||
{{- $annotations := merge
|
||||
($routeObject.annotations | default dict)
|
||||
(include "bjw-s.common.lib.metadata.globalAnnotations" $rootContext | fromYaml)
|
||||
-}}
|
||||
---
|
||||
apiVersion: gateway.networking.k8s.io/v1alpha2
|
||||
{{- if and (ne $routeKind "GRPCRoute") (ne $routeKind "HTTPRoute") (ne $routeKind "TCPRoute") (ne $routeKind "TLSRoute") (ne $routeKind "UDPRoute") }}
|
||||
|
@ -28,39 +22,44 @@ apiVersion: gateway.networking.k8s.io/v1alpha2
|
|||
{{- end }}
|
||||
kind: {{ $routeKind }}
|
||||
metadata:
|
||||
name: {{ $fullName }}
|
||||
{{- with (merge ($values.labels | default dict) (include "bjw-s.common.lib.metadata.allLabels" $ | fromYaml)) }}
|
||||
labels: {{- toYaml . | nindent 4 }}
|
||||
name: {{ $routeObject.name }}
|
||||
{{- with $labels }}
|
||||
labels: {{- toYaml . | nindent 4 -}}
|
||||
{{- end }}
|
||||
{{- with (merge ($values.annotations | default dict) (include "bjw-s.common.lib.metadata.globalAnnotations" $ | fromYaml)) }}
|
||||
annotations: {{- toYaml . | nindent 4 }}
|
||||
{{- with $annotations }}
|
||||
annotations: {{- toYaml . | nindent 4 -}}
|
||||
{{- end }}
|
||||
spec:
|
||||
parentRefs:
|
||||
{{- range $values.parentRefs }}
|
||||
{{- range $routeObject.parentRefs }}
|
||||
- group: {{ default "gateway.networking.k8s.io" .group }}
|
||||
kind: {{ default "Gateway" .kind }}
|
||||
name: {{ required (printf "parentRef name is required for %v %v" $routeKind $fullName) .name }}
|
||||
namespace: {{ required (printf "parentRef namespace is required for %v %v" $routeKind $fullName) .namespace }}
|
||||
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 }}
|
||||
sectionName: {{ .sectionName | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if and (ne $routeKind "TCPRoute") (ne $routeKind "UDPRoute") $values.hostnames }}
|
||||
{{- if and (ne $routeKind "TCPRoute") (ne $routeKind "UDPRoute") $routeObject.hostnames }}
|
||||
hostnames:
|
||||
{{- with $values.hostnames }}
|
||||
{{- with $routeObject.hostnames }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- range $values.rules }}
|
||||
{{- range $routeObject.rules }}
|
||||
- backendRefs:
|
||||
{{- range .backendRefs }}
|
||||
{{ $service := include "bjw-s.common.lib.service.getByIdentifier" (dict "rootContext" $rootContext "id" .name) | fromYaml -}}
|
||||
{{ $servicePrimaryPort := dict -}}
|
||||
{{ 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 $defaultServiceName .name }}
|
||||
namespace: {{ default $.Release.Namespace .namespace }}
|
||||
port: {{ default $defaultServicePort.port .port }}
|
||||
name: {{ default .name $service.name }}
|
||||
namespace: {{ default $rootContext.Release.Namespace .namespace }}
|
||||
port: {{ default .port $servicePrimaryPort.port }}
|
||||
weight: {{ default 1 .weight }}
|
||||
{{- end }}
|
||||
{{- if (eq $routeKind "HTTPRoute") }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue