Skip to content

Commit

Permalink
pkg/helm/controller/reconcile.go: fix conditions logic (#1321)
Browse files Browse the repository at this point in the history
* pkg/helm/controller/reconcile.go: fix conditions logic

If a change is made to the CR spec that causes a release failure, a ConditionReleaseFailed is added to the status conditions. If that change is then reverted to its previous state, the operator will stop attempting the release and will resume reconciling.

In this case, we need to remove the ConditionReleaseFailed because the failing release is no longer being attempted.

* CHANGELOG.md: add bug fix #1321
  • Loading branch information
joelanford authored Apr 23, 2019
1 parent 3f9650c commit 7044fde
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

### Bug Fixes

- In Helm-based operators, when a custom resource with a failing release is reverted back to a working state, the `ReleaseFailed` condition is now correctly removed. ([#1321](https://github.com/operator-framework/operator-sdk/pull/1321))

## v0.7.0

### Added
Expand Down
8 changes: 8 additions & 0 deletions pkg/helm/controller/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,14 @@ func (r HelmOperatorReconciler) Reconcile(request reconcile.Request) (reconcile.
return reconcile.Result{RequeueAfter: r.ReconcilePeriod}, err
}

// If a change is made to the CR spec that causes a release failure, a
// ConditionReleaseFailed is added to the status conditions. If that change
// is then reverted to its previous state, the operator will stop
// attempting the release and will resume reconciling. In this case, we
// need to remove the ConditionReleaseFailed because the failing release is
// no longer being attempted.
status.RemoveCondition(types.ConditionReleaseFailed)

expectedRelease, err := manager.ReconcileRelease(context.TODO())
if err != nil {
log.Error(err, "Failed to reconcile release")
Expand Down

0 comments on commit 7044fde

Please sign in to comment.