<p>I want to intercept the helm YAML and customize it using a Python script, and then install it. I have been doing something like <code>helm template | python3 script... | kubectl apply -f -</code> but of course this doesn't create a helm release in my cluster, so I lose out on <code>helm rollback</code> etc.</p>
<p>I have considered using Kustomize but it doesn't have the features that I'd like.</p>
<p>Is there a way to take pre-generated YAML, like that from <code>helm template</code> or <code>helm install --dry-run</code> and then install/upgrade that <strong>using</strong> helm?</p>

<p>Isn't that what post-renderers are for?</p>
<p>See <a href="https://helm.sh/docs/topics/advanced/#post-rendering" rel="nofollow noreferrer">https://helm.sh/docs/topics/advanced/#post-rendering</a></p>
<blockquote>
<p>A post-renderer can be any executable that accepts rendered Kubernetes manifests on STDIN and returns valid Kubernetes manifests on STDOUT. It should return an non-0 exit code in the event of a failure. This is the only &quot;API&quot; between the two components. It allows for great flexibility in what you can do with your post-render process.</p>
<p>A post renderer can be used with install, upgrade, and template. To use a post-renderer, use the --post-renderer flag with a path to the renderer executable you wish to use:</p>
<p><code>$ helm install mychart stable/wordpress --post-renderer ./path/to/executable</code></p>
</blockquote>
<p>I haven't used it myself yet, but it looks interesting if you want to run your own alternative kustomize.</p>
<p>See <a href="https://github.com/vmware-tanzu/carvel-ytt/tree/develop/examples/helm-ytt-post-renderer" rel="nofollow noreferrer">https://github.com/vmware-tanzu/carvel-ytt/tree/develop/examples/helm-ytt-post-renderer</a> for an example that is not kustomize.</p>
