Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1537 from weaveworks/release/helm-0.5.1
Browse files Browse the repository at this point in the history
Release Helm operator 0.5.1
  • Loading branch information
hiddeco committed Nov 21, 2018
2 parents 5cd745c + 533a65d commit e1800f1
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG-helmop.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
## 0.5.1 (2018-11-21)

### Bug fixes

- Helm releases will now stay put when an upgrade fails or the
Kubernetes API connectivity is flaky, instead of getting purged
[weaveworks/flux#1530](https://github.com/weaveworks/flux/pull/1530)

### Thanks

Thanks to @sfrique, @brantb and @squaremo for helping document the
issues leading to this bug fix, @stefanprodan for actually squashing
the bug and all others that may have gone unnoticed while writing this
release note.

## 0.5.0 (2018-11-14)

WARNING: this release of the Helm operator is not backward-compatible:
Expand Down
2 changes: 1 addition & 1 deletion deploy-helm/helm-operator-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ spec:
# There are no ":latest" images for helm-operator. Find the most recent
# release or image version at https://quay.io/weaveworks/helm-operator
# and replace the tag here.
image: quay.io/weaveworks/helm-operator:0.5.0
image: quay.io/weaveworks/helm-operator:0.5.1
imagePullPolicy: IfNotPresent
volumeMounts:
# Include this if you need to mount a customised known_hosts or ssh_config
Expand Down
15 changes: 9 additions & 6 deletions integrations/helm/release/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,15 @@ func (r *Release) Install(chartPath, releaseName string, fhr flux_v1beta1.HelmRe

if err != nil {
r.logger.Log("error", fmt.Sprintf("Chart release failed: %s: %#v", releaseName, err))
// if an install fails, purge the release and keep retrying
r.logger.Log("info", fmt.Sprintf("Deleting failed release: [%s]", releaseName))
_, err = r.HelmClient.DeleteRelease(releaseName, k8shelm.DeletePurge(true))
if err != nil {
r.logger.Log("error", fmt.Sprintf("Release deletion error: %#v", err))
return nil, err
// purge the release if the install failed but only if this is the first revision
history, err := r.HelmClient.ReleaseHistory(releaseName, k8shelm.WithMaxHistory(2))
if err == nil && len(history.Releases) == 1 && history.Releases[0].Info.Status.Code == hapi_release.Status_FAILED {
r.logger.Log("info", fmt.Sprintf("Deleting failed release: [%s]", releaseName))
_, err = r.HelmClient.DeleteRelease(releaseName, k8shelm.DeletePurge(true))
if err != nil {
r.logger.Log("error", fmt.Sprintf("Release deletion error: %#v", err))
return nil, err
}
}
return nil, err
}
Expand Down

0 comments on commit e1800f1

Please sign in to comment.