UNCLASSIFIED - NO CUI

Skip to content

Helm template fails on special chars in gitlab database password

Helm template can fail if "invalid" characters are included in the addons.gitlab.database.password field. This could be resolved by updating chart/tempaltes/gitlab/secret-database.yaml to apply quotes to the field.

Steps to reproduce:

  • Create tmp_values.yaml:
addons:
  gitlab:
    enabled: true
    database:
      host: something
      password: 'working'
      # password: '}broken'
  • From the bigbang repo directory, run helm template .chart -f <path to tmp_values.yaml>
  • Add a closing brace (}) to the password (there are likely other chars that exhibit this behavior, but this is enough for an example)
  • Rerun the template command and observe the template error:
Error: YAML parse error on bigbang/templates/gitlab/secret-database.yaml: error converting YAML to JSON: yaml: line 7: did not find expected node content

Suggested solution: Update the secret-database secret template in the gitlab templates with a quote function:

stringData:
    PGPASSWORD: {{ .Values.addons.gitlab.database.password | quote }}
Edited by Andrew Blanchard