From 54b2cee97f092279c072f9a0cf2cd773b1bc8adb Mon Sep 17 00:00:00 2001 From: Humair Khan Date: Fri, 18 Oct 2024 17:07:23 -0400 Subject: [PATCH] prevent dspa status update on a terminating dspa when a dspa is marked for deletion, there is no state logic to handle dspa statuses, so the update can at times try to update a dspa that may have already been deleted, this change should prevent (or reduce) the chances of this happening, in the future proper/graceful dspa termination handling should be added Signed-off-by: Humair Khan --- controllers/dspipeline_controller.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/controllers/dspipeline_controller.go b/controllers/dspipeline_controller.go index 526fbea5..8a6a644e 100644 --- a/controllers/dspipeline_controller.go +++ b/controllers/dspipeline_controller.go @@ -218,6 +218,7 @@ func (r *DSPAReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl. if err := r.Update(ctx, dspa); err != nil { return ctrl.Result{}, err } + log.Info("DSPA resources cleaned up.") } // Stop reconciliation as the item is being deleted @@ -363,6 +364,11 @@ func (r *DSPAReconciler) setStatus(ctx context.Context, resourceName string, con func (r *DSPAReconciler) updateStatus(ctx context.Context, dspa *dspav1alpha1.DataSciencePipelinesApplication, dspaStatus dspastatus.DSPAStatus, log logr.Logger, req ctrl.Request) { r.refreshDspa(ctx, dspa, req, log) + + // TODO: this is a workaround, handle deletion more gracefully + if dspa.DeletionTimestamp != nil { + return + } dspa.Status.Components = r.GetComponents(ctx, dspa) dspa.Status.Conditions = dspaStatus.GetConditions() err := r.Status().Update(ctx, dspa)