Skip to content

Commit

Permalink
fix: reconcile ng status
Browse files Browse the repository at this point in the history
  • Loading branch information
mnaser committed Nov 7, 2022
1 parent faa153b commit 1221e94
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions magnum_cluster_api/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 1221e94

Please sign in to comment.