From a0574bfc1eb18adfc274fc605027ee9ecfbda9bc Mon Sep 17 00:00:00 2001 From: Ruinan Liu Date: Wed, 4 Feb 2026 10:27:12 -0800 Subject: [PATCH] Initial commit for adding foreground deletoin --- internal/controllers/reconciliation/controller.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/internal/controllers/reconciliation/controller.go b/internal/controllers/reconciliation/controller.go index 7959c4ae..7875f759 100644 --- a/internal/controllers/reconciliation/controller.go +++ b/internal/controllers/reconciliation/controller.go @@ -239,7 +239,15 @@ func (c *Controller) reconcileSnapshot(ctx context.Context, comp *apiv1.Composit } reconciliationActions.WithLabelValues("delete").Inc() - err := c.upstreamClient.Delete(ctx, current) + + opts := []client.DeleteOption{} + if res.ForegroundDeletion { + deletionPropagation := metav1.DeletePropagationForeground + opts = append(opts, client.PropagationPolicy(deletionPropagation)) + logger.Info("deleting resource with foreground deletion") + } + + err := c.upstreamClient.Delete(ctx, current, opts...) if err != nil { return true, client.IgnoreNotFound(fmt.Errorf("deleting resource: %w", err)) }