pub async fn mass_diff(conf: &Config, reg: &Region) -> Result<()> {
    let svcs = shipcat_filebacked::available(conf, reg).await?;
    assert!(conf.has_secrets());

    let mut buffered = stream::iter(svcs)
        .map(move |mf| diff_summary(mf.base.name, &conf, &reg))
        .buffer_unordered(10);

    let mut errs = vec![];
    let mut diffs = vec![];
    while let Some(r) = buffered.next().await {
        match r {
            Ok(dr) => diffs.push(dr),
            Err(e) => errs.push(e),
        }
    }
    for dr in diffs {
        if let Some(diff) = dr.diff {
            info!("{} diff output:\n{}", dr.name, diff);
        } else {
            info!("{} unchanged", dr.name)
        }
    }
    if !errs.is_empty() {
        for e in &errs {
            match e {
                Error(ErrorKind::KubeError(e2), _) => {
                    warn!("{}", e2); // probably missing service (undiffeable)
                }
                Error(ErrorKind::MissingRollingVersion(svc), _) => {
                    // This only happens in rolling envs because version is mandatory in other envs
                    warn!("ignored missing service {}: {}", svc, e.description());
                }
                _ => {
                    error!("{}", e);
                    debug!("{:?}", e);
                }
            }
        }
        bail!("Failed to diff {} manifests", errs.len());
    }
    Ok(())
}
/// Diffs all services in a region
///
/// Helper that shells out to kubectl diff in parallel.
Diffs all services in a region
Helper that shells out to kubectl diff in parallel.
Diffs all services in a region Helper that shells out to kubectl diff in parallel .
pub async fn mass_diff(conf: &Config, reg: &Region) -> Result<()> {
    let svcs = shipcat_filebacked::available(conf, reg).await?;
    assert!(conf.has_secrets());
    let mut buffered = stream::iter(svcs)
        .map(move |mf| diff_summary(mf.base.name, &conf, &reg))
        .buffer_unordered(10);
    let mut errs = vec![];
    let mut diffs = vec![];
    while let Some(r) = buffered.next().await {
        match r {
            Ok(dr) => diffs.push(dr),
            Err(e) => errs.push(e),
        }
    }
    for dr in diffs {
        if let Some(diff) = dr.diff {
            info!("{} diff output:\n{}", dr.name, diff);
        } else {
            info!("{} unchanged", dr.name)
        }
    }
    if !errs.is_empty() {
        for e in &errs {
            match e {
                Error(ErrorKind::KubeError(e2), _) => {
                    warn!("{}", e2); // probably missing service (undiffeable)
                }
                Error(ErrorKind::MissingRollingVersion(svc), _) => {
                    // This only happens in rolling envs because version is mandatory in other envs
                    warn!("ignored missing service {}: {}", svc, e.description());
                }
                _ => {
                    error!("{}", e);
                    debug!("{:?}", e);
                }
            }
        }
        bail!("Failed to diff {} manifests", errs.len());
    }
    Ok(())
}
pub async fn mass_diff ( conf : & Config , reg : & Region ) -> Result < ( ) > { let svcs = shipcat_filebacked :: available ( conf , reg ) . await ? ; assert ! ( conf has_secrets ( ) ) ; let mut buffered = stream :: iter ( svcs ) . map ( move | mf | diff_summary ( mf . base . name , & conf , & reg ) ) . buffer_unordered ( 10 ) ; let mut errs = vec ! [ ] ; let mut diffs = vec ! [ ] ; while let Some ( r ) = buffered . next ( ) . await { match r { Ok ( dr ) => diffs . push ( dr ) , Err ( e ) => errs . push ( e ) , } } for dr in diffs { if let Some ( diff ) = dr . diff { info ! ( " \n " dr name diff ) ; } else { info ! ( " " dr name ) } } if ! errs . is_empty ( ) { for e in & errs { match e { Error ( ErrorKind :: KubeError ( e2 ) , _ ) => { warn ! ( " " e2 ) ; // probably missing service (undiffeable) } Error ( ErrorKind :: MissingRollingVersion ( svc ) , _ ) => { // This only happens in rolling envs because version is mandatory in other envs warn ! ( " " svc e description ( ) ) ; } _ => { error ! ( " " e ) ; debug ! ( " " e ) ; } } } bail ! ( " " errs len ( ) ) ; } Ok ( ( ) ) }
Diffs all services in a region
Helper that shells out to kubectl diff in parallel.
Diffs all services in a region Helper that shells out to kubectl diff in parallel .
conf
&Config
reg
&Region
conf
&Config
reg
&Region