<p><strong>Version of Helm and Kubernetes: Client:</strong> &amp;version.Version{SemVer:"v2.14.1" and 1.13.7-gke.24</p>

<p><strong>Which chart:</strong> stable/nginx-ingress [v0.24.1]</p>

<p><strong>What happened:</strong> Trying to override headers using--set-string but it does not work as expected. It always gives issues with the parsing</p>

<p><code>/usr/sbin/helm install --name cx-nginx-1 --set controller.name=cx-nginx-1 --set controller.kind=Deployment --set controller.service.loadBalancerIP= --set controller.metrics.enabled=true --set-string 'controller.headers={"X-Different-Name":"true","X-Request-Start":"test-header","X-Using-Nginx-Controller":"true"}' . Error: release cx-nginx-1 failed: ConfigMap in version "v1" cannot be handled as a ConfigMap: v1.ConfigMap.Data: ReadMapCB: expect { or n, but found [, error found in #10 byte of ...|","data":["\"X-Diffe|..., bigger context ...|{"apiVersion":"v1","data":["\"X-Different-Name\":\"true\"","\"X-Request-Start|...</code></p>

<p><strong>What you expected to happen:</strong> I want to override the header which the there by default in values.yam with custom headers</p>

<p><strong>How to reproduce it (as minimally and precisely as possible):</strong>
I have provided the comment to reproduce,
<code>helm install --name cx-nginx-1 --set controller.name=cx-nginx-1 --set controller.kind=Deployment --set controller.service.loadBalancerIP= --set controller.metrics.enabled=true --set-string 'controller.headers={"X-Different-Name":"true","X-Request-Start":"test-header","X-Using-Nginx-Controller":"true"}' .</code></p>

<p>I tried to run in debug mode (--dry-run --debug), It shows me configmap like below,</p>

<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  labels:
    app: nginx-ingress
    chart: nginx-ingress-1
    component: "cx-nginx-1"
    heritage: Tiller
    release: foiled-coral
  name: foiled-coral-nginx-ingress-custom-headers
  namespace: cx-ingress
data:
  - X-Different-Name:true
  - X-Request-Start:test-header
  - X-Using-Nginx-Controller:true
</code></pre>

<p>It seems like its adding intent 4 instead of intent 2. Below warning also i'm getting,
<code>Warning: Merging destination map for chart 'nginx-ingress'. Cannot overwrite table item 'headers', with non table value: map[X-Different-Name:true X-Request-Start:test-header X-Using-Nginx-Controller:true]</code></p>

<p>Kindly help me to pass the headers in the right way.</p>

Dinesh SC
<p><em>Note: <a href="https://github.com/helm/charts/tree/master/stable/nginx-ingress#configuration" rel="nofollow noreferrer"><code>controller.headers</code></a>    is deprecated, make sure to use the <code>controller.proxySetHeaders</code> instead.</em></p>

<hr>

<p>Helm <code>--set</code> has some <a href="https://helm.sh/docs/using_helm/#the-format-and-limitations-of-set" rel="nofollow noreferrer">limitations</a>.</p>

<p>Your best option is to avoid using the <code>--set</code>, and use the <code>--values</code> instead.</p>

<p>You can declare all your custom values in a file like this:</p>

<pre><code># values.yaml
controller:
  name: "cx-nginx-1"
  kind: "Deployment"
  service:
    loadBalancerIP: ""
  metrics:
    enable: true
  proxySetHeaders:
    X-Different-Name: "true"
    X-Request-Start: "true"
    X-Using-Nginx-Controller: "true"
</code></pre>

<p>Then use it on install:</p>

<pre><code>helm install --name cx-nginx-1 stable/nginx-ingress \
--values=values.yaml
</code></pre>

<hr>

<p>If you want to use <code>--set</code> anyway, you should use this notation:</p>

<pre><code>helm install --name cx-nginx-1 stable/nginx-ingress \
--set controller.name=cx-nginx-1 \
--set controller.kind=Deployment \
--set controller.service.loadBalancerIP= \
--set controller.metrics.enabled=true \
--set-string controller.proxySetHeaders.X-Different-Name="true" \
--set-string controller.proxySetHeaders.X-Request-Start="true" \
--set-string controller.proxySetHeaders.X-Using-Nginx-Controller="true" 
</code></pre>
