Skip to content

Commit

Permalink
Make mirrord ls not list in parallel (#2725)
Browse files Browse the repository at this point in the history
* Update kube_seeker to be sequential

* Changelog

* Ops

* Update changelog

* Add default hardcodec chunk-size of 500

* Ops
  • Loading branch information
DmitryDodzin authored Sep 4, 2024
1 parent 08de79f commit c3bea39
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
1 change: 1 addition & 0 deletions changelog.d/2724.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix mirrord ls hanging by making so `KubeResourceSeeker` will list different kinds of resources sequentially instead of in parallel.
27 changes: 14 additions & 13 deletions mirrord/kube/src/api/kubernetes/seeker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Vec<String>> {
let (pods, deployments, rollouts) = futures::try_join!(
self.pods(),
self.deployments(),
self.simple_list_resource::<Rollout>("rollout")
)?;
let pods = self.pods().await?;
let deployments = self.deployments().await?;
let rollouts = self.simple_list_resource::<Rollout>("rollout").await?;

Ok(pods
.into_iter()
Expand All @@ -46,14 +44,16 @@ impl KubeResourceSeeker<'_> {
/// Returns all resource types ie. [`Pod`], [`Deployment`], [`Rollout`], [`Job`], [`CronJob`],
/// and [`StatefulSet`]
pub async fn all(&self) -> Result<Vec<String>> {
let (pods, deployments, rollouts, jobs, cronjobs, statefulsets) = futures::try_join!(
self.pods(),
self.simple_list_resource::<Deployment>("deployment"),
self.simple_list_resource::<Rollout>("rollout"),
self.simple_list_resource::<Job>("job"),
self.simple_list_resource::<CronJob>("cronjob"),
self.simple_list_resource::<StatefulSet>("statefulset"),
)?;
let pods = self.pods().await?;
let deployments = self
.simple_list_resource::<Deployment>("deployment")
.await?;
let rollouts = self.simple_list_resource::<Rollout>("rollout").await?;
let jobs = self.simple_list_resource::<Job>("job").await?;
let cronjobs = self.simple_list_resource::<CronJob>("cronjob").await?;
let statefulsets = self
.simple_list_resource::<StatefulSet>("statefulset")
.await?;

Ok(pods
.into_iter()
Expand Down Expand Up @@ -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()
};

Expand Down

0 comments on commit c3bea39

Please sign in to comment.