pub async fn restart(mf: &Manifest, wait: bool) -> Result<()> {
    for w in &mf.workers {
        let r = Restartable {
            name: w.container.name.clone(),
            namespace: mf.namespace.clone(),
            workload: PrimaryWorkload::Deployment,
        };
        trigger_rollout_restart(r).await?; // fire-and-forget for subresources
    }
    let main = Restartable {
        name: mf.name.clone(),
        namespace: mf.namespace.clone(),
        workload: mf.workload.clone(),
    };
    trigger_rollout_restart(main).await?;
    if !wait {
        info!(
            "successfully triggered a restart of {}/{}",
            mf.workload.to_string(),
            mf.name
        );
        return Ok(());
    }
    let sk = ShipKube::new(&mf).await?;
    // wait for primary if we are waiting
    if track::workload_rollout(&mf, &sk).await? {
        info!("successfully restarted {}/{}", mf.workload.to_string(), &mf.name);
        Ok(())
    } else {
        let time = mf.estimate_wait_time();
        let reason = format!("timed out waiting {}s for rollout to restart", time);
        //let _ = kubectl::debug_rollout_status(&mf).await;
        let _ = track::debug(&mf, &sk).await;
        warn!("failed to roll out {}", &mf.name);
        warn!("{}", reason);
        Err(ErrorKind::UpgradeTimeout(mf.name.clone(), time).into())
    }
}
/// Restart the workloads associated with a shipcatmanifest
///
/// Optionally wait for the main resource
Restart the workloads associated with a shipcatmanifest
Optionally wait for the main resource
Restart the workloads associated with a shipcatmanifest Optionally wait for the main resource
pub async fn restart(mf: &Manifest, wait: bool) -> Result<()> {
    for w in &mf.workers {
        let r = Restartable {
            name: w.container.name.clone(),
            namespace: mf.namespace.clone(),
            workload: PrimaryWorkload::Deployment,
        };
        trigger_rollout_restart(r).await?; // fire-and-forget for subresources
    }
    let main = Restartable {
        name: mf.name.clone(),
        namespace: mf.namespace.clone(),
        workload: mf.workload.clone(),
    };
    trigger_rollout_restart(main).await?;
    if !wait {
        info!(
            "successfully triggered a restart of {}/{}",
            mf.workload.to_string(),
            mf.name
        );
        return Ok(());
    }
    let sk = ShipKube::new(&mf).await?;
    // wait for primary if we are waiting
    if track::workload_rollout(&mf, &sk).await? {
        info!("successfully restarted {}/{}", mf.workload.to_string(), &mf.name);
        Ok(())
    } else {
        let time = mf.estimate_wait_time();
        let reason = format!("timed out waiting {}s for rollout to restart", time);
        //let _ = kubectl::debug_rollout_status(&mf).await;
        let _ = track::debug(&mf, &sk).await;
        warn!("failed to roll out {}", &mf.name);
        warn!("{}", reason);
        Err(ErrorKind::UpgradeTimeout(mf.name.clone(), time).into())
    }
}
pub async fn restart ( mf : & Manifest , wait : bool ) -> Result < ( ) > { for w in & mf . workers { let r = Restartable { name : w . container . name . clone ( ) , namespace : mf . namespace . clone ( ) , workload : PrimaryWorkload :: Deployment , } ; trigger_rollout_restart ( r ) . await ? ; // fire-and-forget for subresources } let main = Restartable { name : mf . name . clone ( ) , namespace : mf . namespace . clone ( ) , workload : mf . workload . clone ( ) , } ; trigger_rollout_restart ( main ) . await ? ; if ! wait { info ! ( " " mf workload to_string ( ) mf name ) ; return Ok ( ( ) ) ; } let sk = ShipKube :: new ( & mf ) . await ? ; // wait for primary if we are waiting if track :: workload_rollout ( & mf , & sk ) . await ? { info ! ( " " mf workload to_string ( ) mf name ) ; Ok ( ( ) ) } else { let time = mf . estimate_wait_time ( ) ; let reason = format ! ( " " time ) ; //let _ = kubectl::debug_rollout_status(&mf).await; let _ = track :: debug ( & mf , & sk ) . await ; warn ! ( " " mf name ) ; warn ! ( " " reason ) ; Err ( ErrorKind :: UpgradeTimeout ( mf . name . clone ( ) , time ) . into ( ) ) } }
Restart the workloads associated with a shipcatmanifest
Optionally wait for the main resource
Restart the workloads associated with a shipcatmanifest Optionally wait for the main resource
mf
&Manifest
wait
bool
mf
&Manifest
wait
bool