<p>I have a helm chart A which depends on a third-party subchart B.
Chart B defines some CRDs which are used by chart A.
However, when I install chart A (hence B too), I get an error saying that the CRDs are not recognized. It seems that the CRs are being stored before CRDs.</p>
<p>Helm documentation about <a href="https://helm.sh/docs/chart_best_practices/custom_resource_definitions/" rel="noreferrer">CRD</a>
describes two ways to handle this order, either put the CRDs in a folder called crds, or use two separate charts and install them one after the other.</p>
<p>My questions are the following:</p>
<ol>
<li>Why doesn't Helm apply first the CRDs regardless of where they are? Why is the crds folder needed? What if the CRDs are in a chart that you don't wish to modify (like in my case)?</li>
<li>Doesn't the second option make the dependencies specification useless. Can't there be an order of execution for dependencies?</li>
<li>Is there a way, that I might have overlooked, to still keep 1 chart with a dependency and somehow make sure that the CRDs defined in the dependency are stored before being used? (hooks?)</li>
</ol>
<p>(you don't have to answer all the questions, an answer to any of them is appreciated)</p>

<p>There's a pretty simple way to let your main chart install the objects defined by your dependency chart's CRDs. Just make them installed and upgraded with the <code>post-install</code> and <code>post-upgrade</code> hooks.</p>
<p>Just a simple example for you. Let's imagine, you need to install a cert-manager as a subchart and then your main chart needs to install an <code>Issuer</code>. Obviously, the initial installation fails, as the CRDs aren't installed yet, so the <code>Issuer</code> doesn't pass validation. But if you use the hook (by adding the following annotation to the template of your <code>Issuer</code>: <code>&quot;helm.sh/hook&quot;: post-install,post-upgrade</code>), then the <code>Issuer</code> will be installed only in the very end of the installation procedure, when cert-manager is up and kicking.</p>
