diff --git a/.github/workflows/helm-template-check.yml b/.github/workflows/helm-template-check.yml index b64314a..f1e6b86 100644 --- a/.github/workflows/helm-template-check.yml +++ b/.github/workflows/helm-template-check.yml @@ -67,6 +67,17 @@ jobs: > /tmp/listenerset.yaml grep -q '^kind: ListenerSet$' /tmp/listenerset.yaml grep -q 'kind: ListenerSet$' <(sed -n '/^kind: HTTPRoute$/,/^---/p' /tmp/listenerset.yaml) + # listenerSet without gateway.enabled must fail instead of rendering nothing + if helm template test ./charts/ai \ + --set-file ctaiPropertiesFile=./charts/ai/ctai-configuration.properties.template \ + --set service.fqdn=https://example.codetogether.io \ + --set imageCredentials.username=test \ + --set imageCredentials.password=test \ + --set gateway.listenerSet.enabled=true \ + --set gateway.listenerSet.parentRef.name=shared-gateway > /tmp/ls-no-gw.out 2>&1; then + echo "listenerSet without gateway.enabled rendered" >&2; exit 1 + fi + grep -q 'requires gateway.enabled=true' /tmp/ls-no-gw.out # helm upgrade --reuse-values from a chart without `gateway` drops the key helm template test ./charts/ai \ --set-file ctaiPropertiesFile=./charts/ai/ctai-configuration.properties.template \ diff --git a/charts/ai/README.md b/charts/ai/README.md index 8e9f820..92685be 100644 --- a/charts/ai/README.md +++ b/charts/ai/README.md @@ -299,7 +299,7 @@ The following table lists the primary configurable parameters and defaults. | `gateway.annotations` / `gateway.labels` | Extra `HTTPRoute` metadata (`labels` also go on the `ListenerSet`) | `{}` | | `gateway.nginxGatewayFabric.clientSettingsPolicy.enabled` | NGINX Gateway Fabric body-size policy: `auto`, `true` or `false` | `auto` | | `gateway.nginxGatewayFabric.clientSettingsPolicy.bodyMaxSize` | Request body limit on the Gateway | `16m` | -| `gateway.listenerSet.enabled` | Create a `ListenerSet` with this release's HTTPS listener; the `HTTPRoute` attaches to it when `gateway.parentRefs` is empty | `false` | +| `gateway.listenerSet.enabled` | Create a `ListenerSet` with this release's HTTPS listener; the `HTTPRoute` attaches to it when `gateway.parentRefs` is empty. Requires `gateway.enabled=true` | `false` | | `gateway.listenerSet.parentRef` | The shared Gateway (`name`, `namespace`); required when enabled | `{}` | | `gateway.listenerSet.listenerName` / `port` | Listener name (the route's `sectionName`) and port | `https` / `443` | | `gateway.listenerSet.tlsSecretName` | TLS Secret for the listener | `-tls` | diff --git a/charts/ai/templates/listenerset.yaml b/charts/ai/templates/listenerset.yaml index 8871f56..0c9b9c1 100644 --- a/charts/ai/templates/listenerset.yaml +++ b/charts/ai/templates/listenerset.yaml @@ -1,3 +1,7 @@ +{{- $gwValues := .Values.gateway | default dict }} +{{- if and ($gwValues.listenerSet | default dict).enabled (not $gwValues.enabled) }} +{{- fail "gateway.listenerSet.enabled=true requires gateway.enabled=true: the ListenerSet carries the HTTPRoute's listener, and without the HTTPRoute nothing is rendered." }} +{{- end }} {{- if eq (include "ctai.listenerSetEnabled" .) "true" }} {{- $ls := .Values.gateway.listenerSet }} {{- $parent := $ls.parentRef | default dict }}