Skip to content

Commit 49ba0c8

Browse files
committed
Validate HTTPRoute parent references
1 parent a5e4997 commit 49ba0c8

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

helm-chart/templates/httproute.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
{{- $svcPortWeb := .Values.web.service.port -}}
88
{{- $svcPortOnboarding := .Values.onboarding.service.port -}}
99
{{- $onboardingEnabled := .Values.onboarding.enabled -}}
10+
{{- $parentRefs := .Values.httpRoute.parentRefs -}}
11+
{{- if or (not $parentRefs) (eq (len $parentRefs) 0) -}}
12+
{{- fail "httpRoute.parentRefs must contain at least one Gateway reference when httpRoute.enabled=true" -}}
13+
{{- end -}}
1014
apiVersion: gateway.networking.k8s.io/v1
1115
kind: HTTPRoute
1216
metadata:
@@ -19,8 +23,8 @@ metadata:
1923
{{- end }}
2024
spec:
2125
parentRefs:
22-
{{- range .Values.httpRoute.parentRefs }}
23-
- name: {{ .name | quote }}
26+
{{- range $parentRefs }}
27+
- name: {{ required "httpRoute.parentRefs[].name is required when httpRoute.enabled=true" .name | quote }}
2428
{{- with .namespace }}
2529
namespace: {{ . | quote }}
2630
{{- end }}

0 commit comments

Comments
 (0)