From 9cb226a24397517c203bf00bd47fca14d37312b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergen=20Yal=C3=A7=C4=B1n?= <44261342+sergenyalcin@users.noreply.github.com> Date: Fri, 10 Nov 2023 14:02:51 +0300 Subject: [PATCH] Fix delete condition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sergen Yalçın --- pkg/controller/external_async_nofork.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/controller/external_async_nofork.go b/pkg/controller/external_async_nofork.go index c5d8e364..6829f5d1 100644 --- a/pkg/controller/external_async_nofork.go +++ b/pkg/controller/external_async_nofork.go @@ -173,7 +173,11 @@ func (n *noForkAsyncExternal) Update(_ context.Context, mg xpresource.Managed) ( } func (n *noForkAsyncExternal) Delete(_ context.Context, mg xpresource.Managed) error { - if !n.opTracker.LastOperation.MarkStart("delete") { + switch { + case n.opTracker.LastOperation.Type == "delete": + n.opTracker.logger.Debug("The previous delete operation is still ongoing", "tfID", n.opTracker.GetTfID()) + return nil + case !n.opTracker.LastOperation.MarkStart("delete"): return errors.Errorf("%s operation that started at %s is still running", n.opTracker.LastOperation.Type, n.opTracker.LastOperation.StartTime().String()) }