From 9945359101bcd657730a2d0d7f485b6e4e8b0d21 Mon Sep 17 00:00:00 2001 From: Donal Byrne Date: Sun, 4 Aug 2024 08:19:31 +0200 Subject: [PATCH] Suffix pod cron with .c Small cleanup --- src/executor.rs | 1 + src/refresh.rs | 9 +++++---- src/scheduler.rs | 1 - 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/executor.rs b/src/executor.rs index 5fba599..cadaea8 100644 --- a/src/executor.rs +++ b/src/executor.rs @@ -81,6 +81,7 @@ impl DefaultExecutor { let mut pod = Pod::default(); pod.spec = pod_template_spec.spec; pod.metadata = cron_job.metadata.clone(); + pod.metadata.name = Some(format!("{}.c", ns_name.to_string())); let mut_spec = pod.spec.as_mut().unwrap(); mut_spec.restart_policy = Some("Never".to_string()); diff --git a/src/refresh.rs b/src/refresh.rs index 5ff38e7..c5be668 100644 --- a/src/refresh.rs +++ b/src/refresh.rs @@ -38,17 +38,18 @@ pub async fn refresh(args: RefreshArgs) -> Result<(), Box> { let state = refreshed_state(&cluster.name, &clients, &config).await.expect("failed to refresh state"); for node in &(state.nodes) { - match node.status { + let emoji = match node.status { NodeStatus::Unhealthy => { - println!("node {} {} - {} ", node.node_name, node.status, CROSS_EMOJI) + CROSS_EMOJI } NodeStatus::Healthy => { - println!("node {} {} - {} ", node.node_name, node.status, CHECKBOX_EMOJI) + CHECKBOX_EMOJI } NodeStatus::Unknown => { - println!("node {} {} - {} ", node.node_name, node.status, '?') + ' ' } }; + println!("node {} {} - {} ", node.node_name, node.status, emoji) } state.persist() diff --git a/src/scheduler.rs b/src/scheduler.rs index 11e8050..d1d7c89 100644 --- a/src/scheduler.rs +++ b/src/scheduler.rs @@ -215,7 +215,6 @@ impl DefaultScheduler { let mut labels = meta.labels.unwrap_or_default(); labels.insert("skate.io/deployment".to_string(), d.metadata.name.as_ref().unwrap().clone()); labels.insert("skate.io/replica".to_string(), i.to_string()); - meta.labels = Some(labels.clone()); meta.labels = Some(labels); let pod = Pod {