Skip to content

Commit

Permalink
Remove destructive "self-healing" logic when service state inconsiste…
Browse files Browse the repository at this point in the history
…nt (#262)

In the early days of IBM Cloud Operator, self-healing was added with the intent to reconcile a Service in an inconsistent state by recreating the service instance.

This can be very destructive for critical services like databases, so this removes the service deletion.

Signed-off-by: John Starich <[email protected]>
  • Loading branch information
JohnStarich authored Oct 13, 2021
1 parent 8c24507 commit 0be0e4d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 9 deletions.
5 changes: 0 additions & 5 deletions controllers/service_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -529,11 +529,6 @@ func (r *ServiceReconciler) updateStatus(session *session.Session, logt logr.Log
setStatusFieldsFromSpec(instance, resourceContext)
err := r.Status().Update(context.Background(), instance)
if err != nil {
r.Log.Info("Failed to update online status, will delete external resource ", instance.ObjectMeta.Name, err.Error())
errD := r.deleteService(session, logt, instance, serviceClassType)
if errD != nil {
r.Log.Info("Failed to delete external resource, operator state and external resource might be in an inconsistent state", instance.ObjectMeta.Name, errD.Error())
}
return ctrl.Result{}, err
}
}
Expand Down
4 changes: 0 additions & 4 deletions controllers/service_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2326,10 +2326,6 @@ func TestServiceUpdateStatusFailed(t *testing.T) {
),
Log: testLogger(t),
Scheme: scheme,

DeleteResourceServiceInstance: func(session *session.Session, instanceID string, logt logr.Logger) error {
return fmt.Errorf("failed to delete") // only gets logged, no error handling
},
}

result, err := r.updateStatus(nil, r.Log, instance, ibmcloudv1.ResourceContext{}, "myinstanceid", "state", "")
Expand Down

0 comments on commit 0be0e4d

Please sign in to comment.