|
| 1 | +# Copyright 2025 The Kubernetes Authors. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +{{- if and .Values.app.httproute.enabled (eq .Values.app.mode "dashboard")}} |
| 16 | + |
| 17 | +# Determine the service port to use for the HTTPRoute configuration |
| 18 | +# If TLS is enabled in the HTTPRoute configuration, use the TLS service port. |
| 19 | +# Otherwise, fall back to the HTTP service port. |
| 20 | +{{- $servicePort := (ternary 443 80 .Values.app.httproute.tls.enabled) }} |
| 21 | + |
| 22 | +apiVersion: gateway.networking.k8s.io/v1 |
| 23 | +kind: HTTPRoute |
| 24 | +metadata: |
| 25 | + name: {{ template "kubernetes-dashboard.name" . }} |
| 26 | + labels: |
| 27 | + {{- include "kubernetes-dashboard.labels" . | nindent 4 }} |
| 28 | + {{- with .Values.app.httproute.labels }} |
| 29 | + {{- toYaml . | nindent 4 }} |
| 30 | + {{- end }} |
| 31 | + annotations: |
| 32 | + {{- include "kubernetes-dashboard.annotations" . | nindent 4 }} |
| 33 | + {{- with .Values.app.httproute.annotations }} |
| 34 | + {{- toYaml . | nindent 4 }} |
| 35 | + {{- end }} |
| 36 | +spec: |
| 37 | + {{- with .Values.app.httproute.parentRefs }} |
| 38 | + parentRefs: |
| 39 | + {{- toYaml . | nindent 4 }} |
| 40 | + {{- end }} |
| 41 | + {{- with .Values.app.httproute.hostnames }} |
| 42 | + hostnames: |
| 43 | + {{- toYaml . | nindent 4 }} |
| 44 | + {{- end }} |
| 45 | + rules: |
| 46 | + {{- range .Values.app.httproute.rules }} |
| 47 | + - {{- with .matches }} |
| 48 | + matches: |
| 49 | + {{- toYaml . | nindent 8 }} |
| 50 | + {{- end }} |
| 51 | + {{- with .filters }} |
| 52 | + filters: |
| 53 | + {{- toYaml . | nindent 8 }} |
| 54 | + {{- end }} |
| 55 | + backendRefs: |
| 56 | + - name: {{ template "kong.fullname" (index $.Subcharts "kong") }}-proxy |
| 57 | + port: {{ $servicePort }} |
| 58 | + weight: 1 |
| 59 | + {{- end }} |
| 60 | +{{- end }} |
0 commit comments