skip to content
Alvin Lucillo

Helm function quote

/ 1 min read

💻 Tech

If you encounter the error below with your helm release deployment, it’s because the value from your values file is numeric or numeric value wrapped in double quotes (e.g., 27017 or "27017"). To force that value to be interpreted as string, use | quote just like in the example below.

Error: json: cannot unmarshal number into Go struct field EnvVar.spec.template.spec.containers.env.value of type string

containers:
  - name: app
    image: my-app
    ports:
      - containerPort: 80
    env:
      - name: MONGODB_HOST
        value: { { .Values.mongodb.host } }
      - name: MONGODB_PORT
        value: { { .Values.global.mongodb.port | quote } }