Skip to content
This repository was archived by the owner on Jan 25, 2019. It is now read-only.

pkg/helm,pkg/helm/controller: fixing reconciliation loop bugs #47

Merged
merged 1 commit into from
Oct 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion helm-app-operator/pkg/helm/controller/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (r helmOperatorReconciler) Reconcile(request reconcile.Request) (reconcile.

if o.GetResourceVersion() == lastResourceVersion {
logrus.Infof("skipping %s because resource version has not changed", request.NamespacedName)
return reconcile.Result{}, nil
return reconcile.Result{RequeueAfter: r.ResyncPeriod}, nil
}

updatedResource, err := r.Installer.InstallRelease(o)
Expand Down
14 changes: 13 additions & 1 deletion helm-app-operator/pkg/helm/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,20 @@ func (c installer) InstallRelease(r *v1alpha1.HelmApp) (*v1alpha1.HelmApp, error
// UninstallRelease accepts a custom resource, uninstalls the existing Helm release
// using Tiller, and returns the custom resource with updated `status`.
func (c installer) UninstallRelease(r *v1alpha1.HelmApp) (*v1alpha1.HelmApp, error) {
// Get history of this release
h, err := c.storageBackend.History(releaseName(r))
if err != nil {
return r, err
}

// If there is no history, the release has already been uninstalled,
// so there's nothing to do.
if len(h) == 0 {
return r, nil
}

tiller := tillerRendererForCR(r, c.storageBackend, c.tillerKubeClient)
_, err := tiller.UninstallRelease(context.TODO(), &services.UninstallReleaseRequest{
_, err = tiller.UninstallRelease(context.TODO(), &services.UninstallReleaseRequest{
Name: releaseName(r),
Purge: true,
})
Expand Down