Skip to content

Commit b8c6478

Browse files
Copilotandibeuge
andauthored
fix: add validation to prevent invalid ReferenceGrant resources (#418)
* Initial plan * fix: add validation to ReferenceGrant template to prevent invalid resources Co-authored-by: andibeuge <97287249+andibeuge@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: andibeuge <97287249+andibeuge@users.noreply.github.com>
1 parent 4fc9a11 commit b8c6478

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

parcellab/common/templates/_referencegrant.tpl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
{{- $gateway := $envoy.gateway | default dict -}}
1515
{{- $name := include "common.fullname" . }}
1616
{{- $serviceNamespace := .Release.Namespace }}
17-
{{- if $envoy.enabled -}}
17+
{{- $from := $referenceGrant.from | default list -}}
18+
{{- $to := $referenceGrant.to | default list -}}
19+
{{- if and $envoy.enabled (gt (len $from) 0) (gt (len $to) 0) -}}
1820
---
1921
apiVersion: gateway.networking.k8s.io/v1beta1
2022
kind: ReferenceGrant
@@ -29,7 +31,7 @@ metadata:
2931
{{- end }}
3032
spec:
3133
from:
32-
{{- range $referenceGrant.from }}
34+
{{- range $from }}
3335
- group: {{ .group | default "gateway.networking.k8s.io" | quote }}
3436
kind: {{ required "referenceGrant.from.kind is required" .kind | quote }}
3537
namespace: {{ $serviceNamespace | quote }}
@@ -38,7 +40,7 @@ spec:
3840
{{- end }}
3941
{{- end }}
4042
to:
41-
{{- range $referenceGrant.to }}
43+
{{- range $to }}
4244
- group: {{ .group | default "" | quote }}
4345
kind: {{ required "referenceGrant.to.kind is required" .kind | quote }}
4446
{{- with .name }}

0 commit comments

Comments
 (0)