Error: YAML parse error - error converting YAML to JSON: yaml: control characters are not allowed

4/17/2020

I am using PostgreSQL helm chart and facing an issue while adding an init.sql script in the /charts/postgresql/files/docker-entrypoint-initdb.d and running helm install and I am getting the following issue -

Error: YAML parse error on iriusrisk/charts/postgresql/templates/._metrics-configmap.yaml: error converting YAML to JSON: yaml: control characters are not allowed

I believe it has more to do with some issue introduced by Mac I am currently using MacOS Mojave Version - 10.14.6

I have uploaded the files here https://github.com/prav10194/helm-chart and the https://github.com/prav10194/helm-chart/blob/master/charts/postgresql-8.6.16.tgz is the one with the sql script and https://github.com/prav10194/helm-chart/blob/master/charts/postgresql-8.6.12.tgz is without the sql script.

Running it on minikube version: v1.6.2

Helm version:

version.BuildInfo{Version:"`v3.0.2`", GitCommit:"19e47ee3283ae98139d98460de796c1be1e3975f", GitTreeState:"clean", GoVersion:"go1.13.5"}
-- Pranav Bhatia
helmfile
kubernetes
kubernetes-helm
postgresql

1 Answer

4/18/2020

Your error doesn't seem to have much to do with Mac. While it's not informative, it looks like the problem is that Helm can't find the chart version 8.1.16: it doesn't exist in Bitnami repo and the version is not updated in your local Chart.yaml. Here's what I did to replicate it:

  1. Cloned the repo.
  2. Changed the version in requirements.yaml from * to 8.6.16.
  3. Ran helm install . --generate-name

Got this error:

Error: YAML parse error on iriusrisk/charts/postgresql/templates/.__helpers.tpl: error converting YAML to JSON: yaml: control characters are not allowed

If your error has the same origins, here's what you can do to fix it (provided you start from a clean clone of your repo):

  1. Delete the archive for 8.6.12.
  2. Unpack the archive for 8.6.16 and delete it as well. You will now have charts/postgresql directory.
  3. Go to charts/postgresql/Chart.yaml and update the version there to 8.6.16.
  4. Go to requirements.yaml and change the version to 8.6.16. You can also remove/comment the repository line as you're using the local chart.
  5. Delete requirements.lock.
  6. Run helm install . <your name or --generate-name>

You should now have 8.6.16 installed in your minikube cluster.

Tested using minikube 1.9.0 on macOS 10.15.4 (19E266) with Helm 3.1.2.

-- unclenorton
Source: StackOverflow