Skip to content

Commit d22e0c3

Browse files
committed
refactor: skip source and exit_node in instrument for pod template and deployment creation, add graceful termination handler
1 parent 03dc849 commit d22e0c3

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/deployment.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ pub fn generate_chisel_flags(node: &ExitNode) -> Vec<String> {
178178
/// Returns:
179179
///
180180
/// a `PodTemplateSpec` object.
181-
#[instrument]
181+
#[instrument(skip(source, exit_node))]
182182
pub async fn create_pod_template(
183183
source: &Service,
184184
exit_node: &ExitNode,
@@ -254,7 +254,7 @@ pub async fn create_pod_template(
254254
/// Returns:
255255
///
256256
/// a `Deployment` object.
257-
#[instrument]
257+
#[instrument(skip(source, exit_node))]
258258
pub async fn create_owned_deployment(
259259
source: &Service,
260260
exit_node: &ExitNode,

src/main.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,15 @@ async fn main() -> Result<()> {
9797
);
9898
info!("Starting up...");
9999

100+
// Set up a handler for graceful pod termination
101+
tokio::spawn(async move {
102+
tokio::signal::unix::signal(tokio::signal::unix::SignalKind::terminate())
103+
.unwrap()
104+
.recv()
105+
.await;
106+
info!("Received termination signal, shutting down...");
107+
std::process::exit(0);
108+
});
109+
100110
daemon::run().await
101111
}

0 commit comments

Comments
 (0)