diff --git a/controllers/nova_controller.go b/controllers/nova_controller.go index 575e378d3..fab5c95ad 100644 --- a/controllers/nova_controller.go +++ b/controllers/nova_controller.go @@ -600,6 +600,8 @@ func (r *NovaReconciler) Reconcile(ctx context.Context, req ctrl.Request) (resul return ctrl.Result{}, err } + var deleteErrs []error + for _, cr := range novaCellList.Items { _, ok := instance.Spec.CellTemplates[cr.Spec.CellName] if !ok { @@ -607,11 +609,17 @@ func (r *NovaReconciler) Reconcile(ctx context.Context, req ctrl.Request) (resul cr.Spec.CellName, apiTransportURL, secret, apiDB, cellDBs[novav1.Cell0Name].Database.GetDatabaseHostname(), cells[novav1.Cell0Name]) if err != nil { - return ctrl.Result{}, err + deleteErrs = append(deleteErrs, fmt.Errorf("Cell '%s' deletion failed, because: %w", cr.Spec.CellName, err)) + + } else { + Log.Info("Cell deleted", "cell", cr.Spec.CellName) + delete(instance.Status.RegisteredCells, cr.Name) } - Log.Info("Cell deleted", "cell", cr.Spec.CellName) - delete(instance.Status.RegisteredCells, cr.Name) } + } + + if len(deleteErrs) > 0 { + return ctrl.Result{}, fmt.Errorf("errors: %v", deleteErrs) }