<p>I am using an existing helm chart repo
<a href="https://github.com/kubecost/cost-analyzer-helm-chart" rel="nofollow noreferrer">https://github.com/kubecost/cost-analyzer-helm-chart</a></p>
<p>For deployment I am using custom helm chart, have created tgz of the repo and put it under my own charts/ directory and then i put my own certain templates which deploys some resources related to cost-analyzer.</p>
<p>I want to assign some custom labels to the resources which are coming from that tgz.</p>
<p>Is there something/someway that i can add custom labels to all the resources which are deployed using my custom helm chart including the resource which are from tgz.</p>

Keyur Barapatre
<p>There is nothing built into Helm for doing that.</p>
<p>You can set the <code>additionalLabels</code> field in their Helm chart <a href="https://github.com/kubecost/cost-analyzer-helm-chart/blob/643f3fa401c54aeb44aef375c52b0d77d5d91fcc/cost-analyzer/values.yaml#L135" rel="nofollow noreferrer">values.yaml</a> file (there are multiple places this needs to be done).</p>
<p>A potential kludge could be to pull the manifests after deploying, get the name and type of every resource, and pump that into a kubectl command to label everything, for example:</p>
<pre><code>HELM_RELEASE=&quot;???&quot;
NAMESPACE=&quot;???&quot;
LABEL=&quot;???&quot;
helm get manifest $HELM_RELEASE -n $NAMESPACE \
  | kubectl get -n $NAMESPACE -f - \
  | grep -vE '^$|^NAME' \
  | cut -d' ' -f1 \
  | xargs -I {} kubectl label -n $NAMESPACE {} $LABEL 
</code></pre>
