<p>I'm reading helm documentation,</p>
<blockquote>
<p>The templates/ directory is for template files. When Tiller evaluates a chart, it will send all of the files in the templates/ directory through the template rendering engine. Tiller then collects the results of those templates and sends them on to Kubernetes.</p>
</blockquote>
<p>I have lots of different templates in my template folder, I'm looking for a way to skip those templates that start with &quot;y&quot; and &quot;z&quot; and don't send it to Kubernetes, is there any way I can achieve that? I want to be flexible let's say if statementProvider is x, skip all manifests starting with y and z and do not send it to Kubernetes.</p>
<p>I wrote this helper function to extract the list of resources that should be deployed in Kubernetes but I don't know how I can use it:</p>
<pre><code>{{- define &quot;statement.resource&quot;}}
{{- $statementProvider := lower ( $.Values.statementProvider ) -}}
{{- $statementFiles := list -}}
{{- range $path, $bytes := .Files.Glob &quot;templates/**&quot; }}
    {{- if eq $statementProvider &quot;x&quot; -}}
        {{- if not (or (hasPrefix $path &quot;y&quot;) (hasPrefix $path &quot;z&quot;)) -}}
        {{- $statementFiles = append $statementFiles $path -}}
        {{- end }}
        {{- $statementFiles -}}
    {{- end }}

{{- end }}
{{- end }}
</code></pre>

someone
<p>It can be done with simple <code>if</code> statement.</p>
<p>Your <code>template</code> file</p>
<pre><code>{{- if .Values.serviceAccount.enabled -}}
...
{{- end }}
</code></pre>
<p>Your <code>values</code> file</p>
<pre><code>serviceAccount:
  enabled: true/false
</code></pre>
<p>You also can do the same for resources that are nested and conditional add <code>volumet</code> to your <code>deployment</code>.</p>
