Skip to content
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

Delete failed installations #1320

Merged
merged 2 commits into from
Dec 3, 2019
Merged

Conversation

andresmgot
Copy link
Contributor

@andresmgot andresmgot commented Nov 26, 2019

Description of the change

When creating a release, if it fails for some reason (like band inputs) clean up the release afterwards so the same name can be reused.

BTW, there is no an "atomic" flag that we can use in the CreateRelease action for helm, this is the code:

https://github.com/helm/helm/blob/456eb7f4118a635427bd43daa3d7aabf29304f13/pkg/action/install.go#L313

Possible drawbacks

If the release failed to be installed but it's not stored as a failed release (for example for an invalid name) we will be returning also an error for the missing release when trying to delete it, which might be confusing.

Applicable issues

cc/ @SimonAlling since these changes affect to tiller-proxy

return nil, fmt.Errorf("Unable to create the release: %v", err)
errDelete := p.deleteRelease(name, namespace, true)
if errDelete != nil {
return nil, fmt.Errorf("Unable to create the release: %v and unable to uninstall it: %v", err, errDelete)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't need to uninstall a release which was not created. I think helm's messaging here is a little clearer, in that the release failed. Something like:

"Release %q failed: %v. Unable to purge failed release: %v"

Though it'd be nicer to wrap the error (like the helm code for atomic does).

if errDelete != nil {
return nil, fmt.Errorf("Unable to create the release: %v and unable to uninstall it: %v", err, errDelete)
}
return nil, fmt.Errorf("Unable to create the release and has been uninstalled: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly here: "Release %q failed and has been uninstalled: %v"

if err == nil {
t.Error("Release should fail, an existing release in a different namespace already exists")
}
if !strings.Contains(err.Error(), "already exists") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you try adding a test for the actual deletion and it was not worth it for now? (given that tiller-proxy is dying).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, there is no easy way for the current fake helm implementation to fail doing an installation

@andresmgot andresmgot merged commit 06437c9 into vmware-tanzu:master Dec 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"has no deployed releases" limbo-state
2 participants