Skip to content

Conversation

benbz
Copy link
Member

@benbz benbz commented May 28, 2025

If we have values that are passed to tpl but are absent we get appalling errors, even if other templates require them. Add a blank template that is evaluated first that collects basic validation errors and if any are present fails prior to tpl being called.

Before:

$ helm template ess charts/matrix-stack

Error: template: matrix-stack/templates/well-known/ingress.yaml:18:4: executing "matrix-stack/templates/well-known/ingress.yaml" at <include "element-io.ess-library.ingress.tls" (dict "root" $ "context" (dict "host" $.Values.serverName "ingress" .ingress "ingressName" "well-known"))>: error calling include: template: matrix-stack/templates/ess-library/_ingress.tpl:42:10: executing "element-io.ess-library.ingress.tls" at <include "element-io.ess-library.ingress.tlsHostsSecret" (dict "root" $root "context" (dict "hosts" (list $host) "tlsSecret" $ingress.tlsSecret "ingressName" $ingressName))>: error calling include: template: matrix-stack/templates/ess-library/_ingress.tpl:57:12: executing "element-io.ess-library.ingress.tlsHostsSecret" at <$host>: wrong type for value; expected string; got interface {}

Use --debug flag to render out invalid YAML

After:
$ helm template ess charts/matrix-stack

Error: execution error at (matrix-stack/templates/z_validation/validation.txt:40:3):

  • elementWeb.ingress.host is required when elementWeb.enabled=true
  • matrixAuthenticationService.ingress.host is required when matrixAuthenticationService.enabled=true
  • matrixRTC.ingress.host is required when matrixRTC.enabled=true
  • synapse.ingress.host is required when synapse.enabled=true
  • serverName is required when synapse.enabled=true
  • serverName is required when wellKnownDelegation.enabled=true

Use --debug flag to render out invalid YAML

@benbz benbz requested a review from a team as a code owner May 28, 2025 14:28
Copy link

dyff of changes in rendered templates of CI manifests

No changes in rendered templates

@benbz benbz force-pushed the bbz/validation-messages branch from a03132a to 60ce0b3 Compare May 28, 2025 14:33
@benbz benbz merged commit 04a7cc6 into main May 29, 2025
56 checks passed
@benbz benbz deleted the bbz/validation-messages branch May 29, 2025 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants