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
helm can delete resources not created by helm #3319
A helm install can result in a FAILED deploy if resources it is trying to create already exist. Purging the failed deploy results in the existing resources getting deleted.
What I expect
Deleting a helm deployment does not delete resources that were created outside of helm.
What happens
Helm deletes resources that were created outside of helm.
Could helm use the heritage and release labels to determine which resources it owns?
Steps to reproduce
Manually create a kubernetes service resource named example using kubectl.
Install a helm chart that would also create a service named example. This will fail with error like Error: release example failed: services "example" already exists.
helm delete --purge the release. This will delete the example service.
Since we don't require the usage of those labels, we can't delete based on that. But I agree, this is a bug that we should fix.
Just to add some specificity for other readers:
If a chart is installed with the name foo and installs, says, a deployment, then the K8S API server accepts the manifest (e.g. it is well formed), but then fails to create the resources, we end up in a situation in which Helm believes the chart was installed, but k8s does not.
In a case where the install failed because a deployment exists with the same name, if you run a subsequence helm delete, Helm believes it owns the deployment that pre-dated the failed install. So it will delete it.
With Helm 3, we can definitely solve this with labels. For Helm 2, we will need to figure out a more creative way to do this -- perhaps by checking that the creation time of the existing resources is equal to (or after) the release creation time.
I had a little time to think on this and explore the code a bit. The discussion so far has been around preventing helm from deleting resources it didn't create, but perhaps we could just prevent it from wrongly claiming ownership in the first place.
currently in func (s *ReleaseServer) prepareRelease it performs operations like uniqName & validateManifest, would it make sense to add another validation step where we make a Get call using the KubeClient to check if the resource we are about to create already exists?
It would mean an extra API call, but it would allow us to short circuit on existing resources, before tiller can claim ownership, which would prevent the issue described above.
Let me know if there are any gaps or things I am missing, or if this is a workable path forward for implementation of a fix.
Thanks in advance for your comments and suggestions.
i just wanted to check in and see if you've had a chance to take a look at the PR for this issue?
Let me know your thoughts and how you'd like to proceed. Thanks :)
pr: (#3477)
-John
We are in the same situation, with already existing services that creates aws' Load Balancers on creation. I don't want to delete the service to get it handled by Helm because it would mean re-creating the Load Balancer and losing all the references in my routing table.
Any chance we can get an update on this please?
Activity
bacongobbler commentedon Jan 8, 2018
related comment: #3313 (comment)
technosophos commentedon Jan 8, 2018
Since we don't require the usage of those labels, we can't delete based on that. But I agree, this is a bug that we should fix.
Just to add some specificity for other readers:
If a chart is installed with the name
fooand installs, says, adeployment, then the K8S API server accepts the manifest (e.g. it is well formed), but then fails to create the resources, we end up in a situation in which Helm believes the chart was installed, but k8s does not.In a case where the install failed because a deployment exists with the same name, if you run a subsequence
helm delete, Helm believes it owns the deployment that pre-dated the failed install. So it will delete it.With Helm 3, we can definitely solve this with labels. For Helm 2, we will need to figure out a more creative way to do this -- perhaps by checking that the creation time of the existing resources is equal to (or after) the release creation time.
xchapter7x commentedon Jan 30, 2018
@technosophos
mind if i take a crack at this one?
bacongobbler commentedon Jan 31, 2018
sure!
xchapter7x commentedon Feb 2, 2018
I had a little time to think on this and explore the code a bit. The discussion so far has been around preventing helm from deleting resources it didn't create, but perhaps we could just prevent it from wrongly claiming ownership in the first place.
currently in
func (s *ReleaseServer) prepareReleaseit performs operations likeuniqName&validateManifest, would it make sense to add another validation step where we make aGetcall using the KubeClient to check if the resource we are about to create already exists?It would mean an extra API call, but it would allow us to short circuit on existing resources, before tiller can claim ownership, which would prevent the issue described above.
Let me know if there are any gaps or things I am missing, or if this is a workable path forward for implementation of a fix.
Thanks in advance for your comments and suggestions.
-John
add pending test for client.Create functionality
xchapter7x commentedon Feb 11, 2018
hi @bacongobbler, @technosophos, @svend ,
I have a ready PR in to address this issue. Description and approach is in the PR.
Let me know your collective thoughts and feedback.
Thanks in advance.
pr: (#3477)
-John
xchapter7x commentedon Mar 23, 2018
hi @bacongobbler, @technosophos,
i just wanted to check in and see if you've had a chance to take a look at the PR for this issue?
Let me know your thoughts and how you'd like to proceed. Thanks :)
pr: (#3477)
-John
iomv commentedon Nov 2, 2018
We are in the same situation, with already existing services that creates aws' Load Balancers on creation. I don't want to delete the service to get it handled by Helm because it would mean re-creating the Load Balancer and losing all the references in my routing table.
Any chance we can get an update on this please?
DanHoerst commentedon Feb 7, 2019
Any chance we could get an update on this?
bacongobbler commentedon Jun 13, 2019
@DanHoerst feel free to give #3477 a try and see if that fixes the issue for you.
bacongobbler commentedon Oct 1, 2019
fixed in Helm 3 via #6542