arttor / helmify

Creates Helm chart from Kubernetes yaml
MIT License
1.48k stars 136 forks source link

always use quotes for env values #88

Closed imilchev closed 1 year ago

imilchev commented 1 year ago

With the new structure for specifying env vars in the template we are experiencing issues. We have a deployment with env var that is either a bool or a number. So normally we specify it as:

env:
- name: TEST
   value: "1"

When that passes through helmify we get a template that looks like this:

env:
        - name: TEST
          value: {{ .Values.controllerManager.manager.env.test
            }}

When the template is parsed, the value "1" gets replace but then the resulting yaml is:

env:
- name: TEST
   value: 1

This is invalid and is rejected by Kubernetes since the env value must always be a string. The same issue would occur if the env value is a boolean.

This PR is an attempt to fix the problem. I already tested that this approach fixes our issue but feel free to adjust it if needed

arttor commented 1 year ago

@imilchev thank you! Your changes are available in v0.3.29 release