Open ml0renz0 opened 2 years ago
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.
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.
This hit me today.
I did set the annotation with kubectl annotate pvc -n hedgedoc helm.sh/resource-policy=keep
but the resources were deleted by helm delete
version.BuildInfo{Version:"v3.9.0", GitCommit:"7ceeda6c585217a19a1131663d8cd1f7d641b2a7", GitTreeState:"clean", GoVersion:"go1.17.5"}
The docs should be updated then, because they state that uninstall
honors the annotation:
From https://helm.sh/docs/howto/charts_tips_and_tricks/#tell-helm-not-to-uninstall-a-resource
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.
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.
PR #10893 needs to be merged to fix this.
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
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 did not test to add the annotation by hand.
Helm version v3.12.0
@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
Faced the same issue =( Patching the resource with kubectl doesn't prevent deletion (helm uninstall/upgrade).
Any news on this?
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. 😔
Output of
helm version
:Output of
kubectl version
:Helm documentation states that:
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 theDelete
method?