<p>I am trying to pass a toleration when deploying to a chart located in stable. The toleration should be applied to a specific YAML file in the templates directory, NOT the values.yaml file as it is doing by default.</p>

<p>I've applied using patch and I can see that the change I need would work if it were applied to the right Service, which is a DaemonSet.</p>

<p>Currently I'm trying "helm install -f tolerations.yaml --name release_here"</p>

<p>This is simply creating a one-off entry when running get chart release_here, and is not in the correct service YAML</p>

<p>Quoting your requirement </p>

<blockquote>
  <p>The toleration should be applied to a specific YAML file in the
  templates directory</p>
</blockquote>

<p>First, in order to make it happen your particular helm chart file needs to allow such an end-user customization.</p>

<p>Here is the example based on <a href="https://github.com/helm/charts/tree/9eadc46ed1d9b17d1e67d06c2516dddc3fdde2d3/stable/kiam" rel="nofollow noreferrer">stable/kiam</a> chart:</p>

<p>Definition of <a href="https://raw.githubusercontent.com/helm/charts/9eadc46ed1d9b17d1e67d06c2516dddc3fdde2d3/stable/kiam/templates/server-daemonset.yaml" rel="nofollow noreferrer">kiam/templates/server-daemonset.yaml</a></p>

<pre><code>{{- if .Values.server.enabled -}}
apiVersion: apps/v1beta2
kind: DaemonSet
metadata:
  labels:
    app: {{ template "kiam.name" . }}
    chart: {{ template "kiam.chart" . }}
    component: "{{ .Values.server.name }}"
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
  name: {{ template "kiam.fullname" . }}-server
spec:
  selector:
    matchLabels:
      app: {{ template "kiam.name" . }}
      component: "{{ .Values.server.name }}"
      release: {{ .Release.Name }}
  template:
    metadata:
      {{- if .Values.server.podAnnotations }}
      annotations:
{{ toYaml .Values.server.podAnnotations | indent 8 }}
      {{- end }}
      labels:
        app: {{ template "kiam.name" . }}
        component: "{{ .Values.server.name }}"
        release: {{ .Release.Name }}
      {{- if .Values.server.podLabels }}
{{ toYaml .Values.server.podLabels | indent 8 }}
      {{- end }}
    spec:
      serviceAccountName: {{ template "kiam.serviceAccountName.server" . }}
      hostNetwork: {{ .Values.server.useHostNetwork }}
    {{- if .Values.server.nodeSelector }}
      nodeSelector:
{{ toYaml .Values.server.nodeSelector | indent 8 }}
    {{- end }}
      tolerations:    &lt;---- TOLERATIONS ! 
{{ toYaml .Values.server.tolerations | indent 8 }}
      {{- if .Values.server.affinity }}
      affinity:
{{ toYaml .Values.server.affinity | indent 10 }}
      {{- end }}
      volumes:
        - name: tls
</code></pre>

<p>Override default <code>values.yaml</code> with your <code>customs-values</code> to set toleration in Pod spec of DeamonSet.</p>

<pre><code>server:
  enabled: true
  tolerations: ## Agent container resources
    affinity:
      nodeAffinity:
        requiredDuringSchedulingIgnoredDuringExecution:
          nodeSelectorTerms:
            - matchExpressions:
                - key: foo.bar.com/role
                  operator: In
                  values:
                    - master 
</code></pre>

<p>Render the resulting manifest file, to see how it would look like when overriding default values with install/upgrade helm command using --values/--set argument:</p>

<pre><code>helm template --name my-release . -x templates/server-daemonset.yaml --values custom-values.yaml
</code></pre>

<p>Rendered file (output truncated):</p>

<pre><code>---
# Source: kiam/templates/server-daemonset.yaml
apiVersion: apps/v1beta2
kind: DaemonSet
metadata:
  labels:
    app: kiam
    chart: kiam-2.5.1
    component: "server"
    heritage: Tiller
    release: my-release
  name: my-release-kiam-server
spec:
  selector:
    matchLabels:
      app: kiam
      component: "server"
      release: my-release
  template:
    metadata:
      labels:
        app: kiam
        component: "server"
        release: my-release
    spec:
      serviceAccountName: my-release-kiam-server
      hostNetwork: false
      tolerations:
        affinity:
          nodeAffinity:
            requiredDuringSchedulingIgnoredDuringExecution:
              nodeSelectorTerms:
              - matchExpressions:
                - key: foo.bar.com/role
                  operator: In
                  values:
                  - master

      volumes:
        ...  
</code></pre>

<p>I hope this will help you to solve your problem.</p>
