You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Annotation "helm.sh/resource-policy": keep not honored when uninstalling #10890
The annotation "helm.sh/resource-policy": keep instructs Helm to skip deleting this resource when a helm operation (such as helm uninstall, helm upgrade or helm rollback) would result in its deletion.
As I commented on issue #3673, I noticed that the annotation "helm.sh/resource-policy": keep on a resource is not honored when the release is uninstalled.
I see it was fixed for Update method, could it be that this change needs also to be included in the Delete method?
Reacted by Andy Suderman, Siarhei Hreben, Vladimir Glazkov, ccubu, Min Kim, Connor Given, Dmitry Volodin, VonUniGE, Thiago Perrotta, Alexander Bussian and 10 more
This issue has been marked as stale because it has been open for 90 days with no activity. This thread will be automatically closed in 30 days if no further activity occurs.
when will we have this feature supported in helm uninstall? This sounds like a valid usecase and would be great, if we can have this PR merged into master. Thanks.
Reacted by Marcos Lorenzo de Santiago, Mike Dolinin, Siarhei Hreben, Tan Guan Hong, Chris Powell, Philipp Nanz, Michelle Beard, Gerry Laracuente, Kartik Shrivastava, Relief.Melone and 6 more
This issue has been marked as stale because it has been open for 90 days with no activity. This thread will be automatically closed in 30 days if no further activity occurs.
The annotation "helm.sh/resource-policy": keep instructs Helm to skip deleting this resource when a helm operation (such as helm -->uninstall<--, helm upgrade or helm rollback) would result in its deletion.
Reacted by Sébastien de Melo, Luboš Zíma and Dalibor Filus
Helm uninstall seems to respect the annotation now, tried latest version version.BuildInfo{Version:"v3.12.3", GitCommit:"3a31588ad33fe3b89af5a2a54ee1d25bfe6eaa5e", GitTreeState:"clean", GoVersion:"go1.20.7"}
Helm uninstall seems to respect the annotation now, tried latest version version.BuildInfo{Version:"v3.12.3", GitCommit:"3a31588ad33fe3b89af5a2a54ee1d25bfe6eaa5e", GitTreeState:"clean", GoVersion:"go1.20.7"}
This is NOT the case for me even on version.BuildInfo{Version:"v3.12.3", GitCommit:"3a31588ad33fe3b89af5a2a54ee1d25bfe6eaa5e", GitTreeState:"clean", GoVersion:"go1.20.7"}
helm.sh/resource-policy=keep was still ignored during helm uninstall and the resources were deleted when they should not be.
Hi there, I found that annotating by kubectl does not make effect. But if you make the annotation through helm it is respected later in the uninstall process. In my case, I modified the chart I was using for testing purpose. This may work as a workarround.
Regards
Reacted by AndreaScarselliAx, Antonio Niño Díaz and Willian Braga da Silva
Reacted by AndreaScarselliAx and Willian Braga da Silva
Reacted by AndreaScarselliAx, Eva Cassie Course and Willian Braga da Silva
Reacted by AndreaScarselliAx and Willian Braga da Silva
I can also confirm that if the annotation is deployed with Helm, then the resources will stay intact.
helm delete crds
These resources were kept due to the resource policy:
[CustomResourceDefinition] crdA
[CustomResourceDefinition] crdB
[CustomResourceDefinition] crdC
release "..." uninstalled
I think is not bug. Because, helm manages it's state through a secret. It don't compare with the final manifest of the resource. So if you want to respect this behavior, the configuration should be added by helm. It is only an opinion.
@Pela2silveira is correct. Helm appears to look only at the Secret called sh.helm.release.v{#}.{chartname-randomstring}.v{#} that it creates whenever you helm install or helm upgrade a chart in order to determine the current state of its managed resources. This secret contains the entire chart rendered out fully as if you did helm template (including Secrets and generated passwords), then gzip'd and converted to base64 and then stored in this one 'release' Secret.
I think there is something being worked on here (although I'm not 100% following why the work has gone to the GitHub Actions Runner repo instead of the main Helm repo but never mind my confusion 😇) to enable us to go helm upgrade --custom-annotations=(...) or something along those lines. Not sure what the status is of that work; asked for a follow-up... we'll see.
Chart owners appear to be adding this functionality manually:
The use case of the annotation helm.sh/resource-policy=keep should support ondemand basic by using kubectl though without upgrading again the helm chart. It will be hard to deal with helm chart which is shared with multiple apps. 😔
Activity
github-actions commentedon Jul 26, 2022
This issue has been marked as stale because it has been open for 90 days with no activity. This thread will be automatically closed in 30 days if no further activity occurs.
smaanika-px commentedon Aug 1, 2022
when will we have this feature supported in
helm uninstall? This sounds like a valid usecase and would be great, if we can have this PR merged into master. Thanks.github-actions commentedon Oct 31, 2022
This issue has been marked as stale because it has been open for 90 days with no activity. This thread will be automatically closed in 30 days if no further activity occurs.
r10r commentedon Jun 30, 2023
This hit me today.
I did set the annotation with
kubectl annotate pvc -n hedgedoc helm.sh/resource-policy=keepbut the resources were deleted byhelm deleteThe docs should be updated then, because they state that
uninstallhonors the annotation:From https://helm.sh/docs/howto/charts_tips_and_tricks/#tell-helm-not-to-uninstall-a-resource
bczoma commentedon Aug 10, 2023
Helm uninstall seems to respect the annotation now, tried latest version
version.BuildInfo{Version:"v3.12.3", GitCommit:"3a31588ad33fe3b89af5a2a54ee1d25bfe6eaa5e", GitTreeState:"clean", GoVersion:"go1.20.7"}iAnomaly commentedon Sep 12, 2023
This is NOT the case for me even on
version.BuildInfo{Version:"v3.12.3", GitCommit:"3a31588ad33fe3b89af5a2a54ee1d25bfe6eaa5e", GitTreeState:"clean", GoVersion:"go1.20.7"}helm.sh/resource-policy=keepwas still ignored duringhelm uninstalland the resources were deleted when they should not be.PR #10893 needs to be merged to fix this.
Pela2silveira commentedon Sep 20, 2023
Hi there, I found that annotating by kubectl does not make effect. But if you make the annotation through helm it is respected later in the uninstall process. In my case, I modified the chart I was using for testing purpose. This may work as a workarround.
Regards
fischerman commentedon Oct 2, 2023
I can also confirm that if the annotation is deployed with Helm, then the resources will stay intact.
I did not test to add the annotation by hand.
Helm version v3.12.0
odise commentedon Nov 7, 2023
@fischerman I tested adding the annotation manually to a Helm managed CRD and it will be ignored (CRD will be removed with
helm uninstall).Helm version v3.12.3
Subetov commentedon Jan 17, 2024
Faced the same issue =(
Patching the resource with kubectl doesn't prevent deletion (helm uninstall/upgrade).
AndreaScarselliAx commentedon Feb 8, 2024
Any news on this?
Pela2silveira commentedon Feb 8, 2024
I think is not bug. Because, helm manages it's state through a secret. It don't compare with the final manifest of the resource. So if you want to respect this behavior, the configuration should be added by helm. It is only an opinion.
Shrooblord commentedon Mar 7, 2024
@Pela2silveira is correct. Helm appears to look only at the Secret called
sh.helm.release.v{#}.{chartname-randomstring}.v{#}that it creates whenever youhelm installorhelm upgradea chart in order to determine the current state of its managed resources. This secret contains the entire chart rendered out fully as if you didhelm template(including Secrets and generated passwords), then gzip'd and converted to base64 and then stored in this one 'release' Secret.I think there is something being worked on here (although I'm not 100% following why the work has gone to the GitHub Actions Runner repo instead of the main Helm repo but never mind my confusion 😇) to enable us to go
helm upgrade --custom-annotations=(...)or something along those lines. Not sure what the status is of that work; asked for a follow-up... we'll see.Chart owners appear to be adding this functionality manually:
zip-chanko commentedon Oct 29, 2024
The use case of the annotation
helm.sh/resource-policy=keepshould support ondemand basic by usingkubectlthough without upgrading again the helm chart. It will be hard to deal with helm chart which is shared with multiple apps. 😔Add support for setting additional annotations on the CRDs
Add support for setting additional annotations on the CRDs
Add support for setting additional annotations on the CRDs
Add support for setting additional annotations on the CRDs
luboszima commentedon Jun 10, 2026
Any updates?
Not working on current version: