[Backport release-1.5] fix(kamaji): backport datastore unused-deletion deadlock fix (clastix/kamaji#1122) (#3187)

# Description
Backport of #3146 to `release-1.5`.
This commit is contained in:
myasnikovdaniil authored and GitHub committed 2026-07-03 14:53:25 +05:00
commit ccb325eaaa
1 file changed
+12
@@ -0,0 +1,12 @@
diff --git a/controllers/datastore_controller.go b/controllers/datastore_controller.go
--- a/controllers/datastore_controller.go
+++ b/controllers/datastore_controller.go
@@ -151,7 +151,7 @@ func (r *DataStore) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error) {
return reconcile.Result{}, nil
}
- if meta.IsStatusConditionFalse(ds.Status.Conditions, kamajiv1alpha1.DataStoreConditionAllowedDeletionType) {
+ if meta.IsStatusConditionFalse(ds.Status.Conditions, kamajiv1alpha1.DataStoreConditionAllowedDeletionType) || len(tcpList.Items) == 0 {
logger.Info("DataStore is not used by any TenantControlPlane object")
meta.SetStatusCondition(&ds.Status.Conditions, metav1.Condition{