diff --git a/src/kube.rs b/src/kube.rs index 0d83c91..a7bde43 100644 --- a/src/kube.rs +++ b/src/kube.rs @@ -1,5 +1,6 @@ use colored::*; use rand::seq::SliceRandom; +use std::time::SystemTime; use tokio::fs::{File, OpenOptions}; use tokio::io::AsyncWriteExt; @@ -16,11 +17,11 @@ use kube_async::{ config, }; +use futures::future; use futures::stream::StreamExt; use k8s_openapi::api::core::v1::{PodSpec, PodStatus}; use once_cell::sync::OnceCell; use serde_json::Value; -use futures::future; type Pod = Object; @@ -92,10 +93,14 @@ pub struct LogRecorderConfig { /// key to search for in the json, prints out the value. Only single key supported #[structopt(long)] json_key: Option, - + /// Dont follow the logs, but gather all of them at once #[structopt(long)] gather: bool, + + /// Subtract current time from this number in seconds + #[structopt(long, env = "WUFEI_TIME_SINCE")] + time_since: Option, } impl LogRecorderConfig { @@ -147,6 +152,9 @@ async fn run_cmd(pod_info: Vec) -> Result<(), Box record(file, output).await?, None => stdout(log_msg).await?, } - return Ok(()) + return Ok(()); } let mut output = current_pods.log_stream(&pod_info.name, &lp).await?.boxed();