From cb5d18011b95ea5a88a78109a71222006118b02b Mon Sep 17 00:00:00 2001 From: SeongChan Lee Date: Mon, 12 Aug 2024 18:31:44 +0900 Subject: [PATCH 1/2] Fix report level --- src/webhooks/report.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/webhooks/report.rs b/src/webhooks/report.rs index d0b6d20..755d754 100644 --- a/src/webhooks/report.rs +++ b/src/webhooks/report.rs @@ -1,10 +1,9 @@ use k8s_openapi::api::core::v1::{ObjectReference, Pod}; use kube::runtime::events::{Event, EventType, Recorder}; use kube::Resource; -use tracing::{debug, enabled, info, Level}; +use tracing::{debug, event_enabled, info, warn, Level}; use crate::webhooks::AppState; - async fn report( state: &AppState, reference: ObjectReference, @@ -52,7 +51,7 @@ pub async fn debug_report_for_ref( reason: &str, note: String, ) { - if !enabled!(Level::DEBUG) { + if !event_enabled!(Level::DEBUG) { return; } @@ -77,16 +76,16 @@ pub async fn warn_report_for_ref( reason: &str, note: String, ) { - if !enabled!(Level::WARN) { + if !event_enabled!(Level::WARN) { return; } - info!(action, reason, note); + warn!(action, reason, note); report(state, object_ref, EventType::Warning, action, reason, note).await; } pub async fn report_for(state: &AppState, pod: &Pod, action: &str, reason: &str, note: String) { - if !enabled!(Level::INFO) { + if !event_enabled!(Level::INFO) { return; } From fd6af4c9ec8b9d00fbad391ec1d9946d86497c79 Mon Sep 17 00:00:00 2001 From: SeongChan Lee Date: Mon, 12 Aug 2024 18:37:55 +0900 Subject: [PATCH 2/2] Update version to v0.1.0-rc.3 --- Cargo.lock | 2 +- Cargo.toml | 2 +- charts/pod-graceful-drain/Chart.yaml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f24da1b..999cb79 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1720,7 +1720,7 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pod-graceful-drain" -version = "0.1.0-rc.2" +version = "0.1.0-rc.3" dependencies = [ "anyhow", "async-shutdown", diff --git a/Cargo.toml b/Cargo.toml index 0c99142..01a5f1c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "pod-graceful-drain" description = "You don't need `lifecycle: { preStop: { exec: { command: [\"sleep\", \"30\"] } } }`" authors = ["SeongChan Lee "] -version = "0.1.0-rc.2" +version = "0.1.0-rc.3" edition = "2021" rust-version = "1.79" diff --git a/charts/pod-graceful-drain/Chart.yaml b/charts/pod-graceful-drain/Chart.yaml index 53492aa..a8a2e45 100644 --- a/charts/pod-graceful-drain/Chart.yaml +++ b/charts/pod-graceful-drain/Chart.yaml @@ -3,5 +3,5 @@ name: pod-graceful-drain description: | You don't need `lifecycle: { preStop: { exec: { command: ["sleep", "30"] } } }` type: application -version: 0.1.0-rc.2 -appVersion: "v0.1.0-rc.2" +version: 0.1.0-rc.3 +appVersion: "v0.1.0-rc.3"