From 59dd68e49b455513679e81402431f3b7acf97271 Mon Sep 17 00:00:00 2001 From: jiuker <2818723467@qq.com> Date: Wed, 11 Sep 2024 16:14:00 +0800 Subject: [PATCH] fix: do not create resources for marked deleted tenant (#2310) --- 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 431e5d0c842..aeb4e1c3d50 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, skipping", 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 {