fix: httpRoute template file

This commit is contained in:
Tom Zaspel
2026-02-18 06:48:01 +01:00
parent b42d991157
commit 1c7cc36472
2 changed files with 21 additions and 37 deletions

View File

@@ -1,18 +1,8 @@
{{- if .Values.httpRoute.enabled -}}
{{- $fullName := include "chart.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- $defaultGatewayName := .Values.gateway.name -}}
{{- if not $defaultGatewayName -}}
{{- $defaultGatewayName = printf "%s-gateway" $fullName -}}
{{- end -}}
{{- $defaultGatewayNs := .Release.Namespace -}}
{{- if .Values.gateway.enabled -}}
{{- $defaultGatewayNs = default .Release.Namespace .Values.gateway.namespace -}}
{{- end -}}
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: {{ $fullName }}
name: {{ include "chart.fullname" . }}
labels:
{{- include "chart.labels" . | nindent 4 }}
{{- with .Values.httpRoute.annotations }}
@@ -23,14 +13,9 @@ spec:
parentRefs:
{{- if .Values.httpRoute.parentRefs }}
{{- range $ref := .Values.httpRoute.parentRefs }}
- name: {{ default $defaultGatewayName $ref.name | quote }}
{{- $refNs := $ref.namespace | default $defaultGatewayNs -}}
namespace: {{ $refNs | quote }}
{{- with $ref.sectionName }}
sectionName: {{ . | quote }}
{{- else }}
sectionName: "http"
{{- end }}
- name: {{ $.Values.gateway.name | default $ref.name | quote }}
namespace: {{ $ref.namespace | default (default .Release.Namespace .Values.gateway.namespace) | quote }}
sectionName: {{ $ref.sectionName | default "http" | quote }}
{{- with $ref.kind }}
kind: {{ . | quote }}
{{- end }}
@@ -40,8 +25,8 @@ spec:
{{- end }}
{{- else }}
# Default parentRef when parentRefs is empty or not set
- name: {{ $defaultGatewayName | quote }}
namespace: {{ $defaultGatewayNs | quote }}
- name: {{ .Values.gateway.name | default (printf "%s-gateway" (include "chart.fullName" .)) | quote }}
namespace: {{ default .Release.Namespace .Values.gateway.namespace | quote }}
sectionName: "http"
{{- end }}
{{- with .Values.httpRoute.hostnames }}
@@ -59,8 +44,8 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
backendRefs:
- name: {{ $fullName }}
port: {{ $svcPort }}
- name: {{ include "chart.fullname" }}
port: {{ $.Values.service.port }}
weight: 1
{{- end }}
{{- end }}

View File

@@ -5,11 +5,11 @@ image:
# Image built from this repo's `Dockerfile` (nginx serving static frontend).
repository: ghcr.io/alam00000/bentopdf-simple
pullPolicy: IfNotPresent
tag: ""
tag: ''
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
nameOverride: ''
fullnameOverride: ''
podAnnotations: {}
podLabels: {}
@@ -25,7 +25,7 @@ env: []
ingress:
enabled: false
className: ""
className: ''
annotations: {}
hosts:
- host: bentopdf.local
@@ -37,10 +37,10 @@ ingress:
# Gateway API (optional)
gateway:
enabled: false
name: "" # default: release fullname + "-gateway" suffix
namespace: "" # to override the namespace
name: '' # default: release fullname + "-gateway" suffix
namespace: '' # to override the namespace
annotations: {}
gatewayClassName: "" # required when enabled=true
gatewayClassName: '' # required when enabled=true
listeners:
- name: http
protocol: HTTP
@@ -50,14 +50,13 @@ gateway:
from: Same # Allow routes from the same namespace
httpRoute:
enabled: false
annotations: {}
# parentRefs: # Omit entirely to use default (auto-references gateway in same namespace)
# - name: "" # default: gateway.name or {release-name}-gateway
# namespace: "" # to override the namespace
# sectionName: "http"
enabled: true
parentRefs:
- name: existing-gateway
namespace: gateway-namespace
sectionName: http
hostnames:
- bentopdf.local
- pdfs.example.com
rules:
- matches:
- path: