From a114736fd3b7f3d5def0b331c00d568dac9bc3b1 Mon Sep 17 00:00:00 2001 From: Myasnikov Daniil Date: Tue, 23 Jun 2026 17:18:30 +0500 Subject: [PATCH] fix(kamaji): backport datastore unused-deletion deadlock fix (clastix/kamaji#1122) Deleting a Tenant whose etcd DataStore has 0 referencing TenantControlPlanes left the DataStore stuck Terminating (finalizer kamaji.clastix.io/TenantControlPlane), hanging the etcd helm uninstall and wedging the tenant namespace. Backports clastix/kamaji#1122 (fixes clastix/kamaji#1115) as a source patch on the pinned 26.3.6-edge build. Refs #3018. Signed-off-by: Myasnikov Daniil (cherry picked from commit 47638f8569dc231f2b0040e13b0f9419830ff065) --- .../patches/fix-datastore-unused-deletion.diff | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 packages/system/kamaji/images/kamaji/patches/fix-datastore-unused-deletion.diff diff --git a/packages/system/kamaji/images/kamaji/patches/fix-datastore-unused-deletion.diff b/packages/system/kamaji/images/kamaji/patches/fix-datastore-unused-deletion.diff new file mode 100644 index 000000000..53073699b --- /dev/null +++ b/packages/system/kamaji/images/kamaji/patches/fix-datastore-unused-deletion.diff @@ -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{