<p>10 microservices on kubernetes with helm3 charts, and saw that all of them have similar structure standard, deployment, service, hpa, network policies etc. and basically the <code>&lt;helm_chart_name&gt;/templates</code> directory is 99% same on all with some <code>if</code> statements on top of file whether we want to deploy that resource,</p>
<pre class="lang-sh prettyprint-override"><code>{{ if .Values.hpa.create }}
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
  name: {{ .Values.deployment.name }}
...
spec:
  scaleTargetRef:
...
{{ end }}
</code></pre>
<p>and in values passing  yes/no whether we want it - Is there some tool to easily create template for the helm charts ? To create Helm chart with this 5 manifests pre-populated with the reference to values as above ?</p>

potatopotato
<p>What you need is the <a href="https://helm.sh/docs/topics/library_charts/" rel="noreferrer">Library Charts</a>:</p>
<blockquote>
<p>A library chart is a type of Helm chart that defines chart primitives
or definitions which can be shared by Helm templates in other charts.
This allows users to share snippets of code that can be re-used across
charts, avoiding repetition and keeping charts DRY.</p>
</blockquote>
<p>You can find more details and examples in the linked documentation.</p>
