From c3bea39fef39d68215219277d00d588d183e86fc Mon Sep 17 00:00:00 2001 From: Dmitry Dodzin Date: Wed, 4 Sep 2024 16:45:25 +0300 Subject: [PATCH] Make mirrord ls not list in parallel (#2725) * Update kube_seeker to be sequential * Changelog * Ops * Update changelog * Add default hardcodec chunk-size of 500 * Ops --- changelog.d/2724.fixed.md | 1 + mirrord/kube/src/api/kubernetes/seeker.rs | 27 ++++++++++++----------- 2 files changed, 15 insertions(+), 13 deletions(-) create mode 100644 changelog.d/2724.fixed.md diff --git a/changelog.d/2724.fixed.md b/changelog.d/2724.fixed.md new file mode 100644 index 00000000000..1bdca9a5a95 --- /dev/null +++ b/changelog.d/2724.fixed.md @@ -0,0 +1 @@ +Fix mirrord ls hanging by making so `KubeResourceSeeker` will list different kinds of resources sequentially instead of in parallel. diff --git a/mirrord/kube/src/api/kubernetes/seeker.rs b/mirrord/kube/src/api/kubernetes/seeker.rs index 88423c47bb8..969642fccf8 100644 --- a/mirrord/kube/src/api/kubernetes/seeker.rs +++ b/mirrord/kube/src/api/kubernetes/seeker.rs @@ -30,11 +30,9 @@ impl KubeResourceSeeker<'_> { /// Returns all resource types that don't require the operator to operate ie. [`Pod`], /// [`Deployment`] and [`Rollout`] pub async fn all_open_source(&self) -> Result> { - let (pods, deployments, rollouts) = futures::try_join!( - self.pods(), - self.deployments(), - self.simple_list_resource::("rollout") - )?; + let pods = self.pods().await?; + let deployments = self.deployments().await?; + let rollouts = self.simple_list_resource::("rollout").await?; Ok(pods .into_iter() @@ -46,14 +44,16 @@ impl KubeResourceSeeker<'_> { /// Returns all resource types ie. [`Pod`], [`Deployment`], [`Rollout`], [`Job`], [`CronJob`], /// and [`StatefulSet`] pub async fn all(&self) -> Result> { - let (pods, deployments, rollouts, jobs, cronjobs, statefulsets) = futures::try_join!( - self.pods(), - self.simple_list_resource::("deployment"), - self.simple_list_resource::("rollout"), - self.simple_list_resource::("job"), - self.simple_list_resource::("cronjob"), - self.simple_list_resource::("statefulset"), - )?; + let pods = self.pods().await?; + let deployments = self + .simple_list_resource::("deployment") + .await?; + let rollouts = self.simple_list_resource::("rollout").await?; + let jobs = self.simple_list_resource::("job").await?; + let cronjobs = self.simple_list_resource::("cronjob").await?; + let statefulsets = self + .simple_list_resource::("statefulset") + .await?; Ok(pods .into_iter() @@ -153,6 +153,7 @@ impl KubeResourceSeeker<'_> { let mut params = ListParams { label_selector: Some("app!=mirrord,!operator.metalbear.co/owner".to_string()), field_selector: field_selector.map(ToString::to_string), + limit: Some(500), ..Default::default() };