Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Helm upgrade fails with error: expects " or n, but found t

I'm trying to add a new pod to my helm chart, it passes validation (helm lint) but fails at last stage of deployment:

Mon Dec 16 10:01:58 2019 INFO Running helm install/upgrade for xyz-stg
UPGRADE FAILED Error: "" is invalid: patch: Invalid value: "{\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"metadata\"
(...)
ReadString: expects " or n, but found t, error found in #10 byte of ...|,"value":true},{"nam|..., bigger context ...|"value":"stg"}, (...)
Error: UPGRADE FAILED: "" is invalid: patch: Invalid value: "{\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"metadata\": (...)
ReadString: expects " or n, but found t, error found in #10 byte of ...|,"value":true},{"nam|..., bigger context ...|"value":"stg"}, (...) Mon Dec 16 10:02:09 2019 ERROR Upgrade/Installation of xyz-stg failed

I have no idea what this error means or how to even debug it. It sounds like some syntax indentation error, but all I did was: copy-pasted the pod configuration from other working pod and changed all names.

like image 810
van_folmert Avatar asked Dec 16 '19 09:12

van_folmert


People also ask

What happens with Helm upgrade?

This command upgrades a release to a new version of a chart. The upgrade arguments must be a release and chart. The chart argument can be either: a chart reference('example/mariadb'), a path to a chart directory, a packaged chart, or a fully qualified URL.

Does Helm upgrade install?

Unchecked deployment There are two ways to install Helm charts using the Helm CLI: helm install and helm upgrade --install . The install sub-command always installs a brand new chart, while the upgrade sub-command can upgrade an existing chart and install a new one, if the chart hasn't been installed before.

Is Kubectl required for Helm?

You must have Kubernetes installed. For the latest release of Helm, we recommend the latest stable release of Kubernetes, which in most cases is the second-latest minor release. You should also have a local configured copy of kubectl .


2 Answers

I ran into a similar problem and apparently it turns out Kubernetes's Pod specification requires environment variable values to be coerced as strings, so integers need to be passed through quote.So, in your deployment.yaml file wherever you are using the numeric values try to pass them as below.

value: {{ .Values.environment.TEMP | quote}}

It will work just fine after that. Hope it helps

like image 147
Mohammad Faraz Avatar answered Sep 17 '22 16:09

Mohammad Faraz


Add double quotes and update the deployment.yaml with following changes

In deployment.yaml file

        value: {{ .Values.environment.TEMP }}
        value: {{ quote .Values.environment.TEMP }}

In Values.yaml file

Envrionment:
  TEMP: "true"
like image 35
vikas ray Avatar answered Sep 20 '22 16:09

vikas ray