-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathingress-runtime.yaml
99 lines (97 loc) · 3.39 KB
/
ingress-runtime.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#
# Copyright (c) 2023 ZF Friedrichshafen AG
# Copyright (c) 2023 Mercedes-Benz Tech Innovation GmbH
# Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
# Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
{{- $fullName := include "txdc.fullname" . }}
{{- $controlLabels := include "txdc.runtime.labels" . | nindent 4 }}
{{- $controlEdcEndpoints := .Values.runtime.endpoints }}
{{- $gitVersion := .Capabilities.KubeVersion.GitVersion }}
{{- $namespace := .Release.Namespace }}
{{- range .Values.runtime.ingresses }}
{{- if and .enabled .endpoints }}
{{- $controlIngressName := printf "%s-runtime-%s" $fullName .hostname }}
---
{{- if semverCompare ">=1.19-0" $gitVersion }}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" $gitVersion }}
apiVersion: networking.k8s.io/v1beta1
{{- else }}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $controlIngressName }}
namespace: {{ $namespace | default "default" | quote }}
labels:
{{- $controlLabels | nindent 2 }}
annotations:
{{- if and .className (not (semverCompare ">=1.18-0" $gitVersion)) }}
{{- if not (hasKey .annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .annotations "kubernetes.io/ingress.class" .className}}
{{- end }}
{{- end }}
{{- if .certManager }}
{{- if .certManager.issuer }}
{{- $_ := set .annotations "cert-manager.io/issuer" .certManager.issuer}}
{{- end }}
{{- if .certManager.clusterIssuer }}
{{- $_ := set .annotations "cert-manager.io/cluster-issuer" .certManager.clusterIssuer}}
{{- end }}
{{- end }}
{{- with .annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .className (semverCompare ">=1.18-0" $gitVersion) }}
ingressClassName: {{ .className }}
{{- end }}
{{- if .hostname }}
{{- if .tls.enabled }}
tls:
- hosts:
- {{ .hostname }}
{{- if .tls.secretName }}
secretName: {{ .tls.secretName }}
{{- else }}
secretName: {{ $controlIngressName }}-tls
{{- end }}
{{- end }}
rules:
- host: {{ .hostname }}
http:
paths:
{{- $ingressEdcEndpoints := .endpoints }}
{{- range $name, $mapping := $controlEdcEndpoints }}
{{- if (has $name $ingressEdcEndpoints) }}
- path: {{ $mapping.path }}
pathType: Prefix
backend:
{{- if semverCompare ">=1.19-0" $gitVersion }}
service:
name: {{ $fullName }}-runtime
port:
number: {{ $mapping.port }}
{{- else }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}{{- /* end: if .enabled */}}
{{- end }}{{- /* end: range .Values.ingresses */}}