From 1221e94e71cc88fa70839004c705af37e80ae99f Mon Sep 17 00:00:00 2001 From: Mohammed Naser Date: Mon, 7 Nov 2022 01:07:35 +0000 Subject: [PATCH] fix: reconcile ng status --- magnum_cluster_api/driver.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/magnum_cluster_api/driver.py b/magnum_cluster_api/driver.py index 88efa76a..3db4ee0f 100644 --- a/magnum_cluster_api/driver.py +++ b/magnum_cluster_api/driver.py @@ -81,13 +81,14 @@ def update_cluster_status(self, context, cluster, use_admin_ctx=False): cluster.api_address = ( f"https://{api_endpoint['host']}:{api_endpoint['port']}" ) + cluster.coe_version = capi_cluster.obj["spec"]["topology"]["version"] for node_group in cluster.nodegroups: ng = self.update_nodegroup_status(context, cluster, node_group) if not ng.status.endswith("_COMPLETE"): return - - cluster.coe_version = capi_cluster.obj["spec"]["topology"]["version"] + if ng.status == "DELETE_COMPLETE": + ng.destroy() if cluster.status == "CREATE_IN_PROGRESS": cluster.status = "CREATE_COMPLETE" @@ -227,7 +228,9 @@ def update_nodegroup(self, context, cluster, nodegroup): resources.apply_cluster_from_magnum_cluster(context, self.k8s_api, cluster) def delete_nodegroup(self, context, cluster, nodegroup): - nodegroup.destroy() + nodegroup.status = "DELETE_IN_PROGRESS" + nodegroup.save() + resources.apply_cluster_from_magnum_cluster( context, self.k8s_api,