Skip to content

Commit

Permalink
Fix node group deletes
Browse files Browse the repository at this point in the history
Closes #411
  • Loading branch information
mnaser committed Jul 17, 2024
1 parent c1b6110 commit fe24283
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions magnum_cluster_api/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,17 @@ def update_nodegroups_status(
md = objects.MachineDeployment.for_node_group_or_none(
self.k8s_api, cluster, node_group
)

# NOTE(mnaser): If the cluster is in `DELETE_IN_PROGRESS` state, we need to
# wait for the `MachineDeployment` to be deleted before we can
# mark the node group as `DELETE_COMPLETE`.
if (
node_group.status == fields.ClusterStatus.DELETE_IN_PROGRESS
and md is None
):
node_group.status = fields.ClusterStatus.DELETE_COMPLETE
node_group.save()

md_is_running = (
md is not None and md.obj.get("status", {}).get("phase") == "Running"
)
Expand Down Expand Up @@ -480,16 +491,6 @@ def update_nodegroups_status(
node_group.status = fields.ClusterStatus.UPDATE_COMPLETE
node_group.save()

# NOTE(mnaser): If the cluster is in `DELETE_IN_PROGRESS` state, we need to
# wait for the `MachineDeployment` to be deleted before we can
# mark the node group as `DELETE_COMPLETE`.
if (
node_group.status == fields.ClusterStatus.DELETE_IN_PROGRESS
and md is None
):
node_group.status = fields.ClusterStatus.DELETE_COMPLETE
node_group.save()

node_groups.append(node_group)

return node_groups
Expand Down

0 comments on commit fe24283

Please sign in to comment.