Skip to content

Commit

Permalink
fix(upgrade-job): avoid infinite loop when no unhealthy vols have a t…
Browse files Browse the repository at this point in the history
…arget

Signed-off-by: Niladri Halder <[email protected]>
  • Loading branch information
niladrih committed Dec 27, 2023
1 parent 2a93380 commit c0096f6
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions k8s/upgrade/src/bin/upgrade-job/upgrade/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,13 @@ pub(crate) async fn rebuild_result(
break;
}

let mut volume_over_nodes = HashSet::new();
for volume in unhealthy_volumes.iter() {
let target = if let Some(target) = volume.state.target.as_ref() {
target
} else {
continue;
let target = match volume.state.target.as_ref() {
Some(t) => t,
None => continue,
};

let mut volume_over_nodes = HashSet::new();
volume_over_nodes.insert(target.node.as_str());

for (_, topology) in volume.state.replica_topology.iter() {
Expand Down Expand Up @@ -74,6 +73,9 @@ pub(crate) async fn rebuild_result(
}
}
}
if volume_over_nodes.is_empty() {
break;
}
}
Ok(RebuildResult {
rebuilding: false,
Expand Down

0 comments on commit c0096f6

Please sign in to comment.