Skip to content

Commit 5c3f889

Browse files
authored
backport: pkg/helm/controller/reconcile.go: fix conditions logic (#1321) (#1370)
* 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
1 parent 7ef9426 commit 5c3f889

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
### Bug Fixes
1212

1313
- 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))
14+
- 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))
1415

1516
## v0.7.0
1617

pkg/helm/controller/reconcile.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,14 @@ func (r HelmOperatorReconciler) Reconcile(request reconcile.Request) (reconcile.
242242
return reconcile.Result{RequeueAfter: r.ReconcilePeriod}, err
243243
}
244244

245+
// If a change is made to the CR spec that causes a release failure, a
246+
// ConditionReleaseFailed is added to the status conditions. If that change
247+
// is then reverted to its previous state, the operator will stop
248+
// attempting the release and will resume reconciling. In this case, we
249+
// need to remove the ConditionReleaseFailed because the failing release is
250+
// no longer being attempted.
251+
status.RemoveCondition(types.ConditionReleaseFailed)
252+
245253
expectedRelease, err := manager.ReconcileRelease(context.TODO())
246254
if err != nil {
247255
log.Error(err, "Failed to reconcile release")

0 commit comments

Comments
 (0)