Skip to content

Commit

Permalink
refactor: skip source and exit_node in instrument for pod template an…
Browse files Browse the repository at this point in the history
…d deployment creation, add graceful termination handler
  • Loading branch information
korewaChino committed Jan 10, 2025
1 parent 03dc849 commit d22e0c3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/deployment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ pub fn generate_chisel_flags(node: &ExitNode) -> Vec<String> {
/// Returns:
///
/// a `PodTemplateSpec` object.
#[instrument]
#[instrument(skip(source, exit_node))]
pub async fn create_pod_template(
source: &Service,
exit_node: &ExitNode,
Expand Down Expand Up @@ -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,
Expand Down
10 changes: 10 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit d22e0c3

Please sign in to comment.