helm yaml error - found unexpected ':'

8/7/2018

I have a Deployment that I'm writing in a helm template and am getting an error when including part of a command line:

command: ["/cloud_sql_proxy",
              printf "-instances=%s=tcp:0.0.0.0:3306" .Values.sqlproxy.instanceName,
              "-credential_file=/secrets/cloudsql/credentials.json"]

on linting the deployment (helm lint .) I get the following error:

error converting YAML to JSON: yaml: line 25: found unexpected ':'

If I remove the part of the command: =tcp:0.0.0.0:3306 the deployment lints fine but I need it :)

Is there a way of escaping the colons?

Or should I rewrite the command array?

I've uploaded the complete yaml to a gist: sqlproxy-deployment.yaml

-- GuyC
kubernetes
kubernetes-helm

1 Answer

8/7/2018

You need to wrap template directives in {{ }}

"{{ printf "-instances=%s=tcp:0.0.0.0:3306" .Values.sqlproxy.instanceName }}"
-- Marcin Romaszewicz
Source: StackOverflow