diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d91143b..b83109ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ All notable changes to this project will be documented in this file. ### Changed +- Gracefully shutdown all concurrent tasks by forwarding the SIGTERM signal ([#674]). - OLM deployer doesn't add owner references to cluster scoped objects anymore ([#667]). Owner references ensure that objects are garbage collected by OpenShift upon operator removal but they cause problems when the operator is updated. This means that cluster wide objects are not removed anymore when the operator is uninstalled. @@ -36,6 +37,7 @@ All notable changes to this project will be documented in this file. [#667]: https://github.com/stackabletech/secret-operator/pull/667 [#670]: https://github.com/stackabletech/secret-operator/pull/670 [#671]: https://github.com/stackabletech/secret-operator/pull/671 +[#674]: https://github.com/stackabletech/secret-operator/pull/674 ## [25.11.0] - 2025-11-07 diff --git a/Cargo.lock b/Cargo.lock index a1cbbc5a..ac54b2b8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1678,7 +1678,7 @@ dependencies = [ [[package]] name = "k8s-version" version = "0.1.3" -source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.101.2#13cf69454684ccf105d7377ca369d62b7b07250c" +source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.105.0#7bfcac5f6515c8b4c8cf8def2edfde5ed8621aaa" dependencies = [ "darling 0.23.0", "regex", @@ -2650,7 +2650,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac6c3320f9abac597dcbc668774ef006702672474aad53c6d596b62e487b40b1" dependencies = [ "heck", - "itertools 0.14.0", + "itertools 0.13.0", "log", "multimap", "once_cell", @@ -2672,7 +2672,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d" dependencies = [ "anyhow", - "itertools 0.14.0", + "itertools 0.13.0", "proc-macro2", "quote", "syn 2.0.107", @@ -2685,7 +2685,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9120690fafc389a67ba3803df527d0ec9cbbc9cc45e4cc20b332996dfb672425" dependencies = [ "anyhow", - "itertools 0.14.0", + "itertools 0.13.0", "proc-macro2", "quote", "syn 2.0.107", @@ -3394,7 +3394,7 @@ checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" [[package]] name = "stackable-certs" version = "0.4.0" -source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.101.2#13cf69454684ccf105d7377ca369d62b7b07250c" +source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.105.0#7bfcac5f6515c8b4c8cf8def2edfde5ed8621aaa" dependencies = [ "const-oid", "ecdsa", @@ -3437,8 +3437,8 @@ dependencies = [ [[package]] name = "stackable-operator" -version = "0.101.2" -source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.101.2#13cf69454684ccf105d7377ca369d62b7b07250c" +version = "0.105.0" +source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.105.0#7bfcac5f6515c8b4c8cf8def2edfde5ed8621aaa" dependencies = [ "chrono", "clap", @@ -3463,7 +3463,7 @@ dependencies = [ "snafu 0.8.9", "stackable-operator-derive", "stackable-shared", - "stackable-telemetry 0.6.1 (git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.101.2)", + "stackable-telemetry 0.6.1 (git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.105.0)", "stackable-versioned", "stackable-webhook", "strum", @@ -3477,7 +3477,7 @@ dependencies = [ [[package]] name = "stackable-operator-derive" version = "0.3.1" -source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.101.2#13cf69454684ccf105d7377ca369d62b7b07250c" +source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.105.0#7bfcac5f6515c8b4c8cf8def2edfde5ed8621aaa" dependencies = [ "darling 0.23.0", "proc-macro2", @@ -3558,7 +3558,7 @@ dependencies = [ [[package]] name = "stackable-shared" version = "0.0.3" -source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.101.2#13cf69454684ccf105d7377ca369d62b7b07250c" +source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.105.0#7bfcac5f6515c8b4c8cf8def2edfde5ed8621aaa" dependencies = [ "chrono", "k8s-openapi", @@ -3575,7 +3575,7 @@ dependencies = [ [[package]] name = "stackable-telemetry" version = "0.6.1" -source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.101.2#13cf69454684ccf105d7377ca369d62b7b07250c" +source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.105.0#7bfcac5f6515c8b4c8cf8def2edfde5ed8621aaa" dependencies = [ "axum", "clap", @@ -3623,7 +3623,7 @@ dependencies = [ [[package]] name = "stackable-versioned" version = "0.8.3" -source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.101.2#13cf69454684ccf105d7377ca369d62b7b07250c" +source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.105.0#7bfcac5f6515c8b4c8cf8def2edfde5ed8621aaa" dependencies = [ "schemars", "serde", @@ -3636,7 +3636,7 @@ dependencies = [ [[package]] name = "stackable-versioned-macros" version = "0.8.3" -source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.101.2#13cf69454684ccf105d7377ca369d62b7b07250c" +source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.105.0#7bfcac5f6515c8b4c8cf8def2edfde5ed8621aaa" dependencies = [ "convert_case", "darling 0.23.0", @@ -3652,8 +3652,8 @@ dependencies = [ [[package]] name = "stackable-webhook" -version = "0.8.1" -source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.101.2#13cf69454684ccf105d7377ca369d62b7b07250c" +version = "0.9.0" +source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.105.0#7bfcac5f6515c8b4c8cf8def2edfde5ed8621aaa" dependencies = [ "arc-swap", "async-trait", @@ -3671,7 +3671,7 @@ dependencies = [ "snafu 0.8.9", "stackable-certs", "stackable-shared", - "stackable-telemetry 0.6.1 (git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.101.2)", + "stackable-telemetry 0.6.1 (git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.105.0)", "tokio", "tokio-rustls", "tower", diff --git a/Cargo.nix b/Cargo.nix index 66f1b854..b08d3e87 100644 --- a/Cargo.nix +++ b/Cargo.nix @@ -3604,15 +3604,15 @@ rec { }; resolvedDefaultFeatures = [ "std" ]; }; - "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.101.2#stackable-telemetry@0.6.1" = rec { + "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.105.0#stackable-telemetry@0.6.1" = rec { crateName = "stackable-telemetry"; version = "0.6.1"; edition = "2024"; workspace_member = null; src = pkgs.fetchgit { url = "https://github.com/stackabletech/operator-rs.git"; - rev = "13cf69454684ccf105d7377ca369d62b7b07250c"; - sha256 = "09nmd5pqrmc49dzm7y26qlh1np528d9xq4q8vm4d04sd8z9rd46j"; + rev = "7bfcac5f6515c8b4c8cf8def2edfde5ed8621aaa"; + sha256 = "02z7c2kjhcwg153j74n52wwcr5x0z70hc21hlsrxyclmc8ps1lmd"; }; libName = "stackable_telemetry"; authors = [ @@ -5270,6 +5270,7 @@ rec { "default" = [ "use_std" ]; "use_std" = [ "use_alloc" "either/use_std" ]; }; + resolvedDefaultFeatures = [ "default" "use_alloc" "use_std" ]; }; "itertools 0.14.0" = rec { crateName = "itertools"; @@ -5546,8 +5547,8 @@ rec { workspace_member = null; src = pkgs.fetchgit { url = "https://github.com/stackabletech/operator-rs.git"; - rev = "13cf69454684ccf105d7377ca369d62b7b07250c"; - sha256 = "09nmd5pqrmc49dzm7y26qlh1np528d9xq4q8vm4d04sd8z9rd46j"; + rev = "7bfcac5f6515c8b4c8cf8def2edfde5ed8621aaa"; + sha256 = "02z7c2kjhcwg153j74n52wwcr5x0z70hc21hlsrxyclmc8ps1lmd"; }; libName = "k8s_version"; authors = [ @@ -9017,7 +9018,7 @@ rec { } { name = "itertools"; - packageId = "itertools 0.14.0"; + packageId = "itertools 0.13.0"; usesDefaultFeatures = false; features = [ "use_alloc" ]; } @@ -9109,7 +9110,7 @@ rec { } { name = "itertools"; - packageId = "itertools 0.14.0"; + packageId = "itertools 0.13.0"; } { name = "proc-macro2"; @@ -9147,7 +9148,7 @@ rec { } { name = "itertools"; - packageId = "itertools 0.14.0"; + packageId = "itertools 0.13.0"; } { name = "proc-macro2"; @@ -11568,8 +11569,8 @@ rec { workspace_member = null; src = pkgs.fetchgit { url = "https://github.com/stackabletech/operator-rs.git"; - rev = "13cf69454684ccf105d7377ca369d62b7b07250c"; - sha256 = "09nmd5pqrmc49dzm7y26qlh1np528d9xq4q8vm4d04sd8z9rd46j"; + rev = "7bfcac5f6515c8b4c8cf8def2edfde5ed8621aaa"; + sha256 = "02z7c2kjhcwg153j74n52wwcr5x0z70hc21hlsrxyclmc8ps1lmd"; }; libName = "stackable_certs"; authors = [ @@ -11749,13 +11750,13 @@ rec { }; "stackable-operator" = rec { crateName = "stackable-operator"; - version = "0.101.2"; + version = "0.105.0"; edition = "2024"; workspace_member = null; src = pkgs.fetchgit { url = "https://github.com/stackabletech/operator-rs.git"; - rev = "13cf69454684ccf105d7377ca369d62b7b07250c"; - sha256 = "09nmd5pqrmc49dzm7y26qlh1np528d9xq4q8vm4d04sd8z9rd46j"; + rev = "7bfcac5f6515c8b4c8cf8def2edfde5ed8621aaa"; + sha256 = "02z7c2kjhcwg153j74n52wwcr5x0z70hc21hlsrxyclmc8ps1lmd"; }; libName = "stackable_operator"; authors = [ @@ -11800,7 +11801,7 @@ rec { } { name = "stackable-telemetry"; - packageId = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.101.2#stackable-telemetry@0.6.1"; + packageId = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.105.0#stackable-telemetry@0.6.1"; optional = true; features = [ "clap" ]; } @@ -11928,8 +11929,8 @@ rec { workspace_member = null; src = pkgs.fetchgit { url = "https://github.com/stackabletech/operator-rs.git"; - rev = "13cf69454684ccf105d7377ca369d62b7b07250c"; - sha256 = "09nmd5pqrmc49dzm7y26qlh1np528d9xq4q8vm4d04sd8z9rd46j"; + rev = "7bfcac5f6515c8b4c8cf8def2edfde5ed8621aaa"; + sha256 = "02z7c2kjhcwg153j74n52wwcr5x0z70hc21hlsrxyclmc8ps1lmd"; }; procMacro = true; libName = "stackable_operator_derive"; @@ -12258,8 +12259,8 @@ rec { workspace_member = null; src = pkgs.fetchgit { url = "https://github.com/stackabletech/operator-rs.git"; - rev = "13cf69454684ccf105d7377ca369d62b7b07250c"; - sha256 = "09nmd5pqrmc49dzm7y26qlh1np528d9xq4q8vm4d04sd8z9rd46j"; + rev = "7bfcac5f6515c8b4c8cf8def2edfde5ed8621aaa"; + sha256 = "02z7c2kjhcwg153j74n52wwcr5x0z70hc21hlsrxyclmc8ps1lmd"; }; libName = "stackable_shared"; authors = [ @@ -12340,8 +12341,8 @@ rec { workspace_member = null; src = pkgs.fetchgit { url = "https://github.com/stackabletech/operator-rs.git"; - rev = "13cf69454684ccf105d7377ca369d62b7b07250c"; - sha256 = "09nmd5pqrmc49dzm7y26qlh1np528d9xq4q8vm4d04sd8z9rd46j"; + rev = "7bfcac5f6515c8b4c8cf8def2edfde5ed8621aaa"; + sha256 = "02z7c2kjhcwg153j74n52wwcr5x0z70hc21hlsrxyclmc8ps1lmd"; }; libName = "stackable_versioned"; authors = [ @@ -12384,8 +12385,8 @@ rec { workspace_member = null; src = pkgs.fetchgit { url = "https://github.com/stackabletech/operator-rs.git"; - rev = "13cf69454684ccf105d7377ca369d62b7b07250c"; - sha256 = "09nmd5pqrmc49dzm7y26qlh1np528d9xq4q8vm4d04sd8z9rd46j"; + rev = "7bfcac5f6515c8b4c8cf8def2edfde5ed8621aaa"; + sha256 = "02z7c2kjhcwg153j74n52wwcr5x0z70hc21hlsrxyclmc8ps1lmd"; }; procMacro = true; libName = "stackable_versioned_macros"; @@ -12443,13 +12444,13 @@ rec { }; "stackable-webhook" = rec { crateName = "stackable-webhook"; - version = "0.8.1"; + version = "0.9.0"; edition = "2024"; workspace_member = null; src = pkgs.fetchgit { url = "https://github.com/stackabletech/operator-rs.git"; - rev = "13cf69454684ccf105d7377ca369d62b7b07250c"; - sha256 = "09nmd5pqrmc49dzm7y26qlh1np528d9xq4q8vm4d04sd8z9rd46j"; + rev = "7bfcac5f6515c8b4c8cf8def2edfde5ed8621aaa"; + sha256 = "02z7c2kjhcwg153j74n52wwcr5x0z70hc21hlsrxyclmc8ps1lmd"; }; libName = "stackable_webhook"; authors = [ @@ -12475,7 +12476,7 @@ rec { } { name = "stackable-telemetry"; - packageId = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.101.2#stackable-telemetry@0.6.1"; + packageId = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.105.0#stackable-telemetry@0.6.1"; } { name = "hyper"; diff --git a/Cargo.toml b/Cargo.toml index e37a2bfa..02eb8d39 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ edition = "2021" repository = "https://github.com/stackabletech/secret-operator" [workspace.dependencies] -stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.101.2", features = ["time", "telemetry", "versioned", "webhook"] } +stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.105.0", features = ["time", "telemetry", "versioned", "webhook"] } krb5 = { git = "https://github.com/stackabletech/krb5-rs.git", tag = "v0.1.0" } anyhow = "1.0" @@ -56,4 +56,4 @@ yasna = "0.5" [patch."https://github.com/stackabletech/operator-rs.git"] # stackable-operator = { path = "../operator-rs/crates/stackable-operator" } -# stackable-operator = { git = "https://github.com/stackabletech//operator-rs.git", branch = "main" } +# stackable-operator = { git = "https://github.com/stackabletech//operator-rs.git", branch = "tmp/combined-shutdowns" } diff --git a/crate-hashes.json b/crate-hashes.json index 892056f1..61c8fbc3 100644 --- a/crate-hashes.json +++ b/crate-hashes.json @@ -6,15 +6,15 @@ "git+https://github.com/stackabletech/kube-rs?branch=2.0.1-fix-schema-hoisting#kube-derive@2.0.1": "1a7bcl0w1jg71jc4iml0vjp8dpzy71mhxl012grxcy2xp5i6xvgf", "git+https://github.com/stackabletech/kube-rs?branch=2.0.1-fix-schema-hoisting#kube-runtime@2.0.1": "1a7bcl0w1jg71jc4iml0vjp8dpzy71mhxl012grxcy2xp5i6xvgf", "git+https://github.com/stackabletech/kube-rs?branch=2.0.1-fix-schema-hoisting#kube@2.0.1": "1a7bcl0w1jg71jc4iml0vjp8dpzy71mhxl012grxcy2xp5i6xvgf", - "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.101.2#k8s-version@0.1.3": "09nmd5pqrmc49dzm7y26qlh1np528d9xq4q8vm4d04sd8z9rd46j", - "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.101.2#stackable-certs@0.4.0": "09nmd5pqrmc49dzm7y26qlh1np528d9xq4q8vm4d04sd8z9rd46j", - "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.101.2#stackable-operator-derive@0.3.1": "09nmd5pqrmc49dzm7y26qlh1np528d9xq4q8vm4d04sd8z9rd46j", - "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.101.2#stackable-operator@0.101.2": "09nmd5pqrmc49dzm7y26qlh1np528d9xq4q8vm4d04sd8z9rd46j", - "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.101.2#stackable-shared@0.0.3": "09nmd5pqrmc49dzm7y26qlh1np528d9xq4q8vm4d04sd8z9rd46j", - "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.101.2#stackable-telemetry@0.6.1": "09nmd5pqrmc49dzm7y26qlh1np528d9xq4q8vm4d04sd8z9rd46j", - "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.101.2#stackable-versioned-macros@0.8.3": "09nmd5pqrmc49dzm7y26qlh1np528d9xq4q8vm4d04sd8z9rd46j", - "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.101.2#stackable-versioned@0.8.3": "09nmd5pqrmc49dzm7y26qlh1np528d9xq4q8vm4d04sd8z9rd46j", - "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.101.2#stackable-webhook@0.8.1": "09nmd5pqrmc49dzm7y26qlh1np528d9xq4q8vm4d04sd8z9rd46j", + "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.105.0#k8s-version@0.1.3": "02z7c2kjhcwg153j74n52wwcr5x0z70hc21hlsrxyclmc8ps1lmd", + "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.105.0#stackable-certs@0.4.0": "02z7c2kjhcwg153j74n52wwcr5x0z70hc21hlsrxyclmc8ps1lmd", + "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.105.0#stackable-operator-derive@0.3.1": "02z7c2kjhcwg153j74n52wwcr5x0z70hc21hlsrxyclmc8ps1lmd", + "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.105.0#stackable-operator@0.105.0": "02z7c2kjhcwg153j74n52wwcr5x0z70hc21hlsrxyclmc8ps1lmd", + "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.105.0#stackable-shared@0.0.3": "02z7c2kjhcwg153j74n52wwcr5x0z70hc21hlsrxyclmc8ps1lmd", + "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.105.0#stackable-telemetry@0.6.1": "02z7c2kjhcwg153j74n52wwcr5x0z70hc21hlsrxyclmc8ps1lmd", + "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.105.0#stackable-versioned-macros@0.8.3": "02z7c2kjhcwg153j74n52wwcr5x0z70hc21hlsrxyclmc8ps1lmd", + "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.105.0#stackable-versioned@0.8.3": "02z7c2kjhcwg153j74n52wwcr5x0z70hc21hlsrxyclmc8ps1lmd", + "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.105.0#stackable-webhook@0.9.0": "02z7c2kjhcwg153j74n52wwcr5x0z70hc21hlsrxyclmc8ps1lmd", "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-telemetry-0.6.1#stackable-telemetry@0.6.1": "0hiymhr40ix4jv9dmvp5d009xs6v0frvllr2xkf5mw43rcg44mgd", "git+https://github.com/stackabletech/product-config.git?tag=0.8.0#product-config@0.8.0": "1dz70kapm2wdqcr7ndyjji0lhsl98bsq95gnb2lw487wf6yr7987" } \ No newline at end of file diff --git a/rust/operator-binary/src/main.rs b/rust/operator-binary/src/main.rs index 2ee55d02..f24ba855 100644 --- a/rust/operator-binary/src/main.rs +++ b/rust/operator-binary/src/main.rs @@ -22,11 +22,9 @@ use stackable_operator::{ kvp::{Label, LabelExt}, shared::yaml::SerializeOptions, telemetry::Tracing, + utils::signal::SignalWatcher, }; -use tokio::{ - signal::unix::{SignalKind, signal}, - sync::oneshot, -}; +use tokio::sync::oneshot; use tokio_stream::wrappers::UnixListenerStream; use tonic::transport::Server; use utils::{TonicUnixStream, uds_bind_private}; @@ -144,9 +142,13 @@ async fn main() -> anyhow::Result<()> { description = built_info::PKG_DESCRIPTION ); + // Watches for the SIGTERM signal and sends a signal to all receivers, which gracefully + // shuts down all concurrent tasks below (EoS checker, controller, webhook server). + let sigterm_watcher = SignalWatcher::sigterm()?; + let eos_checker = EndOfSupportChecker::new(built_info::BUILT_TIME_UTC, maintenance.end_of_support)? - .run() + .run(sigterm_watcher.handle()) .map(Ok); let client = stackable_operator::client::initialize_operator( @@ -167,8 +169,6 @@ async fn main() -> anyhow::Result<()> { let _ = std::fs::remove_file(&csi_endpoint); } - let mut sigterm = signal(SignalKind::terminate())?; - let csi_server = Server::builder() .add_service( tonic_reflection::server::Builder::configure() @@ -193,7 +193,7 @@ async fn main() -> anyhow::Result<()> { .context("failed to bind CSI listener")?, ) .map_ok(TonicUnixStream), - sigterm.recv().map(|_| ()), + sigterm_watcher.handle(), ) .map_err(|err| anyhow!(err).context("failed to run CSI server")); @@ -210,7 +210,7 @@ async fn main() -> anyhow::Result<()> { .await?; let webhook_server = webhook_server - .run() + .run(sigterm_watcher.handle()) .map_err(|err| anyhow!(err).context("failed to run webhook server")); let ca_secret_namespace = tls_secretclass_ca_secret_namespace @@ -225,8 +225,12 @@ async fn main() -> anyhow::Result<()> { anyhow!(err).context("failed to apply default custom resources") }); - let truststore_controller = - truststore_controller::start(client, &watch_namespace).map(anyhow::Ok); + let truststore_controller = truststore_controller::start( + client, + &watch_namespace, + sigterm_watcher.handle(), + ) + .map(anyhow::Ok); try_join!( truststore_controller, diff --git a/rust/operator-binary/src/truststore_controller.rs b/rust/operator-binary/src/truststore_controller.rs index 583ec163..4346646c 100644 --- a/rust/operator-binary/src/truststore_controller.rs +++ b/rust/operator-binary/src/truststore_controller.rs @@ -1,4 +1,4 @@ -use std::{collections::HashMap, sync::Arc, time::Duration}; +use std::{collections::HashMap, future::Future, sync::Arc, time::Duration}; use const_format::concatcp; use futures::StreamExt; @@ -43,7 +43,13 @@ use crate::{ const CONTROLLER_NAME: &str = "truststore"; const FULL_CONTROLLER_NAME: &str = concatcp!(CONTROLLER_NAME, ".", OPERATOR_NAME); -pub async fn start(client: stackable_operator::client::Client, watch_namespace: &WatchNamespace) { +pub async fn start( + client: stackable_operator::client::Client, + watch_namespace: &WatchNamespace, + shutdown_signal: F, +) where + F: Future + Send + Sync + 'static, +{ let (secretclasses, secretclasses_writer) = reflector::store(); let controller = Controller::new( watch_namespace.get_api::>(&client), @@ -108,6 +114,7 @@ pub async fn start(client: stackable_operator::client::Client, watch_namespace: |secretclass, secret| secretclass.spec.backend.refers_to_secret(secret), ), ) + .graceful_shutdown_on(shutdown_signal) .run(reconcile, error_policy, Arc::new(Ctx { client })) .for_each_concurrent(16, move |res| { let event_recorder = event_recorder.clone(); diff --git a/values.yaml b/values.yaml new file mode 100644 index 00000000..cfa73602 --- /dev/null +++ b/values.yaml @@ -0,0 +1,5 @@ +--- +telemetry: + consoleLog: + enabled: true + level: "info,stackable_operator=trace,stackable_webhook=trace"