From 33ec00122d7cedbcf441c53be213e015821514c5 Mon Sep 17 00:00:00 2001 From: jiuker Date: Wed, 4 Sep 2024 15:41:49 +0800 Subject: [PATCH] fix: will not create anything for marked deleted tenant fix: will not create anything for marked deleted tenant --- pkg/controller/main-controller.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/controller/main-controller.go b/pkg/controller/main-controller.go index 431e5d0c84..3c7f197af0 100644 --- a/pkg/controller/main-controller.go +++ b/pkg/controller/main-controller.go @@ -804,6 +804,12 @@ func (c *Controller) syncHandler(key string) (Result, error) { // will retry after 5sec return WrapResult(Result{RequeueAfter: time.Second * 5}, nil) } + // Check if the Tenant is marked to be deleted + // Shouldn't create resources when marked for deletion + if !tenant.DeletionTimestamp.IsZero() { + runtime.HandleError(fmt.Errorf("Tenant '%s' is marked for deletion", key)) + return WrapResult(Result{}, nil) + } // Check the Sync Version to see if the tenant needs upgrade if tenant, err = c.checkForUpgrades(ctx, tenant); err != nil {