diff --git a/src/main.rs b/src/main.rs index f8a1f17..346fa0c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,10 +10,10 @@ // * set the pvc storageclass instead -use std::f32::consts::E; + use std::process::ExitCode; use std::time::Duration; -use std::{future::Future, collections::BTreeMap}; +use std::{collections::BTreeMap}; use std::sync::Arc; use futures::{StreamExt,TryStreamExt}; use k8s::apimachinery::pkg::api::resource::Quantity; @@ -24,7 +24,7 @@ use anyhow::{bail, anyhow, Result}; use thiserror::Error as ThisError; use clap::{Parser as ClapParser, ArgAction}; -use tracing::{info, error, debug, trace, Level, Instrument, error_span}; +use tracing::{info, error, debug, Level, Instrument, error_span}; use tracing_subscriber::FmtSubscriber; use k8s::api::core::v1::*; @@ -204,22 +204,8 @@ impl AppContext { kco.context = context_name; Ok(kube::Client::try_from(kube::Config::from_kubeconfig(&kco).await?)?) } - fn ensure(&mut self, f: F) -> EnsureHandle - where F: Future + Send + 'static - { - let handle = tokio::runtime::Handle::current(); - let (tx, rx) = tokio::sync::oneshot::channel(); - self.ensures.push(handle.spawn(async move { - let _ = rx.await.unwrap_or_default(); // it's either unit or unit! woo - trace!("ensure handler unblocked"); - f.await; - })); - tx - } } -type EnsureHandle = tokio::sync::oneshot::Sender<()>; - impl Drop for AppContext { fn drop(&mut self) { let handle = tokio::runtime::Handle::current(); @@ -244,7 +230,7 @@ trait PodExt { impl PodExt for Pod { fn label_selectors(&self) -> Vec { let l = self.labels(); - let mut selectors = Vec::with_capacity(l.len()); + let selectors = Vec::with_capacity(l.len()); for (k,v) in l.iter() { format!("{}={}", k, v); };