fix(gateway): give the remedy for an unserved class

A tenant that chose the unserved class itself cannot fix the render by
asking the operator to change the platform default: its own choice
wins. Tell it to change or clear tenant.spec.gatewayClass instead.

Assisted-by: LLM
Signed-off-by: Timofei Larkin <lllamnyp@gmail.com>
This commit is contained in:
Timofei Larkin committed 2026-11-20 00:32:01 +01:00
1 parent 7375196b8b
commit 6da59b7ed0
2 files changed
+7 -3

No files matched your search

@@ -38,7 +38,11 @@
the class or inherited the platform default. */}}
{{- range splitList "," ((index .Values._cluster "gateway-unserved-classes") | default "") }}
{{- if eq (trim .) $className }}
{{- fail (printf "packages/extra/gateway: GatewayClass %q has no controller on this cluster, so this Gateway would never be programmed. Set tenant.spec.gatewayClass to a class the operator lists in gateway.tenantSelectableClasses, or have the operator set gateway.className to a served class." $className) }}
{{- $remedy := "Set tenant.spec.gatewayClass to a served class the operator lists in gateway.tenantSelectableClasses, or have the operator set gateway.className to a served class." }}
{{- if trim $rawClassName }}
{{- $remedy = "Change tenant.spec.gatewayClass to a served class the operator lists in gateway.tenantSelectableClasses, or clear it to take the platform default if that class is served." }}
{{- end }}
{{- fail (printf "packages/extra/gateway: GatewayClass %q has no controller on this cluster, so this Gateway would never be programmed. %s" $className $remedy) }}
{{- end }}
{{- end }}
{{- $edgeClasses := list }}
@@ -23,7 +23,7 @@ tests:
host: alice.example.org
asserts:
- failedTemplate:
errorPattern: 'GatewayClass "cilium" has no controller on this cluster'
errorPattern: 'GatewayClass "cilium" has no controller on this cluster.*have the operator set gateway.className'
- it: refuses a tenant-chosen class nothing serves
set:
@@ -39,7 +39,7 @@ tests:
gatewayClassName: cilium
asserts:
- failedTemplate:
errorPattern: 'GatewayClass "cilium" has no controller on this cluster'
errorPattern: 'GatewayClass "cilium" has no controller on this cluster.*Change tenant.spec.gatewayClass .* or clear it'
- it: lets a tenant select a served class while the default is unserved
set: