From a503225e1cf685b7e629421674619cfe080d4b67 Mon Sep 17 00:00:00 2001 From: Siegfried Weber Date: Fri, 7 May 2021 17:29:08 +0200 Subject: [PATCH 01/13] dbus replaced with zbus --- Cargo.lock | 284 +++++++++++++-- Cargo.toml | 7 +- README.adoc | 8 +- src/provider/mod.rs | 6 +- src/provider/systemdmanager/manager.rs | 179 +++------- src/provider/systemdmanager/mod.rs | 1 + src/provider/systemdmanager/systemd1_api.rs | 373 ++++++++++++++++++++ src/provider/systemdmanager/systemdunit.rs | 7 +- 8 files changed, 706 insertions(+), 159 deletions(-) create mode 100644 src/provider/systemdmanager/systemd1_api.rs diff --git a/Cargo.lock b/Cargo.lock index d065b92..b5e9c1d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -77,6 +77,35 @@ dependencies = [ "tokio 1.5.0", ] +[[package]] +name = "async-io" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bbfd5cf2794b1e908ea8457e6c45f8f8f1f6ec5f74617bf4662623f47503c3b" +dependencies = [ + "concurrent-queue", + "fastrand", + "futures-lite", + "libc", + "log", + "once_cell", + "parking", + "polling", + "slab", + "socket2", + "waker-fn", + "winapi 0.3.9", +] + +[[package]] +name = "async-lock" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6a8ea61bf9947a1007c5cada31e647dbc77b103c679858150003ba697ea798b" +dependencies = [ + "event-listener", +] + [[package]] name = "async-stream" version = "0.3.0" @@ -267,6 +296,12 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" +[[package]] +name = "cache-padded" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "631ae5198c9be5e753e5cc215e1bd73c2b466a3565173db433f52bb9d3e66dba" + [[package]] name = "cc" version = "1.0.67" @@ -315,6 +350,15 @@ dependencies = [ "vec_map", ] +[[package]] +name = "concurrent-queue" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30ed07550be01594c6026cff2a1d7fe9c8f683caa798e12b68694ac9e88286a3" +dependencies = [ + "cache-padded", +] + [[package]] name = "const_fn" version = "0.4.6" @@ -399,16 +443,6 @@ dependencies = [ "num_cpus", ] -[[package]] -name = "dbus" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f597e08dfa79b593f23bbfc7840b23b2c5aa2e3a98d8e68b67b5b9ff800dc0db" -dependencies = [ - "libc", - "libdbus-sys", -] - [[package]] name = "derivative" version = "2.2.0" @@ -518,6 +552,27 @@ dependencies = [ "cfg-if 1.0.0", ] +[[package]] +name = "enumflags2" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83c8d82922337cd23a15f88b70d8e4ef5f11da38dd7cdb55e84dd5de99695da0" +dependencies = [ + "enumflags2_derive", + "serde", +] + +[[package]] +name = "enumflags2_derive" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "946ee94e3dbf58fdd324f9ce245c7b238d46a66f00e86a020b71996349e46cce" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "env_logger" version = "0.7.1" @@ -544,12 +599,27 @@ dependencies = [ "termcolor", ] +[[package]] +name = "event-listener" +version = "2.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7531096570974c3a9dcf9e4b8e1cede1ec26cf5046219fb3b9d897503b9be59" + [[package]] name = "fake-simd" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" +[[package]] +name = "fastrand" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77b705829d1e87f762c2df6da140b26af5839e1033aa84aa5f56bb688e4e1bdb" +dependencies = [ + "instant", +] + [[package]] name = "filetime" version = "0.2.14" @@ -727,6 +797,21 @@ version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d71c2c65c57704c32f5241c1223167c2c3294fd34ac020c807ddbe6db287ba59" +[[package]] +name = "futures-lite" +version = "1.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4481d0cd0de1d204a4fa55e7d45f07b1d958abcb06714b3446438e2eff695fb" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite 0.2.6", + "waker-fn", +] + [[package]] name = "futures-macro" version = "0.3.13" @@ -894,6 +979,12 @@ dependencies = [ "libc", ] +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + [[package]] name = "hostname" version = "0.3.1" @@ -1090,6 +1181,15 @@ dependencies = [ "bytes 1.0.1", ] +[[package]] +name = "instant" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec" +dependencies = [ + "cfg-if 1.0.0", +] + [[package]] name = "iovec" version = "0.1.4" @@ -1365,15 +1465,6 @@ version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8916b1f6ca17130ec6568feccee27c156ad12037880833a3b842a823236502e7" -[[package]] -name = "libdbus-sys" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc12a3bc971424edbbf7edaf6e5740483444db63aa8e23d3751ff12a30f306f0" -dependencies = [ - "pkg-config", -] - [[package]] name = "libsystemd-sys" version = "0.8.0" @@ -1566,6 +1657,18 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "nix" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2ccba0cfe4fdf15982d1674c69b1fd80bad427d293849982668dfe454bd61f2" +dependencies = [ + "bitflags", + "cc", + "cfg-if 1.0.0", + "libc", +] + [[package]] name = "nix" version = "0.20.0" @@ -1714,6 +1817,12 @@ dependencies = [ "num-traits", ] +[[package]] +name = "parking" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" + [[package]] name = "pem" version = "0.8.3" @@ -1854,12 +1963,34 @@ version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" +[[package]] +name = "polling" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fc12d774e799ee9ebae13f4076ca003b40d18a11ac0f3641e6f899618580b7b" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "log", + "wepoll-sys", + "winapi 0.3.9", +] + [[package]] name = "ppv-lite86" version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" +[[package]] +name = "proc-macro-crate" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" +dependencies = [ + "toml", +] + [[package]] name = "proc-macro-error" version = "1.0.4" @@ -2466,6 +2597,17 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_repr" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dc6b7951b17b051f3210b063f12cc17320e2fe30ae05b0fe2a3abb068551c76" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "serde_urlencoded" version = "0.7.0" @@ -2558,6 +2700,15 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" +[[package]] +name = "slotmap" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "585cd5dffe4e9e06f6dfdf66708b70aca3f781bed561f4f667b2d9c0d4559e36" +dependencies = [ + "version_check 0.9.3", +] + [[package]] name = "smallvec" version = "1.6.1" @@ -2607,9 +2758,10 @@ checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" name = "stackable-agent" version = "0.1.0-nightly" dependencies = [ + "Inflector", "anyhow", "async-trait", - "dbus", + "byteorder", "env_logger 0.8.3", "flate2", "handlebars", @@ -2621,7 +2773,7 @@ dependencies = [ "kubelet", "lazy_static", "log", - "nix", + "nix 0.20.0", "oci-distribution", "regex", "reqwest", @@ -2640,6 +2792,8 @@ dependencies = [ "thiserror", "tokio 1.5.0", "url 2.2.1", + "zbus", + "zvariant", ] [[package]] @@ -3077,6 +3231,15 @@ dependencies = [ "tokio 1.5.0", ] +[[package]] +name = "toml" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" +dependencies = [ + "serde", +] + [[package]] name = "tonic" version = "0.4.1" @@ -3383,6 +3546,12 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" +[[package]] +name = "waker-fn" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" + [[package]] name = "walkdir" version = "2.3.2" @@ -3534,6 +3703,15 @@ dependencies = [ "untrusted", ] +[[package]] +name = "wepoll-sys" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fcb14dea929042224824779fbc82d9fab8d2e6d3cbc0ac404de8edf489e77ff" +dependencies = [ + "cc", +] + [[package]] name = "which" version = "4.1.0" @@ -3643,3 +3821,67 @@ checksum = "0de7bff972b4f2a06c85f6d8454b09df153af7e3a4ec2aac81db1b105b684ddb" dependencies = [ "chrono", ] + +[[package]] +name = "zbus" +version = "2.0.0-beta.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e1e656194618d167524f97e88ff9bf87f2b1e8bf58f357b2a7abfdff8cc85c9" +dependencies = [ + "async-io", + "async-lock", + "byteorder", + "derivative", + "enumflags2", + "event-listener", + "futures-core", + "futures-sink", + "futures-util", + "hex", + "nix 0.19.1", + "once_cell", + "rand 0.8.3", + "scoped-tls", + "serde", + "serde_repr", + "sha1", + "slotmap", + "zbus_macros", + "zvariant", +] + +[[package]] +name = "zbus_macros" +version = "2.0.0-beta.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcd4cb372bc2cade3f2323e4104112dceb6819f5dd9afa98515b4e821d232932" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zvariant" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "678e7262502a135f49b1ece65010526649be7ee68acb80e1fc5377fc71fef878" +dependencies = [ + "byteorder", + "enumflags2", + "serde", + "zvariant_derive", +] + +[[package]] +name = "zvariant_derive" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27d7c34325a35020b94343389cc9391e0f8ac245cca9155429c4022d93141241" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] diff --git a/Cargo.toml b/Cargo.toml index 575d351..1ec04a6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ license = "Apache-2.0" # There is already a PR for cargo to allow patching of dependencies (see https://github.com/rust-lang/cargo/pull/9001). anyhow = "1.0" async-trait = "0.1" -dbus = "0.9" +byteorder = "1.4" env_logger = "0.8" flate2 = "1.0" handlebars = "3.5" @@ -21,6 +21,7 @@ k8s-openapi = { version = "0.11", default-features = false, features = ["api", " krator = { git = "https://github.com/stackabletech/krustlet.git", branch = "stackable_patches_v0.7.0" } # version = "0.2" kube = { version= "0.48", default-features = false, features = ["derive", "native-tls"] } kubelet = { git = "https://github.com/stackabletech/krustlet.git", branch = "stackable_patches_v0.7.0", default-features = true, features= ["derive", "cli"] } # version = "0.7" +Inflector = "0.11" lazy_static = "1.4" log = "0.4" nix = "0.20" @@ -35,11 +36,13 @@ shellexpand = "2.1" stackable_config = { git = "https://github.com/stackabletech/common.git", branch = "main" } strum = { version = "0.20", features = ["derive"] } strum_macros = "0.20" -systemd = { git = "https://github.com/stackabletech/rust-systemd.git", branch = "stackable_patches_v0.8.2" } +systemd = { git = "https://github.com/stackabletech/rust-systemd.git", branch = "stackable_patches_v0.8.2", default-features = false, features = ["journal"] } tar = "0.4" thiserror = "1.0" tokio = { version = "1.5", features = ["macros", "rt-multi-thread", "time"] } url = "2.2" +zbus = "2.0.0-beta.3" +zvariant = "2.6" [dev-dependencies] indoc = "1.0" diff --git a/README.adoc b/README.adoc index ffb46a3..d8784e5 100644 --- a/README.adoc +++ b/README.adoc @@ -48,12 +48,12 @@ For the build process to work these need to be installed on the build system. |Distribution |Package Names |Ubuntu -a|- libdbus-1-dev -- pkg-config -- libdbus-1-3 +a|- pkg-config +- libsystemd-dev |Centos -a|- dbus-devel +a|- pkg-config +- libsystemd-dev |=== diff --git a/src/provider/mod.rs b/src/provider/mod.rs index 212ce67..93607a9 100644 --- a/src/provider/mod.rs +++ b/src/provider/mod.rs @@ -28,7 +28,7 @@ use crate::provider::states::pod::terminated::Terminated; use crate::provider::states::pod::PodState; use crate::provider::systemdmanager::manager::SystemdManager; use kube::error::ErrorResponse; -use std::{collections::HashMap, time::Duration}; +use std::collections::HashMap; use systemdmanager::journal_reader; pub struct StackableProvider { @@ -44,7 +44,7 @@ pub const CRDS: &[&str] = &["repositories.stable.stackable.de"]; mod error; mod repository; mod states; -mod systemdmanager; +pub mod systemdmanager; /// Provider-level state shared between all pods #[derive(Clone)] @@ -176,7 +176,7 @@ impl StackableProvider { session: bool, pod_cidr: String, ) -> Result { - let systemd_manager = Arc::new(SystemdManager::new(session, Duration::from_secs(5))?); + let systemd_manager = Arc::new(SystemdManager::new(session)?); let provider_state = ProviderState { handles: Default::default(), diff --git a/src/provider/systemdmanager/manager.rs b/src/provider/systemdmanager/manager.rs index 918a5ef..2c443cd 100644 --- a/src/provider/systemdmanager/manager.rs +++ b/src/provider/systemdmanager/manager.rs @@ -3,20 +3,17 @@ //! The module offers the ability to create, remove, start, stop, enable and //! disable systemd units. //! +use super::systemd1_api::{ActiveState, ManagerProxy, StartMode, StopMode}; use crate::provider::systemdmanager::systemdunit::SystemDUnit; use crate::provider::StackableError; use crate::provider::StackableError::RuntimeError; use anyhow::anyhow; -use dbus::arg::{AppendAll, Get, ReadAll, RefArg, Variant}; -use dbus::blocking::SyncConnection; -use dbus::strings::Member; -use dbus::Path; use log::debug; use std::fs; use std::fs::File; use std::io::Write; use std::path::PathBuf; -use std::time::Duration; +use zbus::Connection; /// Enum that lists the supported unit types #[derive(Clone, Debug, Eq, PartialEq)] @@ -24,19 +21,13 @@ pub enum UnitTypes { Service, } -const SYSTEMD_DESTINATION: &str = "org.freedesktop.systemd1"; -const SYSTEMD_NODE: &str = "/org/freedesktop/systemd1"; -const SYSTEMD_MANAGER_INTERFACE: &str = "org.freedesktop.systemd1.Manager"; -const DBUS_PROPERTIES_INTERFACE: &str = "org.freedesktop.DBus.Properties"; - /// The main way of interacting with this module, this struct offers /// the public methods for managing service units. /// /// Use [`SystemdManager::new`] to create a new instance. pub struct SystemdManager { units_directory: PathBuf, - connection: SyncConnection, //TODO does this need to be closed? - timeout: Duration, + proxy: ManagerProxy<'static>, user_mode: bool, // TODO Use the same naming (user_mode or session_mode) everywhere } @@ -46,24 +37,24 @@ impl Default for SystemdManager { fn default() -> Self { // If this panics we broke something in the code, as this is all constant values that // should work - SystemdManager::new(false, Duration::from_secs(5)).unwrap() + SystemdManager::new(false).unwrap() } } impl SystemdManager { - /// Create a new instance, takes a flag whether to run within the user session or manage services - /// system-wide and a timeout value for dbus communications. - pub fn new(user_mode: bool, timeout: Duration) -> Result { + /// Creates a new instance, takes a flag whether to run within the + /// user session or manage services system-wide. + pub fn new(user_mode: bool) -> Result { // Connect to session or system bus depending on the value of [user_mode] let connection = if user_mode { - SyncConnection::new_session().map_err(|e| RuntimeError { + Connection::new_session().map_err(|e| RuntimeError { msg: format!( "Could not create a connection to the systemd session bus: {}", e ), })? } else { - SyncConnection::new_system().map_err(|e| RuntimeError { + Connection::new_system().map_err(|e| RuntimeError { msg: format!( "Could not create a connection to the systemd system-wide bus: {}", e @@ -71,6 +62,9 @@ impl SystemdManager { })? }; + let proxy = + ManagerProxy::new(&connection).map_err(|e| RuntimeError { msg: e.to_string() })?; + // Depending on whether we are supposed to run in user space or system-wide // we'll pick the default directory to initialize the systemd manager with // This allows creating unit files either directly in the systemd folder by @@ -84,8 +78,7 @@ impl SystemdManager { Ok(SystemdManager { units_directory, - connection, - timeout, + proxy, user_mode, }) } @@ -94,22 +87,8 @@ impl SystemdManager { self.user_mode } - // The main method for interacting with dbus, all other functions will delegate the actual - // dbus access to this function. - // Private on purpose as this should not be used by external dependencies - fn method_call<'m, R: ReadAll, A: AppendAll, M: Into>>( - &self, - m: M, - args: A, - ) -> Result { - let proxy = self - .connection - .with_proxy(SYSTEMD_DESTINATION, SYSTEMD_NODE, self.timeout); - proxy.method_call(SYSTEMD_MANAGER_INTERFACE, m, args) - } - // Internal helper method to remove an existing unit file or symlink - fn delete_unit_file(&self, unit: &str) -> Result<(), anyhow::Error> { + fn delete_unit_file(&self, unit: &str) -> anyhow::Result<()> { let unit_file = self.units_directory.clone().join(&unit); debug!("Removing [{:?}]", unit_file); @@ -146,7 +125,7 @@ impl SystemdManager { unit_file_path: Option, force: bool, daemon_reload: bool, - ) -> Result<(), anyhow::Error> { + ) -> anyhow::Result<()> { // Appends .service to name if necessary let linked_unit_file = unit_file_path.is_some(); let unit_name = SystemdManager::get_unit_file_name(&unit.name, &unit.unit_type)?; @@ -239,7 +218,7 @@ impl SystemdManager { /// /// Calling this function means an implicit disabling of the service, if it was enabled. /// - pub fn remove_unit(&self, unit: &str, daemon_reload: bool) -> Result<(), anyhow::Error> { + pub fn remove_unit(&self, unit: &str, daemon_reload: bool) -> anyhow::Result<()> { debug!("Disabling unit [{}]", unit); if let Err(disable_error) = self.disable(unit) { debug!( @@ -271,42 +250,30 @@ impl SystemdManager { /// /// For a unit file to be _known_ it needs to either be located in the systemd unit folder, or /// linked into that folder - both actions can be performed by calling [create_unit] - pub fn enable(&self, unit: &str) -> Result<(), anyhow::Error> { + pub fn enable(&self, unit: &str) -> anyhow::Result<()> { // We don't do any checking around this and simply trust the user that either the name // of an existing and linked service was provided or this is an absolute path debug!("Trying to enable systemd unit [{}]", unit); - match self - .method_call("EnableUnitFiles", (&[unit][..], false, true)) - .map(|_: ()| ()) - { - Ok(()) => { - debug!("Successfully started service [{}]", unit); + match self.proxy.enable_unit_files(&[unit], false, true) { + Ok(_) => { + debug!("Successfully enabled service [{}]", unit); Ok(()) } - Err(e) => { - debug!("Error: [{}]", e); - Err(anyhow!("Error starting service [{}]: {}", unit, e)) - } + Err(e) => Err(anyhow!("Error starting service [{}]: {}", unit, e)), } } // Disable the systemd unit - which effectively means removing the symlink from the // multi-user.target subdirectory. - pub fn disable(&self, unit: &str) -> Result, anyhow::Error> { + pub fn disable(&self, unit: &str) -> anyhow::Result<()> { debug!("Trying to disable systemd unit [{}]", unit); - match self - .method_call("DisableUnitFiles", (&[unit][..], false)) - .map(|r: (Vec<(String, String, String)>,)| r.0) - { - Ok(result) => { + match self.proxy.disable_unit_files(&[unit], false) { + Ok(_) => { debug!("Successfully disabled service [{}]", unit); - Ok(result) - } - Err(e) => { - debug!("Error: [{}]", e); - Err(anyhow!("Error disabling service [{}]: {}", unit, e)) + Ok(()) } + Err(e) => Err(anyhow!("Error disabling service [{}]: {}", unit, e)), } } @@ -314,21 +281,15 @@ impl SystemdManager { /// [unit] is expected to be the name (including .) of a service that is known to /// systemd at the time this is called. /// To make a service known please take a look at the [enable] function. - pub fn start(&self, unit: &str) -> Result<(), anyhow::Error> { + pub fn start(&self, unit: &str) -> anyhow::Result<()> { debug!("Attempting to start unit {}", unit); - match self - .method_call("StartUnit", (unit, "fail")) - .map(|r: (Path,)| r.0) - { + match self.proxy.start_unit(unit, StartMode::Fail) { Ok(result) => { - debug!("Successfully started service [{}]: [{}]", unit, result); + debug!("Successfully started service [{}]: [{:?}]", unit, result); Ok(()) } - Err(e) => { - debug!("Error: [{}]", e); - Err(anyhow!("Error starting service [{}]: {}", unit, e)) - } + Err(e) => Err(anyhow!("Error starting service [{}]: {}", unit, e)), } } @@ -336,21 +297,15 @@ impl SystemdManager { /// [unit] is expected to be the name (including .) of a service that is known to /// systemd at the time this is called. /// To make a service known please take a look at the [enable] function. - pub fn stop(&self, unit: &str) -> Result<(), anyhow::Error> { + pub fn stop(&self, unit: &str) -> anyhow::Result<()> { debug!("Trying to stop systemd unit [{}]", unit); - match self - .method_call("StopUnit", (unit, "fail")) - .map(|r: (Path,)| r.0) - { + match self.proxy.stop_unit(unit, StopMode::Fail) { Ok(result) => { - debug!("Successfully stopped service [{}]: [{}]", unit, result); + debug!("Successfully stopped service [{}]: [{:?}]", unit, result); Ok(()) } - Err(e) => { - debug!("Error: [{}]", e); - Err(anyhow!("Error stopping service [{}]: {}", unit, e)) - } + Err(e) => Err(anyhow!("Error stopping service [{}]: {}", unit, e)), } } @@ -358,82 +313,50 @@ impl SystemdManager { // discover changes that have been performed since the last reload // This needs to be done after creating a new service unit before it can be targeted by // start / stop and similar commands. - pub fn reload(&self) -> Result<(), anyhow::Error> { + pub fn reload(&self) -> anyhow::Result<()> { debug!("Performing daemon-reload.."); - match self.method_call("Reload", ()).map(|_: ()| ()) { + match self.proxy.reload() { Ok(_) => { debug!("Successfully performed daemon-reload"); Ok(()) } - Err(e) => { - debug!("Error: [{}]", e); - Err(anyhow!("Error performing daemon-reload: [{}]", e)) - } + Err(e) => Err(anyhow!("Error performing daemon-reload: [{}]", e)), } } /// Checks if the ActiveState of the given unit is set to active. pub fn is_running(&self, unit: &str) -> anyhow::Result { - self.get_value::(unit, "ActiveState") - .map(|v| v.as_str() == Some("active")) - .map_err(|dbus_error| { - anyhow!( - "Error receiving ActiveState of unit [{}]. {}", - unit, - dbus_error - ) - }) + self.proxy + .load_unit(unit)? + .active_state() + .map(|state| state == ActiveState::Active) + .map_err(|e| anyhow!("Error receiving ActiveState of unit [{}]. {}", unit, e)) } /// Retrieves the invocation ID for the given unit. pub fn get_invocation_id(&self, unit: &str) -> anyhow::Result { - self.get_value::>(unit, "InvocationID") - .map(|Variant(vec)| vec.iter().map(|byte| format!("{:02x}", byte)).collect()) - } - - /// Retrieves the value for the given property of the given unit. - pub fn get_value Get<'a>>( - &self, - unit: &str, - property: &str, - ) -> anyhow::Result> { - // We are using `LoadUnit` here, as GetUnit can fail seemingly at random, when the unit - // is not loaded due to systemd garbage collection. - // see https://github.com/systemd/systemd/issues/1929 for more information - let unit_node = self - .method_call("LoadUnit", (&unit,)) - .map(|r: (Path,)| r.0)?; - - let proxy = self - .connection - .with_proxy(SYSTEMD_DESTINATION, &unit_node, self.timeout); - - let value = proxy - .method_call( - DBUS_PROPERTIES_INTERFACE, - "Get", - ("org.freedesktop.systemd1.Unit", property), - ) - .map(|r: (Variant,)| r.0)?; - - Ok(value) + self.proxy + .load_unit(unit)? + .invocation_id() + .map(|invocation_id| invocation_id.to_string()) + .map_err(|e| anyhow!("Error receiving InvocationID of unit [{}]. {}", unit, e)) } // Symlink a unit file into the systemd unit folder // This is not public on purpose, as [create] should be the normal way to link unit files // when using this crate - fn link_unit_file(&self, unit: &str, force: bool) -> Result<(), dbus::Error> { + fn link_unit_file(&self, unit: &str, force: bool) -> anyhow::Result<()> { debug!("Linking [{}]", unit); - self.method_call("LinkUnitFiles", (&[unit][..], false, force)) - .map(|_: ()| ()) + self.proxy.link_unit_files(&[unit], false, force)?; + Ok(()) } // Check if the unit name is valid and append .service if needed // Cannot currently fail, I'll need to dig into what is a valid unit // name before adding checks #[allow(clippy::unnecessary_wraps)] - fn get_unit_file_name(name: &str, unit_type: &UnitTypes) -> Result { + fn get_unit_file_name(name: &str, unit_type: &UnitTypes) -> anyhow::Result { // TODO: what are valid systemd unit names? // Append proper extension for unit type to file name diff --git a/src/provider/systemdmanager/mod.rs b/src/provider/systemdmanager/mod.rs index 8c2df7b..31f04ce 100644 --- a/src/provider/systemdmanager/mod.rs +++ b/src/provider/systemdmanager/mod.rs @@ -1,3 +1,4 @@ pub mod journal_reader; pub mod manager; +pub mod systemd1_api; pub mod systemdunit; diff --git a/src/provider/systemdmanager/systemd1_api.rs b/src/provider/systemdmanager/systemd1_api.rs new file mode 100644 index 0000000..2f5c9c0 --- /dev/null +++ b/src/provider/systemdmanager/systemd1_api.rs @@ -0,0 +1,373 @@ +use fmt::Display; +use inflector::cases::kebabcase; +use serde::{de::Visitor, Deserialize, Serialize}; +use std::{ + convert::TryFrom, + fmt::{self, Formatter}, + str::FromStr, +}; +use strum::{AsRefStr, EnumString, EnumVariantNames, VariantNames}; +use zbus::dbus_proxy; +use zvariant::{derive::Type, OwnedValue, Signature, Type}; + +/// Type of an entry in a changes list +#[derive(Debug, EnumString, EnumVariantNames, PartialEq)] +#[strum(serialize_all = "kebab-case")] +pub enum ChangeType { + Symlink, + Unlink, +} + +impl<'de> Deserialize<'de> for ChangeType { + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + struct VariantVisitor; + + impl<'de> Visitor<'de> for VariantVisitor { + type Value = ChangeType; + + fn expecting(&self, formatter: &mut Formatter) -> fmt::Result { + write!(formatter, "Expecting one of {:?}", Self::Value::VARIANTS) + } + + fn visit_str(self, v: &str) -> Result + where + E: serde::de::Error, + { + FromStr::from_str(v).map_err(|_| E::unknown_variant(v, Self::Value::VARIANTS)) + } + } + + deserializer.deserialize_str(VariantVisitor) + } +} + +impl Type for ChangeType { + fn signature() -> Signature<'static> { + String::signature() + } +} + +/// Entry of a changes list +#[derive(Debug, Type, Deserialize)] +pub struct Change { + pub change_type: ChangeType, + pub filename: String, + pub destination: String, +} + +/// Changes list returned by functions which change unit files +type Changes = Vec; + +/// Mode in which a unit will be started +#[derive(Debug, AsRefStr)] +#[allow(dead_code)] +pub enum StartMode { + /// The unit and its dependencies will be started, possibly + /// replacing already queued jobs that conflict with it. + Replace, + + /// The unit and its dependencies will be started, but will fail if + /// this would change an already queued job. + Fail, + + /// The unit in question will be started and all units that aren't + /// dependencies of it will be terminated. + Isolate, + + /// The unit will be started but all its dependencies will be + /// ignored. + /// + /// It is not recommended to make use of this mode. + IgnoreDependencies, + + /// The unit will be started but the requirement dependencies will + /// be ignored. + /// + /// It is not recommended to make use of this mode. + IgnoreRequirements, +} + +impl Serialize for StartMode { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(&kebabcase::to_kebab_case(self.as_ref())) + } +} + +impl Type for StartMode { + fn signature() -> Signature<'static> { + String::signature() + } +} + +/// Mode in which a unit will be stopped +#[derive(Debug, AsRefStr)] +#[allow(dead_code)] +pub enum StopMode { + /// The unit and its dependencies will be stopped, possibly + /// replacing already queued jobs that conflict with it. + Replace, + + /// The unit and its dependencies will be stopped, but will fail if + /// this would change an already queued job. + Fail, + + /// The unit will be stopped but all its dependencies will be + /// ignored. + /// + /// It is not recommended to make use of this mode. + IgnoreDependencies, + + /// The unit will be stopped but the requirement dependencies will + /// be ignored. + /// + /// It is not recommended to make use of this mode. + IgnoreRequirements, +} + +impl Serialize for StopMode { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(&kebabcase::to_kebab_case(self.as_ref())) + } +} + +impl Type for StopMode { + fn signature() -> Signature<'static> { + String::signature() + } +} + +/// The manager object is the central entry point for clients. +/// +/// Currently not all methods of the systemd object are exposed. +/// +/// # Example +/// +/// ``` +/// # use stackable_agent::provider::systemdmanager::systemd1_api::ManagerProxy; +/// let connection = zbus::Connection::new_session().unwrap(); +/// let manager = ManagerProxy::new(&connection).unwrap(); +/// let unit = manager.load_unit("my_service.service").unwrap(); +/// ``` +#[dbus_proxy( + default_service = "org.freedesktop.systemd1", + interface = "org.freedesktop.systemd1.Manager", + default_path = "/org/freedesktop/systemd1" +)] +trait Manager { + /// Loads the unit from disk if possible and returns it. + #[dbus_proxy(object = "Unit")] + fn load_unit(&self, name: &str); + + /// Enqueues a start job and possibly depending jobs and returns the + /// newly created job. + #[dbus_proxy(object = "Job")] + fn start_unit(&self, name: &str, mode: StartMode); + + /// Enqueues a stop job and returns the newly created job. + #[dbus_proxy(object = "Job")] + fn stop_unit(&self, name: &str, mode: StopMode); + + /// Reloads all unit files. + fn reload(&self) -> zbus::Result<()>; + + /// Enables one or more units in the system. + /// + /// Units are enabled by creating symlinks to them in `/etc/` or + /// `/run/`. + /// + /// `files` takes a list of unit files to enable (either just file + /// names or full absolute paths if the unit files are residing + /// outside the usual unit search paths). `runtime` controls whether + /// the unit shall be enabled for runtime only (`true`, `/run/`), or + /// persistently (`false`, `/etc/`). `force` controls whether + /// symlinks pointing to other units shall be replaced if necessary. + /// + /// This method returns one boolean and an array of the changes + /// made. The boolean signals whether the unit files contained any + /// enablement information (i.e. an `[Install]`) section. + fn enable_unit_files( + &self, + files: &[&str], + runtime: bool, + force: bool, + ) -> zbus::Result<(bool, Changes)>; + + /// Disables one or more units in the system. + /// + /// All symlinks to them in `/etc/` and `/run/` are removed. + /// + /// `runtime` controls whether the unit shall be disabled for + /// runtime only (`true`, `/run/`), or persistently (`false`, + /// `/etc/`). + fn disable_unit_files(&self, files: &[&str], runtime: bool) -> zbus::Result; + + /// Links unit files (that are located outside of the usual unit + /// search paths) into the unit search path. + /// + /// `runtime` controls whether the unit shall be linked for runtime + /// only (`true`, `/run/`), or persistently (`false`, `/etc/`). + /// `force` controls whether symlinks pointing to other units shall + /// be replaced if necessary. + fn link_unit_files(&self, files: &[&str], runtime: bool, force: bool) -> zbus::Result; +} + +/// ActiveState contains a state value that reflects whether the unit is +/// currently active or not. +#[derive(Debug, EnumString, PartialEq)] +#[strum(serialize_all = "kebab-case")] +pub enum ActiveState { + /// The unit is active. + Active, + + /// The unit is active and currently reloading its configuration. + Reloading, + + /// The unit is inactive and the previous run was successful or no + /// previous run has taken place yet. + Inactive, + + /// The unit is inactive and the previous run was not successful + /// (more information about the reason for this is available on the + /// unit type specific interfaces). + Failed, + + /// The unit has previously been inactive but is currently in the + /// process of entering an active state. + Activating, + + /// The unit is currently in the process of deactivation. + Deactivating, +} + +impl TryFrom for ActiveState { + type Error = zvariant::Error; + + fn try_from(value: OwnedValue) -> Result { + FromStr::from_str(&String::try_from(value)?) + .map_err(|e: strum::ParseError| Self::Error::Message(e.to_string())) + } +} + +/// Unique ID for a runtime cycle of a unit +pub struct InvocationId(Vec); + +impl TryFrom for InvocationId { + type Error = zvariant::Error; + + fn try_from(value: OwnedValue) -> Result { + TryFrom::try_from(value).map(InvocationId) + } +} + +impl Display for InvocationId { + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + for byte in &self.0 { + write!(f, "{:02x}", byte)?; + } + Ok(()) + } +} + +/// A systemd unit object +/// +/// A [`UnitProxy`] can be retrieved e.g. by [`Manager::load_unit`]. +/// +/// Currently not all methods of the systemd object are exposed. +#[dbus_proxy( + default_service = "org.freedesktop.systemd1", + interface = "org.freedesktop.systemd1.Unit" +)] +trait Unit { + /// The active state (i.e. whether the unit is currently started or + /// not) + #[dbus_proxy(property)] + fn active_state(&self) -> zbus::Result; + + /// Unique ID for a runtime cycle of a unit + #[dbus_proxy(property, name = "InvocationID")] + fn invocation_id(&self) -> zbus::Result; +} + +/// A systemd job object +/// +/// The [`JobProxy`] is returned by various functions in [`Manager`]. +/// +/// Currently no methods of the systemd object are exposed. +#[dbus_proxy( + default_service = "org.freedesktop.systemd1", + interface = "org.freedesktop.systemd1.Job" +)] +trait Job {} + +#[cfg(test)] +mod test { + use super::*; + use byteorder::LE; + use zvariant::{EncodingContext, Value}; + + #[test] + fn deserialize_change_type() { + assert_eq!(ChangeType::Symlink, deserialize(&serialize("symlink"))); + } + + #[test] + fn serialize_start_mode() { + assert_eq!( + serialize("ignore-dependencies"), + serialize(&StartMode::IgnoreDependencies) + ); + } + + #[test] + fn serialize_stop_mode() { + assert_eq!( + serialize("ignore-dependencies"), + serialize(&StopMode::IgnoreDependencies) + ); + } + + #[test] + fn try_active_state_from_owned_value() { + assert_eq!( + ActiveState::Active, + ActiveState::try_from(OwnedValue::from(Value::from("active"))).unwrap() + ); + } + + #[test] + fn invocation_id_to_string() { + let invocation_id = InvocationId(vec![ + 0xbe, 0x44, 0xae, 0xfc, 0xa3, 0xbf, 0x46, 0xba, 0xb0, 0x4b, 0x37, 0x52, 0x09, 0x5d, + 0xd9, 0x97, + ]); + assert_eq!( + "be44aefca3bf46bab04b3752095dd997", + invocation_id.to_string() + ); + } + + fn serialize(value: &T) -> Vec + where + T: Serialize + Type, + { + let context = EncodingContext::::new_dbus(0); + zvariant::to_bytes(context, value).unwrap() + } + + fn deserialize<'a, T>(bytes: &'a [u8]) -> T + where + T: Deserialize<'a> + Type, + { + let context = EncodingContext::::new_dbus(0); + zvariant::from_slice(bytes, context).unwrap() + } +} diff --git a/src/provider/systemdmanager/systemdunit.rs b/src/provider/systemdmanager/systemdunit.rs index 7429f89..48e31fe 100644 --- a/src/provider/systemdmanager/systemdunit.rs +++ b/src/provider/systemdmanager/systemdunit.rs @@ -492,11 +492,16 @@ impl Display for SystemDUnit { mod test { use super::*; use crate::provider::test::TestPod; - use dbus::channel::BusType; use indoc::indoc; use rstest::rstest; use std::path::PathBuf; + #[derive(PartialEq)] + enum BusType { + Session, + System, + } + #[rstest] #[case::without_containers_on_system_bus( BusType::System, From 12347292c3c71097e9fa4a6ad0843b62ebc453f0 Mon Sep 17 00:00:00 2001 From: Siegfried Weber Date: Fri, 7 May 2021 17:58:37 +0200 Subject: [PATCH 02/13] Version output fixed; Changelog created --- CHANGELOG.adoc | 6 ++++++ Cargo.lock | 2 +- Cargo.toml | 4 ++-- src/config/mod.rs | 4 ++-- 4 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 CHANGELOG.adoc diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc new file mode 100644 index 0000000..05aeb8b --- /dev/null +++ b/CHANGELOG.adoc @@ -0,0 +1,6 @@ += Changelog + +== 0.1.0 - unreleased + +=== Changed +* Removed dependency to libdbus (#148). diff --git a/Cargo.lock b/Cargo.lock index b5e9c1d..803d993 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2756,7 +2756,7 @@ checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] name = "stackable-agent" -version = "0.1.0-nightly" +version = "0.1.0" dependencies = [ "Inflector", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index 1ec04a6..9a6fa04 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "stackable-agent" -description = "Tha component of the Stackable Platform that manages installation of services on the workers" -version = "0.1.0-nightly" +description = "The component of the Stackable Platform that manages installation of services on the workers" +version = "0.1.0" authors = ["Sönke Liebau "] edition = "2018" license = "Apache-2.0" diff --git a/src/config/mod.rs b/src/config/mod.rs index 38d69b8..1b513e9 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -340,8 +340,8 @@ impl Configurable for AgentConfig { fn get_config_description() -> Configuration { Configuration { name: "Stackable Agent", - version: "0.1", - about: "Manages local state according to what the central orchestrator defines.", + version: env!("CARGO_PKG_VERSION"), + about: env!("CARGO_PKG_DESCRIPTION"), options: AgentConfig::get_options(), } } From 2316c59a0090a2609a29637f39d67ab46fbc5b41 Mon Sep 17 00:00:00 2001 From: Siegfried Weber Date: Mon, 10 May 2021 09:59:09 +0200 Subject: [PATCH 03/13] Switched to AsyncManagerProxy --- CHANGELOG.adoc | 2 +- src/provider/mod.rs | 2 +- src/provider/states/pod/creating_service.rs | 2 +- src/provider/states/pod/running.rs | 2 +- src/provider/states/pod/starting.rs | 10 +-- src/provider/states/pod/terminated.rs | 6 +- src/provider/systemdmanager/journal_reader.rs | 4 +- src/provider/systemdmanager/manager.rs | 89 +++++++++---------- src/provider/systemdmanager/systemd1_api.rs | 20 ++++- src/provider/systemdmanager/systemdunit.rs | 2 +- 10 files changed, 74 insertions(+), 65 deletions(-) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 05aeb8b..ff73a3a 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -3,4 +3,4 @@ == 0.1.0 - unreleased === Changed -* Removed dependency to libdbus (#148). +* Removed dependency to libdbus ([#148]). diff --git a/src/provider/mod.rs b/src/provider/mod.rs index 93607a9..2c1e2d6 100644 --- a/src/provider/mod.rs +++ b/src/provider/mod.rs @@ -176,7 +176,7 @@ impl StackableProvider { session: bool, pod_cidr: String, ) -> Result { - let systemd_manager = Arc::new(SystemdManager::new(session)?); + let systemd_manager = Arc::new(SystemdManager::new(session).await?); let provider_state = ProviderState { handles: Default::default(), diff --git a/src/provider/states/pod/creating_service.rs b/src/provider/states/pod/creating_service.rs index da887b0..9c632c6 100644 --- a/src/provider/states/pod/creating_service.rs +++ b/src/provider/states/pod/creating_service.rs @@ -86,7 +86,7 @@ impl State for CreatingService { // Create the service // As per ADR005 we currently write the unit files directly in the systemd // unit directory (by passing None as [unit_file_path]). - match systemd_manager.create_unit(&unit, None, true, true) { + match systemd_manager.create_unit(&unit, None, true, true).await { Ok(()) => {} Err(e) => { // TODO: We need to discuss what to do here, in theory we could have loaded diff --git a/src/provider/states/pod/running.rs b/src/provider/states/pod/running.rs index e32fe84..8edb813 100644 --- a/src/provider/states/pod/running.rs +++ b/src/provider/states/pod/running.rs @@ -72,7 +72,7 @@ impl State for Running { for container_handle in containers.values() { let service_unit = &container_handle.service_unit; - match systemd_manager.is_running(&service_unit) { + match systemd_manager.is_running(&service_unit).await { Ok(true) => trace!( "Unit [{}] of service [{}] still running ...", service_unit, diff --git a/src/provider/states/pod/starting.rs b/src/provider/states/pod/starting.rs index 8a6dad2..841093a 100644 --- a/src/provider/states/pod/starting.rs +++ b/src/provider/states/pod/starting.rs @@ -65,17 +65,17 @@ async fn start_service_units( for (container_key, container_handle) in pod_handle.unwrap_or_default() { let service_unit = &container_handle.service_unit; - if systemd_manager.is_running(service_unit)? { + if systemd_manager.is_running(service_unit).await? { debug!( "Unit [{}] for service [{}] is already running. Skip startup.", service_unit, &pod_state.service_name ); } else { info!("Starting systemd unit [{}]", service_unit); - systemd_manager.start(service_unit)?; + systemd_manager.start(service_unit).await?; info!("Enabling systemd unit [{}]", service_unit); - systemd_manager.enable(service_unit)?; + systemd_manager.enable(service_unit).await?; // TODO: does this need to be configurable, or ar we happy with a hard coded value // for now. I've briefly looked at the podspec and couldn't identify a good field @@ -87,7 +87,7 @@ async fn start_service_units( await_startup(&systemd_manager, service_unit, Duration::from_secs(10)).await?; } - let invocation_id = systemd_manager.get_invocation_id(service_unit)?; + let invocation_id = systemd_manager.get_invocation_id(service_unit).await?; store_invocation_id(shared.clone(), pod_key, &container_key, &invocation_id).await?; } @@ -109,7 +109,7 @@ async fn await_startup( service_unit ); - if systemd_manager.is_running(service_unit)? { + if systemd_manager.is_running(service_unit).await? { debug!( "Service [{}] still running after [{}] seconds", service_unit, diff --git a/src/provider/states/pod/terminated.rs b/src/provider/states/pod/terminated.rs index 1b243f1..df5cb9c 100644 --- a/src/provider/states/pod/terminated.rs +++ b/src/provider/states/pod/terminated.rs @@ -41,7 +41,7 @@ impl State for Terminated { let service_unit = &container_handle.service_unit; info!("Stopping systemd unit [{}]", service_unit); - if let Err(stop_error) = systemd_manager.stop(service_unit) { + if let Err(stop_error) = systemd_manager.stop(service_unit).await { error!( "Error occurred stopping systemd unit [{}]: [{}]", service_unit, stop_error @@ -51,7 +51,7 @@ impl State for Terminated { // Daemon reload is false here, we'll do that once after all units have been removed info!("Removing systemd unit [{}]", service_unit); - if let Err(remove_error) = systemd_manager.remove_unit(service_unit, false) { + if let Err(remove_error) = systemd_manager.remove_unit(service_unit, false).await { error!( "Error occurred removing systemd unit [{}]: [{}]", service_unit, remove_error @@ -67,7 +67,7 @@ impl State for Terminated { } info!("Performing daemon-reload"); - return match systemd_manager.reload() { + return match systemd_manager.reload().await { Ok(()) => Transition::Complete(Ok(())), Err(reload_error) => { error!("Failed to perform daemon-reload: [{}]", reload_error); diff --git a/src/provider/systemdmanager/journal_reader.rs b/src/provider/systemdmanager/journal_reader.rs index a3abf82..9f19f5c 100644 --- a/src/provider/systemdmanager/journal_reader.rs +++ b/src/provider/systemdmanager/journal_reader.rs @@ -8,14 +8,14 @@ use systemd::{journal, journal::JournalRef}; /// Reads journal entries with the given invocation ID and sends the /// contained messages. /// -/// The options `tail` and `follow` in [`sender`] are taken into account. +/// The options `tail` and `follow` in `sender` are taken into account. /// /// If `tail` is set with `Some(line_count)` then only the last /// `line_count` messages (or less if not enough available) are sent /// otherwise all available messages are sent. /// /// If `follow` is `true` then additionally all new messages are sent -/// until the channel of [`sender`] is closed. In this case an +/// until the channel of `sender` is closed. In this case an /// [`Err(kubelet::log::SendError::ChannelClosed)`] will be returned. pub async fn send_messages(sender: &mut Sender, invocation_id: &str) -> Result<()> { let mut journal = journal::OpenOptions::default().open()?; diff --git a/src/provider/systemdmanager/manager.rs b/src/provider/systemdmanager/manager.rs index 2c443cd..6388c25 100644 --- a/src/provider/systemdmanager/manager.rs +++ b/src/provider/systemdmanager/manager.rs @@ -3,7 +3,7 @@ //! The module offers the ability to create, remove, start, stop, enable and //! disable systemd units. //! -use super::systemd1_api::{ActiveState, ManagerProxy, StartMode, StopMode}; +use super::systemd1_api::{ActiveState, AsyncManagerProxy, StartMode, StopMode}; use crate::provider::systemdmanager::systemdunit::SystemDUnit; use crate::provider::StackableError; use crate::provider::StackableError::RuntimeError; @@ -13,7 +13,7 @@ use std::fs; use std::fs::File; use std::io::Write; use std::path::PathBuf; -use zbus::Connection; +use zbus::azync::Connection; /// Enum that lists the supported unit types #[derive(Clone, Debug, Eq, PartialEq)] @@ -27,34 +27,24 @@ pub enum UnitTypes { /// Use [`SystemdManager::new`] to create a new instance. pub struct SystemdManager { units_directory: PathBuf, - proxy: ManagerProxy<'static>, + proxy: AsyncManagerProxy<'static>, user_mode: bool, // TODO Use the same naming (user_mode or session_mode) everywhere } -/// By default the manager will connect to the system-wide instance of systemd, -/// which requires root access to the os. -impl Default for SystemdManager { - fn default() -> Self { - // If this panics we broke something in the code, as this is all constant values that - // should work - SystemdManager::new(false).unwrap() - } -} - impl SystemdManager { /// Creates a new instance, takes a flag whether to run within the /// user session or manage services system-wide. - pub fn new(user_mode: bool) -> Result { + pub async fn new(user_mode: bool) -> Result { // Connect to session or system bus depending on the value of [user_mode] let connection = if user_mode { - Connection::new_session().map_err(|e| RuntimeError { + Connection::new_session().await.map_err(|e| RuntimeError { msg: format!( "Could not create a connection to the systemd session bus: {}", e ), })? } else { - Connection::new_system().map_err(|e| RuntimeError { + Connection::new_system().await.map_err(|e| RuntimeError { msg: format!( "Could not create a connection to the systemd system-wide bus: {}", e @@ -63,7 +53,7 @@ impl SystemdManager { }; let proxy = - ManagerProxy::new(&connection).map_err(|e| RuntimeError { msg: e.to_string() })?; + AsyncManagerProxy::new(&connection).map_err(|e| RuntimeError { msg: e.to_string() })?; // Depending on whether we are supposed to run in user space or system-wide // we'll pick the default directory to initialize the systemd manager with @@ -105,21 +95,21 @@ impl SystemdManager { } /// Write the proper unit file for [unit] to disk. - /// The location of the unit file is determined by the value of [unit_file_path]: + /// The location of the unit file is determined by the value of `unit_file_path`: /// /// * None, the unit file will be created in the base directory that this manager was initialized /// with, which is either /lib/systemd/system or ~/.config/systemd/user depending on the value of - /// [session]. + /// `session`. /// * Some, the unit file will be created at this location and linked into the proper /// systemd unit directory /// - /// [force] determines if an existing unit file should be overwritten, if no external unit file - /// path is specified in [unit_file_path]. If this is false and the target file exists an error + /// `force` determines if an existing unit file should be overwritten, if no external unit file + /// path is specified in `unit_file_path`. If this is false and the target file exists an error /// is returned. /// - /// The value of [daemon_reload] controls whether a daemon reload is triggered after creating or + /// The value of `daemon_reload` controls whether a daemon reload is triggered after creating or /// linking the unit file. - pub fn create_unit( + pub async fn create_unit( &self, unit: &SystemDUnit, unit_file_path: Option, @@ -199,12 +189,13 @@ impl SystemdManager { // If this is a linked unit file we need to call out to systemd to link this file if linked_unit_file { - self.link_unit_file(&target_file.into_os_string().to_string_lossy(), force)?; + self.link_unit_file(&target_file.into_os_string().to_string_lossy(), force) + .await?; } // Perform daemon reload if requested if daemon_reload { - self.reload()?; + self.reload().await?; } Ok(()) } @@ -218,9 +209,9 @@ impl SystemdManager { /// /// Calling this function means an implicit disabling of the service, if it was enabled. /// - pub fn remove_unit(&self, unit: &str, daemon_reload: bool) -> anyhow::Result<()> { + pub async fn remove_unit(&self, unit: &str, daemon_reload: bool) -> anyhow::Result<()> { debug!("Disabling unit [{}]", unit); - if let Err(disable_error) = self.disable(unit) { + if let Err(disable_error) = self.disable(unit).await { debug!( "Error disabling systemd unit [{}]: [{}]", unit, disable_error @@ -238,7 +229,7 @@ impl SystemdManager { } if daemon_reload { - self.reload()?; + self.reload().await?; } Ok(()) } @@ -249,13 +240,13 @@ impl SystemdManager { /// to work. /// /// For a unit file to be _known_ it needs to either be located in the systemd unit folder, or - /// linked into that folder - both actions can be performed by calling [create_unit] - pub fn enable(&self, unit: &str) -> anyhow::Result<()> { + /// linked into that folder - both actions can be performed by calling [`SystemdManager::create_unit`] + pub async fn enable(&self, unit: &str) -> anyhow::Result<()> { // We don't do any checking around this and simply trust the user that either the name // of an existing and linked service was provided or this is an absolute path debug!("Trying to enable systemd unit [{}]", unit); - match self.proxy.enable_unit_files(&[unit], false, true) { + match self.proxy.enable_unit_files(&[unit], false, true).await { Ok(_) => { debug!("Successfully enabled service [{}]", unit); Ok(()) @@ -266,9 +257,9 @@ impl SystemdManager { // Disable the systemd unit - which effectively means removing the symlink from the // multi-user.target subdirectory. - pub fn disable(&self, unit: &str) -> anyhow::Result<()> { + pub async fn disable(&self, unit: &str) -> anyhow::Result<()> { debug!("Trying to disable systemd unit [{}]", unit); - match self.proxy.disable_unit_files(&[unit], false) { + match self.proxy.disable_unit_files(&[unit], false).await { Ok(_) => { debug!("Successfully disabled service [{}]", unit); Ok(()) @@ -280,11 +271,11 @@ impl SystemdManager { /// Attempts to start a systemd unit /// [unit] is expected to be the name (including .) of a service that is known to /// systemd at the time this is called. - /// To make a service known please take a look at the [enable] function. - pub fn start(&self, unit: &str) -> anyhow::Result<()> { + /// To make a service known please take a look at the [`SystemdManager::enable`] function. + pub async fn start(&self, unit: &str) -> anyhow::Result<()> { debug!("Attempting to start unit {}", unit); - match self.proxy.start_unit(unit, StartMode::Fail) { + match self.proxy.start_unit(unit, StartMode::Fail).await { Ok(result) => { debug!("Successfully started service [{}]: [{:?}]", unit, result); Ok(()) @@ -296,11 +287,11 @@ impl SystemdManager { /// Attempts to stop a systemd unit /// [unit] is expected to be the name (including .) of a service that is known to /// systemd at the time this is called. - /// To make a service known please take a look at the [enable] function. - pub fn stop(&self, unit: &str) -> anyhow::Result<()> { + /// To make a service known please take a look at the [`SystemdManager::enable`] function. + pub async fn stop(&self, unit: &str) -> anyhow::Result<()> { debug!("Trying to stop systemd unit [{}]", unit); - match self.proxy.stop_unit(unit, StopMode::Fail) { + match self.proxy.stop_unit(unit, StopMode::Fail).await { Ok(result) => { debug!("Successfully stopped service [{}]: [{:?}]", unit, result); Ok(()) @@ -313,10 +304,10 @@ impl SystemdManager { // discover changes that have been performed since the last reload // This needs to be done after creating a new service unit before it can be targeted by // start / stop and similar commands. - pub fn reload(&self) -> anyhow::Result<()> { + pub async fn reload(&self) -> anyhow::Result<()> { debug!("Performing daemon-reload.."); - match self.proxy.reload() { + match self.proxy.reload().await { Ok(_) => { debug!("Successfully performed daemon-reload"); Ok(()) @@ -326,19 +317,23 @@ impl SystemdManager { } /// Checks if the ActiveState of the given unit is set to active. - pub fn is_running(&self, unit: &str) -> anyhow::Result { + pub async fn is_running(&self, unit: &str) -> anyhow::Result { self.proxy - .load_unit(unit)? + .load_unit(unit) + .await? .active_state() + .await .map(|state| state == ActiveState::Active) .map_err(|e| anyhow!("Error receiving ActiveState of unit [{}]. {}", unit, e)) } /// Retrieves the invocation ID for the given unit. - pub fn get_invocation_id(&self, unit: &str) -> anyhow::Result { + pub async fn get_invocation_id(&self, unit: &str) -> anyhow::Result { self.proxy - .load_unit(unit)? + .load_unit(unit) + .await? .invocation_id() + .await .map(|invocation_id| invocation_id.to_string()) .map_err(|e| anyhow!("Error receiving InvocationID of unit [{}]. {}", unit, e)) } @@ -346,9 +341,9 @@ impl SystemdManager { // Symlink a unit file into the systemd unit folder // This is not public on purpose, as [create] should be the normal way to link unit files // when using this crate - fn link_unit_file(&self, unit: &str, force: bool) -> anyhow::Result<()> { + async fn link_unit_file(&self, unit: &str, force: bool) -> anyhow::Result<()> { debug!("Linking [{}]", unit); - self.proxy.link_unit_files(&[unit], false, force)?; + self.proxy.link_unit_files(&[unit], false, force).await?; Ok(()) } diff --git a/src/provider/systemdmanager/systemd1_api.rs b/src/provider/systemdmanager/systemd1_api.rs index 2f5c9c0..1799d71 100644 --- a/src/provider/systemdmanager/systemd1_api.rs +++ b/src/provider/systemdmanager/systemd1_api.rs @@ -1,3 +1,4 @@ +//! Binding to the D-Bus interface of systemd use fmt::Display; use inflector::cases::kebabcase; use serde::{de::Visitor, Deserialize, Serialize}; @@ -149,7 +150,9 @@ impl Type for StopMode { /// /// Currently not all methods of the systemd object are exposed. /// -/// # Example +/// # Examples +/// +/// Synchronous API: /// /// ``` /// # use stackable_agent::provider::systemdmanager::systemd1_api::ManagerProxy; @@ -157,6 +160,17 @@ impl Type for StopMode { /// let manager = ManagerProxy::new(&connection).unwrap(); /// let unit = manager.load_unit("my_service.service").unwrap(); /// ``` +/// +/// Asynchronous API: +/// +/// ``` +/// # use stackable_agent::provider::systemdmanager::systemd1_api::AsyncManagerProxy; +/// # tokio::runtime::Runtime::new().unwrap().block_on(async { +/// let connection = zbus::azync::Connection::new_session().await.unwrap(); +/// let manager = AsyncManagerProxy::new(&connection).unwrap(); +/// let unit = manager.load_unit("my_service.service").await.unwrap(); +/// # }); +/// ``` #[dbus_proxy( default_service = "org.freedesktop.systemd1", interface = "org.freedesktop.systemd1.Manager", @@ -279,7 +293,7 @@ impl Display for InvocationId { /// A systemd unit object /// -/// A [`UnitProxy`] can be retrieved e.g. by [`Manager::load_unit`]. +/// A [`UnitProxy`] can be retrieved e.g. by [`ManagerProxy::load_unit`]. /// /// Currently not all methods of the systemd object are exposed. #[dbus_proxy( @@ -299,7 +313,7 @@ trait Unit { /// A systemd job object /// -/// The [`JobProxy`] is returned by various functions in [`Manager`]. +/// The [`JobProxy`] is returned by various functions in [`ManagerProxy`]. /// /// Currently no methods of the systemd object are exposed. #[dbus_proxy( diff --git a/src/provider/systemdmanager/systemdunit.rs b/src/provider/systemdmanager/systemdunit.rs index 48e31fe..9b32d7f 100644 --- a/src/provider/systemdmanager/systemdunit.rs +++ b/src/provider/systemdmanager/systemdunit.rs @@ -186,7 +186,7 @@ impl SystemDUnit { /// Parse a pod object and retrieve the generic settings which will be the same across /// all service units created for containers in this pod. /// This is designed to then be used as `common_properties` parameter when calling - ///[`SystemdUnit::new`] + ///[`SystemDUnit::new`] pub fn new_from_pod(pod: &Pod, user_mode: bool) -> Result { let mut unit = SystemDUnit { name: pod.name().to_string(), From 17960cf43b3f1bea7e0fb7726d32043ec3c84bcd Mon Sep 17 00:00:00 2001 From: Siegfried Weber Date: Mon, 10 May 2021 10:53:02 +0200 Subject: [PATCH 04/13] Changelog extended --- CHANGELOG.adoc | 6 ------ CHANGELOG.md | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 6 deletions(-) delete mode 100644 CHANGELOG.adoc create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc deleted file mode 100644 index ff73a3a..0000000 --- a/CHANGELOG.adoc +++ /dev/null @@ -1,6 +0,0 @@ -= Changelog - -== 0.1.0 - unreleased - -=== Changed -* Removed dependency to libdbus ([#148]). diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..f1148b0 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,20 @@ +# Changelog + +## 0.1.0 - 2021-05-11 + +### Added +- Apache license v2.0 set ([#23]). +- Krustlet based agent implementation created ([#1], [#18], [#26], [#35], [#40]). +- Functionality to stop and restart processes added ([#25]). +- Agent restart without impacting running services enabled ([#63]). +- Rendering of template variables to environment variables added ([#30]). +- Setting of pod condition "ready" for state "running" added ([#32]). +- Support for command line parameters added ([#36], [#50], [#72], [#109]). +- Integration with systemd implemented ([#43], [#53], [#100], [#152]). +- Dependabot and security audit enabled ([#56], [#57]). +- Building and publishing of nightly deb and rpm packages added ([#73], [#78], [#94], [#110], [#144]). +- Bootstrapping of certificates and kubeconfig added ([#77]). +- Support for running of services as application users added ([#79]). +- Retrieval of container logs with kubectl logs implemented ([#135]). +- Configuration of terminationGracePeriodSeconds considered in systemd units ([#138]). +- Systemd dependency adapted so that it is compatible with systemd version 241 ([#145]). From 3fa18d31487cf4cce8fa09c3dbeae8c094729175 Mon Sep 17 00:00:00 2001 From: Siegfried Weber Date: Mon, 10 May 2021 10:55:46 +0200 Subject: [PATCH 05/13] Changelog changed to adoc --- CHANGELOG.adoc | 20 ++++++++++++++++++++ CHANGELOG.md | 20 -------------------- 2 files changed, 20 insertions(+), 20 deletions(-) create mode 100644 CHANGELOG.adoc delete mode 100644 CHANGELOG.md diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc new file mode 100644 index 0000000..a8f4dff --- /dev/null +++ b/CHANGELOG.adoc @@ -0,0 +1,20 @@ += Changelog + +== 0.1.0 - 2021-05-11 + +=== Added +* Apache license v2.0 set ([#23]). +* Krustlet based agent implementation created ([#1], [#18], [#26], [#35], [#40]). +* Functionality to stop and restart processes added ([#25]). +* Agent restart without impacting running services enabled ([#63]). +* Rendering of template variables to environment variables added ([#30]). +* Setting of pod condition "ready" for state "running" added ([#32]). +* Support for command line parameters added ([#36], [#50], [#72], [#109]). +* Integration with systemd implemented ([#43], [#53], [#100], [#152]). +* Dependabot and security audit enabled ([#56], [#57]). +* Building and publishing of nightly deb and rpm packages added ([#73], [#78], [#94], [#110], [#144]). +* Bootstrapping of certificates and kubeconfig added ([#77]). +* Support for running of services as application users added ([#79]). +* Retrieval of container logs with kubectl logs implemented ([#135]). +* Configuration of terminationGracePeriodSeconds considered in systemd units ([#138]). +* Systemd dependency adapted so that it is compatible with systemd version 241 ([#145]). diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index f1148b0..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,20 +0,0 @@ -# Changelog - -## 0.1.0 - 2021-05-11 - -### Added -- Apache license v2.0 set ([#23]). -- Krustlet based agent implementation created ([#1], [#18], [#26], [#35], [#40]). -- Functionality to stop and restart processes added ([#25]). -- Agent restart without impacting running services enabled ([#63]). -- Rendering of template variables to environment variables added ([#30]). -- Setting of pod condition "ready" for state "running" added ([#32]). -- Support for command line parameters added ([#36], [#50], [#72], [#109]). -- Integration with systemd implemented ([#43], [#53], [#100], [#152]). -- Dependabot and security audit enabled ([#56], [#57]). -- Building and publishing of nightly deb and rpm packages added ([#73], [#78], [#94], [#110], [#144]). -- Bootstrapping of certificates and kubeconfig added ([#77]). -- Support for running of services as application users added ([#79]). -- Retrieval of container logs with kubectl logs implemented ([#135]). -- Configuration of terminationGracePeriodSeconds considered in systemd units ([#138]). -- Systemd dependency adapted so that it is compatible with systemd version 241 ([#145]). From 3498cc570b681b9d1e4fe6d4d12d0f1cfa09369e Mon Sep 17 00:00:00 2001 From: Siegfried Weber Date: Mon, 10 May 2021 11:05:42 +0200 Subject: [PATCH 06/13] Typo fixed --- src/provider/systemdmanager/manager.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/provider/systemdmanager/manager.rs b/src/provider/systemdmanager/manager.rs index 6388c25..84e4084 100644 --- a/src/provider/systemdmanager/manager.rs +++ b/src/provider/systemdmanager/manager.rs @@ -251,7 +251,7 @@ impl SystemdManager { debug!("Successfully enabled service [{}]", unit); Ok(()) } - Err(e) => Err(anyhow!("Error starting service [{}]: {}", unit, e)), + Err(e) => Err(anyhow!("Error enabling service [{}]: {}", unit, e)), } } From 73ca49a80aa0ed42ee411f0105f9005ee244e0ad Mon Sep 17 00:00:00 2001 From: Siegfried Weber Date: Mon, 10 May 2021 11:39:59 +0200 Subject: [PATCH 07/13] Doctests fixed --- src/provider/systemdmanager/systemd1_api.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/provider/systemdmanager/systemd1_api.rs b/src/provider/systemdmanager/systemd1_api.rs index 1799d71..b57b9f2 100644 --- a/src/provider/systemdmanager/systemd1_api.rs +++ b/src/provider/systemdmanager/systemd1_api.rs @@ -156,9 +156,9 @@ impl Type for StopMode { /// /// ``` /// # use stackable_agent::provider::systemdmanager::systemd1_api::ManagerProxy; -/// let connection = zbus::Connection::new_session().unwrap(); +/// let connection = zbus::Connection::new_system().unwrap(); /// let manager = ManagerProxy::new(&connection).unwrap(); -/// let unit = manager.load_unit("my_service.service").unwrap(); +/// let unit = manager.load_unit("dbus.service").unwrap(); /// ``` /// /// Asynchronous API: @@ -166,9 +166,9 @@ impl Type for StopMode { /// ``` /// # use stackable_agent::provider::systemdmanager::systemd1_api::AsyncManagerProxy; /// # tokio::runtime::Runtime::new().unwrap().block_on(async { -/// let connection = zbus::azync::Connection::new_session().await.unwrap(); +/// let connection = zbus::azync::Connection::new_system().await.unwrap(); /// let manager = AsyncManagerProxy::new(&connection).unwrap(); -/// let unit = manager.load_unit("my_service.service").await.unwrap(); +/// let unit = manager.load_unit("dbus.service").await.unwrap(); /// # }); /// ``` #[dbus_proxy( From ad0ff4928c9f74469702a62761d7f65f8c80dee8 Mon Sep 17 00:00:00 2001 From: Siegfried Weber Date: Mon, 10 May 2021 11:48:49 +0200 Subject: [PATCH 08/13] libdbus dependencies removed from GitHub workflow --- .github/workflows/rust.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index c1b67be..e0320a1 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -15,15 +15,15 @@ jobs: steps: - uses: actions/checkout@v2.3.4 - run: rustup update stable && rustup default stable - - run: sudo apt-get install libdbus-1-dev libsystemd-dev pkg-config libdbus-1-3 + - run: sudo apt-get install libsystemd-dev pkg-config - run: rustup component add rustfmt - run: cargo fmt --all -- --check clippy_check: runs-on: ubuntu-latest steps: - - name: Install dbus dependencies - run: sudo apt-get install libdbus-1-dev libsystemd-dev pkg-config libdbus-1-3 + - name: Install systemd dependencies + run: sudo apt-get install libsystemd-dev pkg-config - uses: actions/checkout@v2.3.4 - uses: actions-rs/toolchain@v1.0.7 with: @@ -39,8 +39,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2.3.4 - - name: Install dbus dependencies - run: sudo apt-get install libdbus-1-dev libsystemd-dev pkg-config libdbus-1-3 + - name: Install systemd dependencies + run: sudo apt-get install libsystemd-dev pkg-config - name: Build run: cargo build --verbose - name: Run tests From a5c22bbc938c6d2221d2e48c10846307982e6a0a Mon Sep 17 00:00:00 2001 From: Siegfried Weber Date: Tue, 11 May 2021 09:18:12 +0200 Subject: [PATCH 09/13] Build dependencies in README fixed --- README.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.adoc b/README.adoc index d8784e5..f28688c 100644 --- a/README.adoc +++ b/README.adoc @@ -39,7 +39,7 @@ After rust is installed simply run To create the binary file in _target/debug_. ==== Build dependencies -The agent depends on native dbus libraries to communicate with systemd. +The agent depends on native systemd libraries to communicate with systemd. For the build process to work these need to be installed on the build system. @@ -53,7 +53,7 @@ a|- pkg-config |Centos a|- pkg-config -- libsystemd-dev +- systemd-devel |=== From 9588c2be580ca0cf8a6fbf1a9b492fdc89a9e45d Mon Sep 17 00:00:00 2001 From: Siegfried Weber Date: Tue, 11 May 2021 15:10:34 +0200 Subject: [PATCH 10/13] All dependencies upgraded --- Cargo.lock | 411 +++++++++++++++++++++++------------------------------ 1 file changed, 179 insertions(+), 232 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 803d993..70e0781 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -18,9 +18,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "aho-corasick" -version = "0.7.15" +version = "0.7.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" +checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" dependencies = [ "memchr", ] @@ -52,23 +52,11 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f8cb5d814eb646a863c4f24978cff2880c4be96ad8cde2c0f0678732902e271" -[[package]] -name = "arrayref" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" - -[[package]] -name = "arrayvec" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" - [[package]] name = "async-compression" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b72c1f1154e234325b50864a349b9c8e56939e266a4c307c0f159812df2f9537" +checksum = "5443ccbb270374a2b1055fc72da40e1f237809cd6bb0e97e66d264cd138473a6" dependencies = [ "flate2", "futures-core", @@ -108,9 +96,9 @@ dependencies = [ [[package]] name = "async-stream" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3670df70cbc01729f901f94c887814b3c68db038aad1329a418bae178bc5295c" +checksum = "0a26cb53174ddd320edfff199a853f93d571f48eeb4dde75e67a9a3dbb7b7e5e" dependencies = [ "async-stream-impl", "futures-core", @@ -118,9 +106,9 @@ dependencies = [ [[package]] name = "async-stream-impl" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3548b8efc9f8e8a5a0a2808c5bd8451a9031b9e5b879a79590304ae928b0a70" +checksum = "db134ba52475c060f3329a8ef0f8786d6b872ed01515d4b79c162e5798da1340" dependencies = [ "proc-macro2", "quote", @@ -188,17 +176,6 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" -[[package]] -name = "blake2b_simd" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afa748e348ad3be8263be728124b24a24f268266f6f5d58af9d75f6a40b5c587" -dependencies = [ - "arrayref", - "arrayvec", - "constant_time_eq", -] - [[package]] name = "block-buffer" version = "0.7.3" @@ -231,9 +208,9 @@ dependencies = [ [[package]] name = "bstr" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" +checksum = "90682c8d613ad3373e66de8c6411e0ae2ab2571e879d2efbf73558cc66f21279" dependencies = [ "lazy_static", "memchr", @@ -252,9 +229,9 @@ dependencies = [ [[package]] name = "build-env" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6cf89846ef2b2674ef1c153256cec98fba587c72bf4ea2c4b2f6d91a19f55926" +checksum = "1522ac6ee801a11bf9ef3f80403f4ede6eb41291fac3dde3de09989679305f25" [[package]] name = "bumpalo" @@ -361,15 +338,9 @@ dependencies = [ [[package]] name = "const_fn" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "076a6803b0dacd6a88cfe64deba628b01533ff5ef265687e6938280c1afd0a28" - -[[package]] -name = "constant_time_eq" -version = "0.1.5" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +checksum = "402da840495de3f976eaefc3485b7f5eb5b0bf9761f9a47be27fe975b3b8c2ec" [[package]] name = "core-foundation" @@ -388,10 +359,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b" [[package]] -name = "cpuid-bool" -version = "0.1.2" +name = "cpufeatures" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634" +checksum = "dec1028182c380cc45a2e2c5ec841134f2dfd0f8f5f0a5bcd68004f81b5efdf4" +dependencies = [ + "libc", +] [[package]] name = "crc32fast" @@ -404,9 +378,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" +checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4" dependencies = [ "cfg-if 1.0.0", "crossbeam-utils", @@ -414,9 +388,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49" +checksum = "4feb231f0d4d6af81aed15928e58ecf5816aa62a2393e2c82f46973e92a9a278" dependencies = [ "autocfg", "cfg-if 1.0.0", @@ -474,9 +448,9 @@ dependencies = [ [[package]] name = "dirs" -version = "3.0.1" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "142995ed02755914747cc6ca76fc7e4583cd18578746716d0508ea6ed558b9ff" +checksum = "30baa043103c9d0c2a57cf537cc2f35623889dc0d405e6c3cccfadbc81c71309" dependencies = [ "dirs-sys", ] @@ -493,12 +467,12 @@ dependencies = [ [[package]] name = "dirs-sys" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e93d7f5705de3e49895a2b5e0b8855a1c27f080192ae9c32a6432d50741a57a" +checksum = "03d86534ed367a67548dc68113a0f5db55432fdfbb6e6f9d77704397d95d5780" dependencies = [ "libc", - "redox_users 0.3.5", + "redox_users", "winapi 0.3.9", ] @@ -509,7 +483,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" dependencies = [ "libc", - "redox_users 0.4.0", + "redox_users", "winapi 0.3.9", ] @@ -628,7 +602,7 @@ checksum = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" dependencies = [ "cfg-if 1.0.0", "libc", - "redox_syscall 0.2.5", + "redox_syscall", "winapi 0.3.9", ] @@ -751,9 +725,9 @@ checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" [[package]] name = "futures" -version = "0.3.13" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f55667319111d593ba876406af7c409c0ebb44dc4be6132a783ccf163ea14c1" +checksum = "0e7e43a803dae2fa37c1f6a8fe121e1f7bf9548b4dfc0522a42f34145dadfc27" dependencies = [ "futures-channel", "futures-core", @@ -766,9 +740,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.13" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c2dd2df839b57db9ab69c2c9d8f3e8c81984781937fe2807dc6dcf3b2ad2939" +checksum = "e682a68b29a882df0545c143dc3646daefe80ba479bcdede94d5a703de2871e2" dependencies = [ "futures-core", "futures-sink", @@ -776,15 +750,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.13" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15496a72fabf0e62bdc3df11a59a3787429221dd0710ba8ef163d6f7a9112c94" +checksum = "0402f765d8a89a26043b889b26ce3c4679d268fa6bb22cd7c6aad98340e179d1" [[package]] name = "futures-executor" -version = "0.3.13" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "891a4b7b96d84d5940084b2a37632dd65deeae662c114ceaa2c879629c9c0ad1" +checksum = "badaa6a909fac9e7236d0620a2f57f7664640c56575b71a7552fbd68deafab79" dependencies = [ "futures-core", "futures-task", @@ -793,9 +767,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.13" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71c2c65c57704c32f5241c1223167c2c3294fd34ac020c807ddbe6db287ba59" +checksum = "acc499defb3b348f8d8f3f66415835a9131856ff7714bf10dadfc4ec4bdb29a1" [[package]] name = "futures-lite" @@ -814,10 +788,11 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.13" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea405816a5139fb39af82c2beb921d52143f556038378d6db21183a5c37fbfb7" +checksum = "a4c40298486cdf52cc00cd6d6987892ba502c7656a16a4192a9992b1ccedd121" dependencies = [ + "autocfg", "proc-macro-hack", "proc-macro2", "quote", @@ -826,22 +801,23 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.13" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85754d98985841b7d4f5e8e6fbfa4a4ac847916893ec511a2917ccd8525b8bb3" +checksum = "a57bead0ceff0d6dde8f465ecd96c9338121bb7717d3e7b108059531870c4282" [[package]] name = "futures-task" -version = "0.3.13" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa189ef211c15ee602667a6fcfe1c1fd9e07d42250d2156382820fba33c9df80" +checksum = "8a16bef9fc1a4dddb5bee51c989e3fbba26569cbb0e31f5b303c184e3dd33dae" [[package]] name = "futures-util" -version = "0.3.13" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1812c7ab8aedf8d6f2701a43e1243acdbcc2b36ab26e2ad421eb99ac963d96d1" +checksum = "feb5c238d27e2bf94ffdfd27b2c29e3df4a68c4193bb6427384259e2bf191967" dependencies = [ + "autocfg", "futures-channel", "futures-core", "futures-io", @@ -899,16 +875,16 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc018e188373e2777d0ef2467ebff62a08e66c3f5857b23c8fbec3018210dc00" +checksum = "825343c4eef0b63f541f8903f395dc5beb362a979b5799a84062527ef1e37726" dependencies = [ "bytes 1.0.1", "fnv", "futures-core", "futures-sink", "futures-util", - "http 0.2.3", + "http 0.2.4", "indexmap", "slab", "tokio 1.5.0", @@ -925,7 +901,7 @@ dependencies = [ "log", "pest", "pest_derive", - "quick-error 2.0.0", + "quick-error 2.0.1", "serde", "serde_json", ] @@ -946,9 +922,9 @@ dependencies = [ "bitflags", "bytes 1.0.1", "headers-core", - "http 0.2.3", + "http 0.2.4", "mime", - "sha-1 0.9.4", + "sha-1 0.9.5", "time 0.1.44", ] @@ -958,7 +934,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7f66481bfee273957b1f20485a4ff3362987f85b2c236580d81b4eb7a326429" dependencies = [ - "http 0.2.3", + "http 0.2.4", ] [[package]] @@ -1009,9 +985,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7245cd7449cc792608c3c8a9eaf69bd4eabbabf802713748fd739c98b82f0747" +checksum = "527e8c9ac747e28542699a951517aa9a6945af506cd1f2e1b53a576c17b6cc11" dependencies = [ "bytes 1.0.1", "fnv", @@ -1020,26 +996,26 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfb77c123b4e2f72a2069aeae0b4b4949cc7e966df277813fc16347e7549737" +checksum = "60daa14be0e0786db0f03a9e57cb404c9d756eed2b6c62b9ea98ec5743ec75a9" dependencies = [ "bytes 1.0.1", - "http 0.2.3", + "http 0.2.4", "pin-project-lite 0.2.6", ] [[package]] name = "httparse" -version = "1.3.5" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "615caabe2c3160b313d52ccc905335f4ed5f10881dd63dc5699d47e90be85691" +checksum = "f3a87b616e37e93c22fb19bcd386f02f3af5ea98a25670ad0fce773de23c5e68" [[package]] name = "httpdate" -version = "0.3.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47" +checksum = "05842d0d43232b23ccb7060ecb0f0626922c21f30012e97b767b30afd4a5d4b9" [[package]] name = "humantime" @@ -1058,21 +1034,21 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.5" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bf09f61b52cfcf4c00de50df88ae423d6c02354e385a86341133b5338630ad1" +checksum = "1e5f105c494081baa3bf9e200b279e27ec1623895cd504c7dbef8d0b080fcf54" dependencies = [ "bytes 1.0.1", "futures-channel", "futures-core", "futures-util", "h2", - "http 0.2.3", + "http 0.2.4", "http-body", "httparse", "httpdate", "itoa", - "pin-project 1.0.6", + "pin-project 1.0.7", "socket2", "tokio 1.5.0", "tower-service", @@ -1124,9 +1100,9 @@ dependencies = [ [[package]] name = "idna" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89829a5d69c23d348314a7ac337fe39173b61149a9864deabd260983aed48c21" +checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" dependencies = [ "matches", "unicode-bidi", @@ -1222,9 +1198,9 @@ checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" [[package]] name = "js-sys" -version = "0.3.50" +version = "0.3.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d99f9e3e84b8f67f846ef5b4cbbc3b1c29f6c759fcbce6f01aa0e73d932a24c" +checksum = "83bdfbace3a0e81a4253f73b49e960b053e396a11012cbd49b9b74d6a2b67062" dependencies = [ "wasm-bindgen", ] @@ -1275,12 +1251,12 @@ dependencies = [ "base64 0.13.0", "bytes 1.0.1", "chrono", - "http 0.2.3", + "http 0.2.4", "percent-encoding 2.1.0", "serde", "serde-value", "serde_json", - "url 2.2.1", + "url 2.2.2", ] [[package]] @@ -1336,7 +1312,7 @@ dependencies = [ "either", "futures", "futures-util", - "http 0.2.3", + "http 0.2.4", "json-patch", "jsonpath_lib", "k8s-openapi", @@ -1352,7 +1328,7 @@ dependencies = [ "thiserror", "time 0.2.26", "tokio 1.5.0", - "url 2.2.1", + "url 2.2.2", ] [[package]] @@ -1379,7 +1355,7 @@ dependencies = [ "futures", "k8s-openapi", "kube", - "pin-project 1.0.6", + "pin-project 1.0.7", "serde", "smallvec", "snafu", @@ -1400,7 +1376,7 @@ dependencies = [ "dirs", "futures", "hostname", - "http 0.2.3", + "http 0.2.4", "hyper", "iovec", "json-patch", @@ -1434,7 +1410,7 @@ dependencies = [ "tonic-build", "tower", "tracing", - "url 2.2.1", + "url 2.2.2", "uuid", "warp", "winapi 0.2.8", @@ -1461,9 +1437,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.91" +version = "0.2.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8916b1f6ca17130ec6568feccee27c156ad12037880833a3b842a823236502e7" +checksum = "18794a8ad5b29321f790b55d93dfba91e125cb1a9edbd4f8e3150acc771c1a5e" [[package]] name = "libsystemd-sys" @@ -1510,9 +1486,9 @@ checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" [[package]] name = "memchr" -version = "2.3.4" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" +checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc" [[package]] name = "mime" @@ -1683,9 +1659,9 @@ dependencies = [ [[package]] name = "notify" -version = "5.0.0-pre.6" +version = "5.0.0-pre.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5fd82b93434edb9c00ae65ee741e0e081cdc8c63346ab9f687935a629aaf4c3" +checksum = "1ebe7699a0f8c5759450716ee03d231685c22b4fe8f406c42c22e0ad94d40ce7" dependencies = [ "anymap", "bitflags", @@ -1777,9 +1753,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.33" +version = "0.10.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a61075b62a23fef5a29815de7536d940aa35ce96d18ce0cc5076272db678a577" +checksum = "6d7830286ad6a3973c0f1d9b73738f69c76b739301d0229c4b96501695cbe4c8" dependencies = [ "bitflags", "cfg-if 1.0.0", @@ -1797,9 +1773,9 @@ checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" [[package]] name = "openssl-sys" -version = "0.9.61" +version = "0.9.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "313752393519e876837e09e1fa183ddef0be7735868dced3196f4472d536277f" +checksum = "b6b0d6fb7d80f877617dfcb014e605e2b5ab2fb0afdf27935219bb6bd984cb98" dependencies = [ "autocfg", "cc", @@ -1810,9 +1786,9 @@ dependencies = [ [[package]] name = "ordered-float" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "766f840da25490628d8e63e529cd21c014f6600c6b8517add12a6fa6167a6218" +checksum = "b50b8919aecb97e5ee9aceef27e24f39c46b11831130f4a6b7b091ec5de0de12" dependencies = [ "num-traits", ] @@ -1910,11 +1886,11 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc174859768806e91ae575187ada95c91a29e96a98dc5d2cd9a1fed039501ba6" +checksum = "c7509cc106041c40a4518d2af7a61530e1eed0e6285296a3d8c5472806ccc4a4" dependencies = [ - "pin-project-internal 1.0.6", + "pin-project-internal 1.0.7", ] [[package]] @@ -1930,9 +1906,9 @@ dependencies = [ [[package]] name = "pin-project-internal" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a490329918e856ed1b083f244e3bfe2d8c4f336407e4ea9e1a9f479ff09049e5" +checksum = "48c950132583b500556b1efd71d45b319029f2b71518d979fcc208e16b42426f" dependencies = [ "proc-macro2", "quote", @@ -2095,9 +2071,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quick-error" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ac73b1112776fc109b2e61909bc46c7e1bf0d7f690ffb1676553acce16d5cda" +checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" [[package]] name = "quote" @@ -2219,9 +2195,9 @@ dependencies = [ [[package]] name = "rcgen" -version = "0.8.9" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cb7a2dc0e5307189b6933a61290ff06b65b35bdcaae2b2c50a0c3e355cb118e" +checksum = "48b4fc1b81d685fcd442a86da2e2c829d9e353142633a8159f42bf28e7e94428" dependencies = [ "chrono", "pem", @@ -2240,30 +2216,13 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.1.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" - -[[package]] -name = "redox_syscall" -version = "0.2.5" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" +checksum = "742739e41cd49414de871ea5e549afb7e2a3ac77b589bcbebe8c82fab37147fc" dependencies = [ "bitflags", ] -[[package]] -name = "redox_users" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de0737333e7a9502c789a36d7c7fa6092a49895d4faa31ca5df163857ded2e9d" -dependencies = [ - "getrandom 0.1.16", - "redox_syscall 0.1.57", - "rust-argon2", -] - [[package]] name = "redox_users" version = "0.4.0" @@ -2271,14 +2230,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64" dependencies = [ "getrandom 0.2.2", - "redox_syscall 0.2.5", + "redox_syscall", ] [[package]] name = "regex" -version = "1.4.6" +version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a26af418b574bd56588335b3a3659a65725d4e636eb1016c2f9e3b38c7cc759" +checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" dependencies = [ "aho-corasick", "memchr", @@ -2296,9 +2255,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.23" +version = "0.6.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" +checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" [[package]] name = "remove_dir_all" @@ -2321,7 +2280,7 @@ dependencies = [ "encoding_rs", "futures-core", "futures-util", - "http 0.2.3", + "http 0.2.4", "http-body", "hyper", "hyper-tls", @@ -2339,7 +2298,7 @@ dependencies = [ "tokio 1.5.0", "tokio-native-tls", "tokio-util", - "url 2.2.1", + "url 2.2.2", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", @@ -2374,18 +2333,6 @@ dependencies = [ "syn", ] -[[package]] -name = "rust-argon2" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b18820d944b33caa75a71378964ac46f58517c92b6ae5f762636247c09e78fb" -dependencies = [ - "base64 0.13.0", - "blake2b_simd", - "constant_time_eq", - "crossbeam-utils", -] - [[package]] name = "rustc_version" version = "0.2.3" @@ -2406,9 +2353,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.19.0" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "064fd21ff87c6e87ed4506e68beb42459caa4a0e2eb144932e6776768556980b" +checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" dependencies = [ "base64 0.13.0", "log", @@ -2480,9 +2427,9 @@ checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" [[package]] name = "sct" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3042af939fca8c3453b7af0f1c66e533a15a86169e39de2657310ade8f98d3c" +checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" dependencies = [ "ring", "untrusted", @@ -2646,13 +2593,13 @@ dependencies = [ [[package]] name = "sha-1" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfebf75d25bd900fd1e7d11501efab59bc846dbc76196839663e6637bba9f25f" +checksum = "b659df5fc3ce22274daac600ffb845300bd2125bcfaec047823075afdab81c00" dependencies = [ "block-buffer 0.9.0", "cfg-if 1.0.0", - "cpuid-bool", + "cpufeatures", "digest 0.9.0", "opaque-debug 0.3.0", ] @@ -2665,13 +2612,13 @@ checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" [[package]] name = "sha2" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa827a14b29ab7f44778d14a88d3cb76e949c45083f7dbfa507d0cb699dc12de" +checksum = "d8f6b75b17576b792bef0db1bcc4b8b8bcdf9506744cf34b974195487af6cff2" dependencies = [ "block-buffer 0.9.0", "cfg-if 1.0.0", - "cpuid-bool", + "cpufeatures", "digest 0.9.0", "opaque-debug 0.3.0", ] @@ -2696,9 +2643,9 @@ dependencies = [ [[package]] name = "slab" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" +checksum = "f173ac3d1a7e3b28003f40de0b5ce7fe2710f9b9dc3fc38664cebee46b3b6527" [[package]] name = "slotmap" @@ -2791,7 +2738,7 @@ dependencies = [ "tar", "thiserror", "tokio 1.5.0", - "url 2.2.1", + "url 2.2.2", "zbus", "zvariant", ] @@ -2923,9 +2870,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.71" +version = "1.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad184cc9470f9117b2ac6817bfe297307418819ba40552f9b3846f05c33d5373" +checksum = "a1e8cdbefb79a9a5a65e0db8b47b723ee907b7c7f8496c76a1770b5c310bab82" dependencies = [ "proc-macro2", "quote", @@ -2976,7 +2923,7 @@ dependencies = [ "cfg-if 1.0.0", "libc", "rand 0.8.3", - "redox_syscall 0.2.5", + "redox_syscall", "remove_dir_all", "winapi 0.3.9", ] @@ -3081,9 +3028,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.1.1" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317cca572a0e89c3ce0ca1f1bdc9369547fe318a683418e42ac8f59d14701023" +checksum = "5b5220f05bb7de7f3f53c7c065e1199b3172696fe2db9f9c4d8ad9b4ee74c342" dependencies = [ "tinyvec_macros", ] @@ -3211,16 +3158,16 @@ checksum = "e1a5f475f1b9d077ea1017ecbc60890fda8e54942d680ca0b1d2b47cfa2d861b" dependencies = [ "futures-util", "log", - "pin-project 1.0.6", + "pin-project 1.0.7", "tokio 1.5.0", "tungstenite", ] [[package]] name = "tokio-util" -version = "0.6.5" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5143d049e85af7fbc36f5454d990e62c2df705b3589f123b71f441b6b59f443f" +checksum = "940a12c99365c31ea8dd9ba04ec1be183ffe4920102bb7122c2f515437601e8e" dependencies = [ "bytes 1.0.1", "futures-core", @@ -3242,9 +3189,9 @@ dependencies = [ [[package]] name = "tonic" -version = "0.4.1" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91491e5f15431f2189ec8c1f9dcbadac949450399c22c912ceae9570eb472f61" +checksum = "2ac42cd97ac6bd2339af5bcabf105540e21e45636ec6fa6aae5e85d44db31be0" dependencies = [ "async-stream", "async-trait", @@ -3253,11 +3200,11 @@ dependencies = [ "futures-core", "futures-util", "h2", - "http 0.2.3", + "http 0.2.4", "http-body", "hyper", "percent-encoding 2.1.0", - "pin-project 1.0.6", + "pin-project 1.0.7", "prost", "prost-derive", "tokio 1.5.0", @@ -3272,9 +3219,9 @@ dependencies = [ [[package]] name = "tonic-build" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e09854abff4c0716059219e155ab0539aecbfc26a40214897b062653adb6ba" +checksum = "c695de27302f4697191dda1c7178131a8cb805463dda02864acb80fe1322fdcf" dependencies = [ "proc-macro2", "prost-build", @@ -3284,14 +3231,14 @@ dependencies = [ [[package]] name = "tower" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f715efe02c0862926eb463e49368d38ddb119383475686178e32e26d15d06a66" +checksum = "bf0aa6dfc29148c3826708dabbfa83c121eeb84df4d1468220825e3a33651687" dependencies = [ "futures-core", "futures-util", "indexmap", - "pin-project 1.0.6", + "pin-project 1.0.7", "rand 0.8.3", "slab", "tokio 1.5.0", @@ -3316,9 +3263,9 @@ checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" [[package]] name = "tracing" -version = "0.1.25" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01ebdc2bb4498ab1ab5f5b73c5803825e60199229ccba0698170e3be0e7f959f" +checksum = "09adeb8c97449311ccd28a427f96fb563e7fd31aabf994189879d9da2394b89d" dependencies = [ "cfg-if 1.0.0", "log", @@ -3340,9 +3287,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f50de3927f93d202783f4513cda820ab47ef17f624b03c096e86ef00c67e6b5f" +checksum = "a9ff14f98b1a4b289c6248a023c1c2fa1491062964e9fed67ab29c4e4da4a052" dependencies = [ "lazy_static", ] @@ -3353,7 +3300,7 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" dependencies = [ - "pin-project 1.0.6", + "pin-project 1.0.7", "tracing", ] @@ -3381,13 +3328,13 @@ dependencies = [ "base64 0.13.0", "byteorder", "bytes 1.0.1", - "http 0.2.3", + "http 0.2.4", "httparse", "input_buffer", "log", "rand 0.8.3", - "sha-1 0.9.4", - "url 2.2.1", + "sha-1 0.9.5", + "url 2.2.2", "utf-8", ] @@ -3432,9 +3379,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" +checksum = "eeb8be209bb1c96b7c177c7420d26e04eccacb0eeae6b980e35fcb74678107e0" dependencies = [ "matches", ] @@ -3462,9 +3409,9 @@ checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" [[package]] name = "unicode-xid" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" +checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" [[package]] name = "unindent" @@ -3491,21 +3438,21 @@ dependencies = [ [[package]] name = "url" -version = "2.2.1" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ccd964113622c8e9322cfac19eb1004a07e636c545f325da085d5cdde6f1f8b" +checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" dependencies = [ "form_urlencoded", - "idna 0.2.2", + "idna 0.2.3", "matches", "percent-encoding 2.1.0", ] [[package]] name = "utf-8" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05e42f7c18b8f902290b009cde6d651262f956c98bc51bca4cd1d511c9cd85c7" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" [[package]] name = "utf8-cstr" @@ -3524,9 +3471,9 @@ dependencies = [ [[package]] name = "vcpkg" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b00bca6106a5e23f3eee943593759b7fcddb00554332e856d990c893966879fb" +checksum = "cbdbff6266a24120518560b5dc983096efb98462e51d0d68169895b237be3e5d" [[package]] name = "vec_map" @@ -3582,14 +3529,14 @@ dependencies = [ "bytes 1.0.1", "futures", "headers", - "http 0.2.3", + "http 0.2.4", "hyper", "log", "mime", "mime_guess", "multipart", "percent-encoding 2.1.0", - "pin-project 1.0.6", + "pin-project 1.0.7", "scoped-tls", "serde", "serde_json", @@ -3617,9 +3564,9 @@ checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" [[package]] name = "wasm-bindgen" -version = "0.2.73" +version = "0.2.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83240549659d187488f91f33c0f8547cbfef0b2088bc470c116d1d260ef623d9" +checksum = "d54ee1d4ed486f78874278e63e4069fc1ab9f6a18ca492076ffb90c5eb2997fd" dependencies = [ "cfg-if 1.0.0", "serde", @@ -3629,9 +3576,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.73" +version = "0.2.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae70622411ca953215ca6d06d3ebeb1e915f0f6613e3b495122878d7ebec7dae" +checksum = "3b33f6a0694ccfea53d94db8b2ed1c3a8a4c86dd936b13b9f0a15ec4a451b900" dependencies = [ "bumpalo", "lazy_static", @@ -3644,9 +3591,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.23" +version = "0.4.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81b8b767af23de6ac18bf2168b690bed2902743ddf0fb39252e36f9e2bfc63ea" +checksum = "5fba7978c679d53ce2d0ac80c8c175840feb849a161664365d1287b41f2e67f1" dependencies = [ "cfg-if 1.0.0", "js-sys", @@ -3656,9 +3603,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.73" +version = "0.2.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e734d91443f177bfdb41969de821e15c516931c3c3db3d318fa1b68975d0f6f" +checksum = "088169ca61430fe1e58b8096c24975251700e7b1f6fd91cc9d59b04fb9b18bd4" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3666,9 +3613,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.73" +version = "0.2.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53739ff08c8a68b0fdbcd54c372b8ab800b1449ab3c9d706503bc7dd1621b2c" +checksum = "be2241542ff3d9f241f5e2cb6dd09b37efe786df8851c54957683a49f0987a97" dependencies = [ "proc-macro2", "quote", @@ -3679,15 +3626,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.73" +version = "0.2.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9a543ae66aa233d14bb765ed9af4a33e81b8b58d1584cf1b47ff8cd0b9e4489" +checksum = "d7cff876b8f18eed75a66cf49b65e7f967cb354a7aa16003fb55dbfd25b44b4f" [[package]] name = "web-sys" -version = "0.3.50" +version = "0.3.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a905d57e488fec8861446d3393670fb50d27a262344013181c2cdf9fff5481be" +checksum = "e828417b379f3df7111d3a2a9e5753706cae29c41f7c4029ee9fd77f3e09e582" dependencies = [ "js-sys", "wasm-bindgen", @@ -3815,9 +3762,9 @@ dependencies = [ [[package]] name = "yasna" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0de7bff972b4f2a06c85f6d8454b09df153af7e3a4ec2aac81db1b105b684ddb" +checksum = "e262a29d0e61ccf2b6190d7050d4b237535fc76ce4c1210d9caa316f71dffa75" dependencies = [ "chrono", ] From f57fd45067e86085ace0ddae12c48ab2973ee4b7 Mon Sep 17 00:00:00 2001 From: Siegfried Weber Date: Mon, 17 May 2021 09:09:29 +0200 Subject: [PATCH 11/13] Release date updated --- CHANGELOG.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index a8f4dff..41e24e8 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -1,6 +1,6 @@ = Changelog -== 0.1.0 - 2021-05-11 +== 0.1.0 - 2021-05-17 === Added * Apache license v2.0 set ([#23]). From 629190ffd04592fe8b704739bc5d6a1880f9c316 Mon Sep 17 00:00:00 2001 From: Siegfried Weber Date: Mon, 17 May 2021 11:49:52 +0200 Subject: [PATCH 12/13] Changelog converted to markdown --- CHANGELOG.adoc | 20 -------------------- CHANGELOG.md | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 20 deletions(-) delete mode 100644 CHANGELOG.adoc create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc deleted file mode 100644 index 41e24e8..0000000 --- a/CHANGELOG.adoc +++ /dev/null @@ -1,20 +0,0 @@ -= Changelog - -== 0.1.0 - 2021-05-17 - -=== Added -* Apache license v2.0 set ([#23]). -* Krustlet based agent implementation created ([#1], [#18], [#26], [#35], [#40]). -* Functionality to stop and restart processes added ([#25]). -* Agent restart without impacting running services enabled ([#63]). -* Rendering of template variables to environment variables added ([#30]). -* Setting of pod condition "ready" for state "running" added ([#32]). -* Support for command line parameters added ([#36], [#50], [#72], [#109]). -* Integration with systemd implemented ([#43], [#53], [#100], [#152]). -* Dependabot and security audit enabled ([#56], [#57]). -* Building and publishing of nightly deb and rpm packages added ([#73], [#78], [#94], [#110], [#144]). -* Bootstrapping of certificates and kubeconfig added ([#77]). -* Support for running of services as application users added ([#79]). -* Retrieval of container logs with kubectl logs implemented ([#135]). -* Configuration of terminationGracePeriodSeconds considered in systemd units ([#138]). -* Systemd dependency adapted so that it is compatible with systemd version 241 ([#145]). diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..3b8e5f2 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,20 @@ +# Changelog + +## 0.1.0 - 2021-05-17 + +### Added +- Apache license v2.0 set ([#23]). +- Krustlet based agent implementation created ([#1], [#18], [#26], [#35], [#40]). +- Functionality to stop and restart processes added ([#25]). +- Agent restart without impacting running services enabled ([#63]). +- Rendering of template variables to environment variables added ([#30]). +- Setting of pod condition "ready" for state "running" added ([#32]). +- Support for command line parameters added ([#36], [#50], [#72], [#109]). +- Integration with systemd implemented ([#43], [#53], [#100], [#152]). +- Dependabot and security audit enabled ([#56], [#57]). +- Building and publishing of nightly deb and rpm packages added ([#73], [#78], [#94], [#110], [#144]). +- Bootstrapping of certificates and kubeconfig added ([#77]). +- Support for running of services as application users added ([#79]). +- Retrieval of container logs with kubectl logs implemented ([#135]). +- Configuration of terminationGracePeriodSeconds considered in systemd units ([#138]). +- Systemd dependency adapted so that it is compatible with systemd version 241 ([#145]). From d758fd938af033a9d6e23930139e7cc0125b0190 Mon Sep 17 00:00:00 2001 From: Siegfried Weber Date: Mon, 17 May 2021 15:37:20 +0200 Subject: [PATCH 13/13] GitHub workflow steps renamed from "Install systemd dependencies" to "Install dependencies" --- .github/workflows/rust.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index e0320a1..197732a 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -22,7 +22,7 @@ jobs: clippy_check: runs-on: ubuntu-latest steps: - - name: Install systemd dependencies + - name: Install dependencies run: sudo apt-get install libsystemd-dev pkg-config - uses: actions/checkout@v2.3.4 - uses: actions-rs/toolchain@v1.0.7 @@ -39,7 +39,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2.3.4 - - name: Install systemd dependencies + - name: Install dependencies run: sudo apt-get install libsystemd-dev pkg-config - name: Build run: cargo build --verbose