<p>I am trying to mount a Kubernetes <code>configmap</code> for VMWare's Fluentd operator [<a href="https://github.com/vmware/kube-fluentd-operator" rel="nofollow noreferrer">1</a>]. I've checked the documentation and the helm chart indicates that you have to specify an additional volume as a parameter called <code>fluentd.extraVolumeMounts</code></p>
<p>The helm chart I'm using to install the operator is below :</p>
<pre><code>
#!/bin/sh
# helmenv set to helm3

CHART_URL='https://github.com/vmware/kube-fluentd-operator/releases/download/v1.12.0/log-router-0.3.3.tgz'

# Set environment variables.
REGION='us-east-1'
CLUSTER='dev'
ENV='dev'
IMAGE_TAG='v1.12.0'

VOLUME_MOUNT=&quot;
- name: fluentd-es-templates
  mountPath: /templates&quot;

EXTRA_VOLUME=&quot;
- name: fluentd-es-templates
  configMap:
    name: fluentd-es-templates&quot;

# Install the fluentd operator in kube-system.
# helm install kfo ${CHART_URL} \
helm upgrade --install kfo ${CHART_URL} \
  --set meta.key=metadata \
  --set meta.values.region=${REGION} \
  --set meta.values.env=${ENV} \
  --set meta.values.cluster=${CLUSTER} \
  --set rbac.create=true \
  --set image.tag=${IMAGE_TAG} \
  --set image.repository=vmware/kube-fluentd-operator \
# --set fluentd.extraVolumeMounts=[$EXTRA_VOLUME]
# --set extraVolumes=[${EXTRA_VOLUME}]
</code></pre>
<p>When I un-comment the lines that set the volumes, the helm script fails. My question is, how do I populate the <code>VOLUME_MOUNT</code> and <code>EXTRA_VOLUME</code> variables with the correct json or yaml?
I'm trying to do everything in one file and don't want to split things into multiple files.</p>

<p>You can still use a values file from within the shell script via process substitution. Here is an example:</p>
<pre><code>#!/usr/bin/env bash
CHART_URL='https://github.com/vmware/kube-fluentd-operator/releases/download/v1.12.0/log-router-0.3.3.tgz'

read -r -d '' values &lt;&lt; EOF
meta:
  key: metadata
  values:
    region: &quot;us-east-1&quot;
    env: &quot;dev&quot;
    cluster: &quot;dev&quot;
rbac:
  create: true
image:
  repository: vmware/kube-fluentd-operator
  tag: &quot;v1.12.0&quot;
fluentd:
  extraVolumeMounts:
    - name: fluentd-es-templates
      mountPath: /fluentd/etc/mappings
extraVolumes:
  - name: fluentd-es-templates
    configMap:
      name: fluentd-es-templates
EOF

helm upgrade --install kfo &quot;$CHART_URL&quot; -f &lt;(printf '%s' &quot;$values&quot;)
</code></pre>
<p>Under the hood this creates a named pipe and passes a file descriptor such as <code>/dev/fd/123</code> to the helm install command. This feature is not available in some shells, such as dash (<code>/bin/sh</code> in Debian and Ubuntu).</p>
