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

View File

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