diff --git a/src/deployment.rs b/src/deployment.rs index 0b74386..d595c98 100644 --- a/src/deployment.rs +++ b/src/deployment.rs @@ -178,7 +178,7 @@ pub fn generate_chisel_flags(node: &ExitNode) -> Vec { /// Returns: /// /// a `PodTemplateSpec` object. -#[instrument] +#[instrument(skip(source, exit_node))] pub async fn create_pod_template( source: &Service, exit_node: &ExitNode, @@ -254,7 +254,7 @@ pub async fn create_pod_template( /// Returns: /// /// a `Deployment` object. -#[instrument] +#[instrument(skip(source, exit_node))] pub async fn create_owned_deployment( source: &Service, exit_node: &ExitNode, diff --git a/src/main.rs b/src/main.rs index 5d804a6..e842f84 100644 --- a/src/main.rs +++ b/src/main.rs @@ -97,5 +97,15 @@ async fn main() -> Result<()> { ); info!("Starting up..."); + // Set up a handler for graceful pod termination + tokio::spawn(async move { + tokio::signal::unix::signal(tokio::signal::unix::SignalKind::terminate()) + .unwrap() + .recv() + .await; + info!("Received termination signal, shutting down..."); + std::process::exit(0); + }); + daemon::run().await }