-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
helm.v4.Chart: hook support #3284
Comments
I think the issue is that hook resources have special lifecycle/ordering requirements. Basically would they work as expected? |
Yep, I have multiple charts that stopped working when moving from v3 to v4:
The issue I have with just removing the hooks is that I can't get the templated yaml out of pulumi. export const ignoreResourcesHelmTransformation = (...resources: string[]) => {
const stack = pulumi.getStack();
return (o: any, opts: pulumi.CustomResourceOptions) => {
const resourceName = `${o.apiVersion}:${o.kind}:${o.metadata?.namespace || ""}:${o.metadata?.name || ""}`;
if (resources.includes(resourceName)) {
console.log(`Skip: ${resourceName}`);
const dir = `../ignored-resources-${stack}`;
if (!fsSync.existsSync(dir)) {
fsSync.mkdirSync(dir);
}
fsSync.writeFileSync(
`${dir}/${resourceName.replaceAll("/", "-")}.yaml`,
yaml.dump(o)
);
for (const key of Object.keys(o)) {
delete o[key];
}
o.apiVersion = "v1";
o.kind = "List";
o.items = [];
}
};
}; |
(here's an outline of the technical challenge) The Helm documentation outlines the various hook behaviors that Pulumi would be expected to emulate: In v3, Pulumi simply treated the hooks as normal resources, which can lead to incorrect behavior. As we can see, hooks generally affect the order of operations, and also vary based on whether the chart is being installed, upgraded, or deleted. The Pulumi engine provides the |
A low-hanging improvement here would be to emit a clear warning message if the chart did contain a hook. The provider does have a warning like this for Chart/v3 but isn't effective in Chart/v4. |
Hello, In my opinion, Argo CD does the right thing regarding hooks: https://argo-cd.readthedocs.io/en/latest/user-guide/helm/#helm-hooks. It makes almost every chart work as expected. I think we could achieve nearly the same with Pulumi. The only challenge is see is around the hook deletion policy, where we might have to do clever things like |
Thanks for the information, it says that Argo CD emulates the behavior of some hooks, with caveats. I agree that, where there's opportunity to support a type of hook, we should. But, like Argo, Pulumi may struggle to distinguish installs and upgrades, etc. |
Sure, the solution cannot be perfect, it’s infeasible. However, Argo CD emulation proved to be satisfying in a lot of use cases and, this is pure conjecture from myself, I think they are sufficiently big to make chart authors considering modifying their charts so that they work with Argo CD. My question is, would you be open to consider a PR bringing the same behaviour than Argo CD to Pulumi (I anticipate this PR to be a fair amount of work, so I prefer knowing you position before trying to work on it 🙂)? |
Hello!
Issue details
helm.v3.Chart
ignored thehelm.sh/hook*
annotations but still deployed the resources.The
helm.v4.Chart
resource skips the hooks. This is mentioned in the blog but not in the docs BTW.I think users should have a way to make v4.Chart deploy hooked resources like v3 did, because it's useful and becasue it makes migrating from v3 to v4 less painful.
The text was updated successfully, but these errors were encountered: