Skip to content

Commit

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

* 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 operator-framework#1321
  • Loading branch information
joelanford committed May 2, 2019
1 parent 7ef9426 commit 32452db
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
### Bug Fixes

- Pin dependency versions in Ansible build and test framework Dockerfiles to fix broken build and test framework images. ([#1348](https://github.com/operator-framework/operator-sdk/pull/1348))
- 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

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 32452db

Please sign in to comment.