Add workaround to avoid infinite loop in cluster deregistration 53/14853/1
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Fri, 20 Dec 2024 09:35:13 +0000 (10:35 +0100)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Fri, 20 Dec 2024 09:35:23 +0000 (10:35 +0100)
Change-Id: Ia921b23433d1ba0450e96aaac9e4b4d1370977c1
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
osm_lcm/k8s.py

index 70dee64..ab6001b 100644 (file)
@@ -563,6 +563,8 @@ class ClusterLcm(GitOpsLcm):
         # To copy the cluster content and decrypting the key to use in workflows
         db_cluster_copy = self.decrypting_key(db_cluster)
 
+        # TODO: workaround until NBI rejects cluster deletion requests for registered clusters
+        # This if clause will be removed
         if db_cluster["created"] == "false":
             return await self.deregister(params, order_id)
 
@@ -991,6 +993,9 @@ class ClusterLcm(GitOpsLcm):
         db_cluster = self.update_operation_history(
             db_cluster, op_id, workflow_status, resource_status
         )
+        # TODO: workaround until NBI rejects cluster deletion requests for registered clusters
+        # Setting created flag to true avoids infinite loops when deregistering a cluster
+        db_cluster["created"] = "true"
         self.db.set_one("clusters", {"_id": db_cluster["_id"]}, db_cluster)
 
         return await self.delete(params, order_id)