diff --git a/k8s/upgrade/src/bin/upgrade-job/upgrade/utils.rs b/k8s/upgrade/src/bin/upgrade-job/upgrade/utils.rs index 1fddf112c..1e283da8c 100644 --- a/k8s/upgrade/src/bin/upgrade-job/upgrade/utils.rs +++ b/k8s/upgrade/src/bin/upgrade-job/upgrade/utils.rs @@ -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() { @@ -74,6 +73,9 @@ pub(crate) async fn rebuild_result( } } } + if volume_over_nodes.is_empty() { + break; + } } Ok(RebuildResult { rebuilding: false,