From aff75f4f955a1df598964f2332d0af4ec835e8a0 Mon Sep 17 00:00:00 2001 From: Techassi Date: Fri, 29 Sep 2023 10:37:02 +0200 Subject: [PATCH 01/40] wip: add output templates --- Cargo.lock | 1 + rust/stackablectl/Cargo.toml | 1 + rust/stackablectl/src/lib.rs | 1 + rust/stackablectl/src/output/mod.rs | 14 ++++++++++++++ 4 files changed, 17 insertions(+) create mode 100644 rust/stackablectl/src/output/mod.rs diff --git a/Cargo.lock b/Cargo.lock index 7119623a..95cd8619 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2680,6 +2680,7 @@ dependencies = [ "serde_yaml", "snafu", "stackable-cockpit", + "tera", "tokio", "tracing", "tracing-subscriber", diff --git a/rust/stackablectl/Cargo.toml b/rust/stackablectl/Cargo.toml index 8b4214ac..c2ce5337 100644 --- a/rust/stackablectl/Cargo.toml +++ b/rust/stackablectl/Cargo.toml @@ -27,6 +27,7 @@ serde_json.workspace = true serde_yaml.workspace = true serde.workspace = true snafu.workspace = true +tera.workspace = true tokio.workspace = true tracing-subscriber.workspace = true tracing.workspace = true diff --git a/rust/stackablectl/src/lib.rs b/rust/stackablectl/src/lib.rs index 4fa113af..f49b1be7 100644 --- a/rust/stackablectl/src/lib.rs +++ b/rust/stackablectl/src/lib.rs @@ -2,4 +2,5 @@ pub mod args; pub mod cli; pub mod cmds; pub mod constants; +pub mod output; pub mod utils; diff --git a/rust/stackablectl/src/output/mod.rs b/rust/stackablectl/src/output/mod.rs new file mode 100644 index 00000000..574c2099 --- /dev/null +++ b/rust/stackablectl/src/output/mod.rs @@ -0,0 +1,14 @@ +use lazy_static::lazy_static; +use tera::Tera; + +lazy_static! { + pub static ref RENDERER: Tera = { + let mut renderer = Tera::default(); + + renderer.add_raw_templates(vec![(include_str!("templates/"))]); + + renderer + }; +} + +pub struct OutputRenderer {} From 7d20dededb316ab9a8b1285c6f003dc93994636d Mon Sep 17 00:00:00 2001 From: Techassi Date: Thu, 5 Oct 2023 14:47:15 +0200 Subject: [PATCH 02/40] Initial commit --- rust/stackablectl/src/main.rs | 2 +- rust/stackablectl/src/output/mod.rs | 115 ++++++++++++++++-- .../src/output/templates/result_empty.tpl | 0 .../src/output/templates/result_success.tpl | 15 +++ 4 files changed, 124 insertions(+), 8 deletions(-) create mode 100644 rust/stackablectl/src/output/templates/result_empty.tpl create mode 100644 rust/stackablectl/src/output/templates/result_success.tpl diff --git a/rust/stackablectl/src/main.rs b/rust/stackablectl/src/main.rs index 7e2d461c..54db4ad9 100644 --- a/rust/stackablectl/src/main.rs +++ b/rust/stackablectl/src/main.rs @@ -42,6 +42,6 @@ async fn main() -> Result<(), Error> { } let output = app.run().await?; - println!("{output}"); + print!("{output}"); Ok(()) } diff --git a/rust/stackablectl/src/output/mod.rs b/rust/stackablectl/src/output/mod.rs index 574c2099..2b67305f 100644 --- a/rust/stackablectl/src/output/mod.rs +++ b/rust/stackablectl/src/output/mod.rs @@ -1,14 +1,115 @@ -use lazy_static::lazy_static; +use snafu::{ResultExt, Snafu}; +use stackable_cockpit::constants::{DEFAULT_OPERATOR_NAMESPACE, DEFAULT_PRODUCT_NAMESPACE}; use tera::Tera; -lazy_static! { - pub static ref RENDERER: Tera = { - let mut renderer = Tera::default(); +pub type Result = std::result::Result; + +#[derive(Debug, Snafu)] +pub enum Error { + #[snafu(display("failed to create output renderer"))] + CreationError { source: tera::Error }, + + #[snafu(display("failed to render console output"))] + RenderError { source: tera::Error }, +} + +pub trait ContextExt { + fn into_context(self) -> tera::Context; +} + +pub struct Context {} + +#[derive(Debug, Default)] +pub struct SuccessContext { + pub used_operator_namespace: String, + pub used_product_namespace: String, - renderer.add_raw_templates(vec![(include_str!("templates/"))]); + pub post_hints: Vec, + pub pre_hints: Vec, + + pub output: String, +} + +impl ContextExt for SuccessContext { + fn into_context(self) -> tera::Context { + let mut ctx = tera::Context::new(); + + ctx.insert("default_operator_namespace", DEFAULT_OPERATOR_NAMESPACE); + ctx.insert("default_product_namespace", DEFAULT_PRODUCT_NAMESPACE); + + ctx.insert("used_operator_namespace", &self.used_operator_namespace); + ctx.insert("used_product_namespace", &self.used_product_namespace); + + ctx.insert("post_hints", &self.post_hints); + ctx.insert("pre_hints", &self.pre_hints); + + ctx.insert("output", &self.output); + + ctx + } +} + +impl SuccessContext { + pub fn new(output: String) -> Self { + Self { + output, + ..Default::default() + } + } + + pub fn add_pre_hint(&mut self, pre_hint: String) -> &mut Self { + self.pre_hints.push(pre_hint); + self + } + + pub fn add_post_hint(&mut self, post_hint: String) -> &mut Self { + self.post_hints.push(post_hint); + self + } +} + +pub struct OutputRenderer { + renderer: Tera, +} + +impl OutputRenderer { + pub fn new() -> Result { + let mut renderer = Tera::default(); renderer - }; + .add_raw_templates(vec![ + ( + "result_success", + include_str!("templates/result_success.tpl"), + ), + ("result_empty", include_str!("templates/result_empty.tpl")), + ]) + .context(CreationSnafu)?; + + Ok(Self { renderer }) + } + + pub fn success(&self, context: SuccessContext) -> Result { + self.renderer + .render("result_success", &context.into_context()) + .context(RenderSnafu) + } } -pub struct OutputRenderer {} +#[cfg(test)] +mod test { + use super::*; + + #[test] + fn simple() { + let renderer = OutputRenderer::new().unwrap(); + let mut context = SuccessContext::new("Eyyy yooo".into()); + + context + .add_pre_hint("This is pre hint number one".into()) + .add_pre_hint("Pre hint number two".into()); + + let out = renderer.success(context).unwrap(); + println!("{out}"); + } +} diff --git a/rust/stackablectl/src/output/templates/result_empty.tpl b/rust/stackablectl/src/output/templates/result_empty.tpl new file mode 100644 index 00000000..e69de29b diff --git a/rust/stackablectl/src/output/templates/result_success.tpl b/rust/stackablectl/src/output/templates/result_success.tpl new file mode 100644 index 00000000..8f3a5040 --- /dev/null +++ b/rust/stackablectl/src/output/templates/result_success.tpl @@ -0,0 +1,15 @@ +{% if pre_hints | length != 0 -%} +{% for pre_hint in pre_hints -%} +{{ pre_hint }} +{% endfor %} +{% endif -%} + +{%- if output | length != 0 %} +{{ output }} +{%- endif %} + +{% if post_hints | length != 0 -%} +{% for post_hint in post_hints -%} +{{ post_hint }} +{% endfor -%} +{% endif -%} From 817f8683e7d5142d7ad06d6a3bf064d6eb80c788 Mon Sep 17 00:00:00 2001 From: Techassi Date: Mon, 9 Oct 2023 14:14:22 +0200 Subject: [PATCH 03/40] Start to use unified console output --- rust/stackablectl/src/cli/mod.rs | 8 +- rust/stackablectl/src/cmds/cache.rs | 15 +- rust/stackablectl/src/cmds/demo.rs | 27 ++-- rust/stackablectl/src/cmds/operator.rs | 128 +++++++++++------ rust/stackablectl/src/output/mod.rs | 132 ++++++++++++------ .../src/output/templates/result_success.tpl | 6 + 6 files changed, 216 insertions(+), 100 deletions(-) diff --git a/rust/stackablectl/src/cli/mod.rs b/rust/stackablectl/src/cli/mod.rs index 17354b04..2e2bc2ed 100644 --- a/rust/stackablectl/src/cli/mod.rs +++ b/rust/stackablectl/src/cli/mod.rs @@ -23,6 +23,7 @@ use crate::{ REMOTE_RELEASE_FILE, REMOTE_STACK_FILE, USER_DIR_APPLICATION_NAME, USER_DIR_ORGANIZATION_NAME, USER_DIR_QUALIFIER, }, + output::Output, }; #[derive(Debug, Snafu)] @@ -189,9 +190,14 @@ impl Cli { Commands::Stacklet(args) => args.run(self).await.context(StackletSnafu), Commands::Demo(args) => args.run(self, cache).await.context(DemoSnafu), Commands::Completions(args) => args.run().context(CompletionsSnafu), - Commands::Cache(args) => args.run(cache).await.context(CacheSnafu), + Commands::Cache(args) => args.run(self, cache).await.context(CacheSnafu), } } + + // Output utility functions + pub fn output(&self) -> Output { + Output::new().unwrap() + } } #[derive(Debug, Subcommand)] diff --git a/rust/stackablectl/src/cmds/cache.rs b/rust/stackablectl/src/cmds/cache.rs index 28e63acb..7bd191b6 100644 --- a/rust/stackablectl/src/cmds/cache.rs +++ b/rust/stackablectl/src/cmds/cache.rs @@ -6,7 +6,7 @@ use snafu::{ResultExt, Snafu}; use stackable_cockpit::xfer::cache::{self, Cache, DeleteFilter}; use tracing::{info, instrument}; -use crate::cli::CacheSettingsError; +use crate::cli::{CacheSettingsError, Cli}; #[derive(Debug, Args)] pub struct CacheArgs { @@ -42,16 +42,16 @@ pub enum CmdError { } impl CacheArgs { - pub async fn run(&self, cache: Cache) -> Result { + pub async fn run(&self, cli: &Cli, cache: Cache) -> Result { match &self.subcommand { - CacheCommands::List => list_cmd(cache).await, + CacheCommands::List => list_cmd(cache, cli).await, CacheCommands::Clean(args) => clean_cmd(args, cache).await, } } } #[instrument(skip_all)] -async fn list_cmd(cache: Cache) -> Result { +async fn list_cmd(cache: Cache, cli: &Cli) -> Result { info!("Listing cached files"); let files = cache.list().await.context(CacheSnafu)?; @@ -77,7 +77,12 @@ async fn list_cmd(cache: Cache) -> Result { table.add_row(vec![file_path, format!("{modified} seconds ago")]); } - Ok(table.to_string()) + let mut output = cli.output(); + output + .add_command_hint("stackablectl cache clean", "to clean all cached files") + .set_output(table.to_string()); + + Ok(output.render()) } #[instrument(skip_all)] diff --git a/rust/stackablectl/src/cmds/demo.rs b/rust/stackablectl/src/cmds/demo.rs index b346d333..1d8b95db 100644 --- a/rust/stackablectl/src/cmds/demo.rs +++ b/rust/stackablectl/src/cmds/demo.rs @@ -148,32 +148,30 @@ pub enum CmdError { impl DemoArgs { #[instrument] - pub async fn run(&self, common_args: &Cli, cache: Cache) -> Result { + pub async fn run(&self, cli: &Cli, cache: Cache) -> Result { debug!("Handle demo args"); let transfer_client = FileTransferClient::new_with(cache); // Build demo list based on the (default) remote demo file, and additional files provided by the // STACKABLE_DEMO_FILES env variable or the --demo-files CLI argument. - let files = common_args.get_demo_files().context(PathOrUrlParseSnafu)?; + let files = cli.get_demo_files().context(PathOrUrlParseSnafu)?; let list = DemoList::build(&files, &transfer_client) .await .context(ListSnafu)?; match &self.subcommand { - DemoCommands::List(args) => list_cmd(args, list).await, + DemoCommands::List(args) => list_cmd(args, cli, list).await, DemoCommands::Describe(args) => describe_cmd(args, list).await, - DemoCommands::Install(args) => { - install_cmd(args, common_args, list, &transfer_client).await - } + DemoCommands::Install(args) => install_cmd(args, cli, list, &transfer_client).await, } } } /// Print out a list of demos, either as a table (plain), JSON or YAML #[instrument] -async fn list_cmd(args: &DemoListArgs, list: DemoList) -> Result { +async fn list_cmd(args: &DemoListArgs, cli: &Cli, list: DemoList) -> Result { info!("Listing demos"); match args.output_type { @@ -195,7 +193,20 @@ async fn list_cmd(args: &DemoListArgs, list: DemoList) -> Result", + "display further information for the specified demo", + ) + .add_command_hint( + "stackablectl demo install [OPTIONS] ", + "install a demo", + ) + .set_output(table.to_string()); + + Ok(output.render()) } OutputType::Json => serde_json::to_string(&list.inner()).context(JsonOutputFormatSnafu), OutputType::Yaml => serde_yaml::to_string(&list.inner()).context(YamlOutputFormatSnafu), diff --git a/rust/stackablectl/src/cmds/operator.rs b/rust/stackablectl/src/cmds/operator.rs index e9a62a29..23bdf76b 100644 --- a/rust/stackablectl/src/cmds/operator.rs +++ b/rust/stackablectl/src/cmds/operator.rs @@ -158,19 +158,19 @@ pub enum CmdError { pub struct OperatorVersionList(HashMap>); impl OperatorArgs { - pub async fn run(&self, common_args: &Cli) -> Result { + pub async fn run(&self, cli: &Cli) -> Result { match &self.subcommand { - OperatorCommands::List(args) => list_cmd(args, common_args).await, - OperatorCommands::Describe(args) => describe_cmd(args).await, - OperatorCommands::Install(args) => install_cmd(args, common_args).await, - OperatorCommands::Uninstall(args) => uninstall_cmd(args, common_args), - OperatorCommands::Installed(args) => installed_cmd(args, common_args), + OperatorCommands::List(args) => list_cmd(args, cli).await, + OperatorCommands::Describe(args) => describe_cmd(args, cli).await, + OperatorCommands::Install(args) => install_cmd(args, cli).await, + OperatorCommands::Uninstall(args) => uninstall_cmd(args, cli), + OperatorCommands::Installed(args) => installed_cmd(args, cli), } } } #[instrument] -async fn list_cmd(args: &OperatorListArgs, common_args: &Cli) -> Result { +async fn list_cmd(args: &OperatorListArgs, cli: &Cli) -> Result { debug!("Listing operators"); // Build map which maps Helm repo name to Helm repo URL @@ -201,7 +201,20 @@ async fn list_cmd(args: &OperatorListArgs, common_args: &Cli) -> Result", + "display further information for the specified operator", + ) + .add_command_hint( + "stackablectl operator install [OPTIONS] ...", + "install one or more operators", + ) + .set_output(table.to_string()); + + Ok(output.render()) } OutputType::Json => { Ok(serde_json::to_string(&versions_list).context(JsonOutputFormatSnafu)?) @@ -213,7 +226,7 @@ async fn list_cmd(args: &OperatorListArgs, common_args: &Cli) -> Result Result { +async fn describe_cmd(args: &OperatorDescribeArgs, cli: &Cli) -> Result { debug!("Describing operator {}", args.operator_name); // Build map which maps Helm repo name to Helm repo URL @@ -240,7 +253,6 @@ async fn describe_cmd(args: &OperatorDescribeArgs) -> Result { }; let mut table = Table::new(); - table .set_content_arrangement(ContentArrangement::Dynamic) .load_preset(NOTHING) @@ -249,7 +261,16 @@ async fn describe_cmd(args: &OperatorDescribeArgs) -> Result { .add_row(vec!["TEST VERSIONS", test_versions_string.as_str()]) .add_row(vec!["DEV VERSIONS", dev_versions_string.as_str()]); - Ok(table.to_string()) + let mut output = cli.output(); + + output + .add_command_hint( + format!("stackablectl operator install {}", args.operator_name), + "install the operator", + ) + .set_output(table.to_string()); + + Ok(output.render()) } OutputType::Json => serde_json::to_string(&versions_list).context(JsonOutputFormatSnafu), OutputType::Yaml => serde_yaml::to_string(&versions_list).context(YamlOutputFormatSnafu), @@ -257,19 +278,9 @@ async fn describe_cmd(args: &OperatorDescribeArgs) -> Result { } #[instrument] -async fn install_cmd(args: &OperatorInstallArgs, common_args: &Cli) -> Result { +async fn install_cmd(args: &OperatorInstallArgs, cli: &Cli) -> Result { info!("Installing operator(s)"); - println!( - "Installing {} {}", - args.operators.len(), - if args.operators.len() == 1 { - "operator" - } else { - "operators" - } - ); - args.local_cluster .install_if_needed(None) .await @@ -290,19 +301,28 @@ async fn install_cmd(args: &OperatorInstallArgs, common_args: &Cli) -> Result Result { +fn uninstall_cmd(args: &OperatorUninstallArgs, cli: &Cli) -> Result { info!("Uninstalling operator(s)"); for operator in &args.operators { @@ -311,19 +331,28 @@ fn uninstall_cmd(args: &OperatorUninstallArgs, common_args: &Cli) -> Result Result { +fn installed_cmd(args: &OperatorInstalledArgs, cli: &Cli) -> Result { debug!("Listing installed operators"); type ReleaseList = IndexMap; @@ -368,7 +397,20 @@ fn installed_cmd(args: &OperatorInstalledArgs, common_args: &Cli) -> Result...", + "install one or more additional operators", + ) + .add_command_hint( + "stackablectl operator uninstall [OPTIONS] ...", + "uninstall one or more operators", + ) + .set_output(table.to_string()); + + Ok(output.render()) } OutputType::Json => Ok(serde_json::to_string(&installed).context(JsonOutputFormatSnafu)?), OutputType::Yaml => Ok(serde_yaml::to_string(&installed).context(YamlOutputFormatSnafu)?), diff --git a/rust/stackablectl/src/output/mod.rs b/rust/stackablectl/src/output/mod.rs index 2b67305f..a42bbcd3 100644 --- a/rust/stackablectl/src/output/mod.rs +++ b/rust/stackablectl/src/output/mod.rs @@ -1,3 +1,4 @@ +use nu_ansi_term::Color::Green; use snafu::{ResultExt, Snafu}; use stackable_cockpit::constants::{DEFAULT_OPERATOR_NAMESPACE, DEFAULT_PRODUCT_NAMESPACE}; use tera::Tera; @@ -17,20 +18,19 @@ pub trait ContextExt { fn into_context(self) -> tera::Context; } -pub struct Context {} - #[derive(Debug, Default)] -pub struct SuccessContext { +pub struct Context { pub used_operator_namespace: String, pub used_product_namespace: String, + pub command_hints: Vec, pub post_hints: Vec, pub pre_hints: Vec, pub output: String, } -impl ContextExt for SuccessContext { +impl ContextExt for Context { fn into_context(self) -> tera::Context { let mut ctx = tera::Context::new(); @@ -40,6 +40,7 @@ impl ContextExt for SuccessContext { ctx.insert("used_operator_namespace", &self.used_operator_namespace); ctx.insert("used_product_namespace", &self.used_product_namespace); + ctx.insert("command_hints", &self.command_hints); ctx.insert("post_hints", &self.post_hints); ctx.insert("pre_hints", &self.pre_hints); @@ -49,32 +50,21 @@ impl ContextExt for SuccessContext { } } -impl SuccessContext { - pub fn new(output: String) -> Self { - Self { - output, - ..Default::default() - } - } - - pub fn add_pre_hint(&mut self, pre_hint: String) -> &mut Self { - self.pre_hints.push(pre_hint); - self - } - - pub fn add_post_hint(&mut self, post_hint: String) -> &mut Self { - self.post_hints.push(post_hint); - self - } -} - -pub struct OutputRenderer { +#[derive(Debug)] +pub struct Output { + context: Context, renderer: Tera, } -impl OutputRenderer { +impl Output { + /// Creates a new centralized [`Output`] facility, which allows printing + /// unified console output. Internally, it uses a templated renderer which + /// uses backed in templates to render the console output. The [`Context`] + /// values can be set using the appropriate associated functions, like + /// [`Output::add_pre_hint()`]. pub fn new() -> Result { let mut renderer = Tera::default(); + let context = Context::default(); renderer .add_raw_templates(vec![ @@ -86,30 +76,86 @@ impl OutputRenderer { ]) .context(CreationSnafu)?; - Ok(Self { renderer }) + Ok(Self { renderer, context }) } - pub fn success(&self, context: SuccessContext) -> Result { - self.renderer - .render("result_success", &context.into_context()) - .context(RenderSnafu) + /// Adds a hint which is printed **before** the main output. This can be + /// used to display hints or short messages in front of the main content. + /// Examples are: the current `stackablectl` version, execution time or + /// the current Kubernetes namespace. + pub fn add_pre_hint(&mut self, pre_hint: T) -> &mut Self + where + T: Into, + { + self.context.pre_hints.push(pre_hint.into()); + self + } + + /// Adds a hint which is printed **after** the main output. This can be + /// used to display hints or short messages after of the main content. + /// To print command recommendations, use [`Output::add_command_hint`]. + pub fn add_post_hint(&mut self, post_hint: T) -> &mut Self + where + T: Into, + { + self.context.post_hints.push(post_hint.into()); + self } -} -#[cfg(test)] -mod test { - use super::*; + /// Format a command hint. This will produce a sentence like 'Use \ + /// to \'. The `description` must start with lowercase letters, + /// must complete previosly mentioned sentence, and must not end with a period. + pub fn add_command_hint(&mut self, command: C, description: D) -> &mut Self + where + C: Into, + D: Into, + { + self.context.command_hints.push(format!( + "Use {} to {}.", + Green.bold().paint(format!("\"{}\"", command.into())), + description.into() + )); + self + } + + pub fn set_operator_namespace(&mut self, namespace: T) -> &mut Self + where + T: Into, + { + self.context.used_operator_namespace = namespace.into(); + self + } - #[test] - fn simple() { - let renderer = OutputRenderer::new().unwrap(); - let mut context = SuccessContext::new("Eyyy yooo".into()); + pub fn set_product_namespace(&mut self, namespace: T) -> &mut Self + where + T: Into, + { + self.context.used_product_namespace = namespace.into(); + self + } - context - .add_pre_hint("This is pre hint number one".into()) - .add_pre_hint("Pre hint number two".into()); + pub fn set_output(&mut self, output: T) -> &mut Self + where + T: Into, + { + self.context.output = output.into(); + self + } - let out = renderer.success(context).unwrap(); - println!("{out}"); + pub fn render(self) -> String { + // TODO (Techassi): Remove unwrap + self.renderer + .render("result_success", &self.context.into_context()) + .unwrap() } } + +/// Format a command hint. This will produce a sentence like 'Use \ +/// to \'. The `description` must start with lowercase letters, +/// must complete previosly mentioned sentence, and must not end with a period. +pub fn format_command_hint(command: T, description: T) -> String +where + T: AsRef, +{ + format!("Use \"{}\" to {}.", command.as_ref(), description.as_ref()) +} diff --git a/rust/stackablectl/src/output/templates/result_success.tpl b/rust/stackablectl/src/output/templates/result_success.tpl index 8f3a5040..c4d57e06 100644 --- a/rust/stackablectl/src/output/templates/result_success.tpl +++ b/rust/stackablectl/src/output/templates/result_success.tpl @@ -8,6 +8,12 @@ {{ output }} {%- endif %} +{% if command_hints | length != 0 -%} +{% for command_hint in command_hints -%} +{{ command_hint }} +{% endfor -%} +{% endif -%} + {% if post_hints | length != 0 -%} {% for post_hint in post_hints -%} {{ post_hint }} From 949a567861eefe794c0671562b4dfb1d2d39e9f1 Mon Sep 17 00:00:00 2001 From: Techassi Date: Mon, 9 Oct 2023 16:15:22 +0200 Subject: [PATCH 04/40] Add output for demo and release commands --- rust/stackablectl/src/cmds/demo.rs | 49 +++++++++++++------ rust/stackablectl/src/cmds/release.rs | 69 +++++++++++++++++++++------ 2 files changed, 89 insertions(+), 29 deletions(-) diff --git a/rust/stackablectl/src/cmds/demo.rs b/rust/stackablectl/src/cmds/demo.rs index 1d8b95db..59d8fd77 100644 --- a/rust/stackablectl/src/cmds/demo.rs +++ b/rust/stackablectl/src/cmds/demo.rs @@ -163,7 +163,7 @@ impl DemoArgs { match &self.subcommand { DemoCommands::List(args) => list_cmd(args, cli, list).await, - DemoCommands::Describe(args) => describe_cmd(args, list).await, + DemoCommands::Describe(args) => describe_cmd(args, cli, list).await, DemoCommands::Install(args) => install_cmd(args, cli, list, &transfer_client).await, } } @@ -215,7 +215,11 @@ async fn list_cmd(args: &DemoListArgs, cli: &Cli, list: DemoList) -> Result Result { +async fn describe_cmd( + args: &DemoDescribeArgs, + cli: &Cli, + list: DemoList, +) -> Result { info!("Describing demo {}", args.demo_name); let demo = list.get(&args.demo_name).ok_or(CmdError::NoSuchDemo { @@ -239,7 +243,16 @@ async fn describe_cmd(args: &DemoDescribeArgs, list: DemoList) -> Result serde_json::to_string(&demo).context(JsonOutputFormatSnafu), OutputType::Yaml => serde_yaml::to_string(&demo).context(YamlOutputFormatSnafu), @@ -250,7 +263,7 @@ async fn describe_cmd(args: &DemoDescribeArgs, list: DemoList) -> Result Result { @@ -261,14 +274,12 @@ async fn install_cmd( })?; // TODO (Techassi): Try to move all this boilerplate code to build the lists out of here - let files = common_args.get_stack_files().context(PathOrUrlParseSnafu)?; + let files = cli.get_stack_files().context(PathOrUrlParseSnafu)?; let stack_list = StackList::build(&files, transfer_client) .await .context(ListSnafu)?; - let files = common_args - .get_release_files() - .context(PathOrUrlParseSnafu)?; + let files = cli.get_release_files().context(PathOrUrlParseSnafu)?; let release_list = ReleaseList::build(&files, transfer_client) .await @@ -320,16 +331,19 @@ async fn install_cmd( .await .context(DemoSnafu)?; - let output = format!( - "Installed demo {}\n\n\ - Use \"stackablectl operator installed{}\" to display the installed operators\n\ - Use \"stackablectl stacklet list{}\" to display the installed stacklets", - args.demo_name, + let mut output = cli.output(); + + let operator_cmd = format!( + "stackablectl operator installed{}", if args.namespaces.operator_namespace.is_some() { format!(" --operator-namespace {}", operator_namespace) } else { "".into() - }, + } + ); + + let stacklet_cmd = format!( + "stackablectl stacklet list{}", if args.namespaces.product_namespace.is_some() { format!(" --product-namespace {}", product_namespace) } else { @@ -337,5 +351,10 @@ async fn install_cmd( } ); - Ok(output) + output + .add_command_hint(operator_cmd, "display the installed operators") + .add_command_hint(stacklet_cmd, "display the installed stacklets") + .set_output(format!("Installed demo '{}'", args.demo_name)); + + Ok(output.render()) } diff --git a/rust/stackablectl/src/cmds/release.rs b/rust/stackablectl/src/cmds/release.rs index 12d49b89..f15cd323 100644 --- a/rust/stackablectl/src/cmds/release.rs +++ b/rust/stackablectl/src/cmds/release.rs @@ -129,14 +129,12 @@ pub enum CmdError { } impl ReleaseArgs { - pub async fn run(&self, common_args: &Cli, cache: Cache) -> Result { + pub async fn run(&self, cli: &Cli, cache: Cache) -> Result { debug!("Handle release args"); let transfer_client = FileTransferClient::new_with(cache); - let files = common_args - .get_release_files() - .context(PathOrUrlParseSnafu)?; + let files = cli.get_release_files().context(PathOrUrlParseSnafu)?; let release_list = ReleaseList::build(&files, &transfer_client) .await @@ -147,16 +145,20 @@ impl ReleaseArgs { } match &self.subcommand { - ReleaseCommands::List(args) => list_cmd(args, release_list).await, - ReleaseCommands::Describe(args) => describe_cmd(args, release_list).await, - ReleaseCommands::Install(args) => install_cmd(args, common_args, release_list).await, - ReleaseCommands::Uninstall(args) => uninstall_cmd(args, release_list).await, + ReleaseCommands::List(args) => list_cmd(args, cli, release_list).await, + ReleaseCommands::Describe(args) => describe_cmd(args, cli, release_list).await, + ReleaseCommands::Install(args) => install_cmd(args, cli, release_list).await, + ReleaseCommands::Uninstall(args) => uninstall_cmd(args, cli, release_list).await, } } } #[instrument] -async fn list_cmd(args: &ReleaseListArgs, release_list: ReleaseList) -> Result { +async fn list_cmd( + args: &ReleaseListArgs, + cli: &Cli, + release_list: ReleaseList, +) -> Result { info!("Listing releases"); match args.output_type { @@ -181,7 +183,20 @@ async fn list_cmd(args: &ReleaseListArgs, release_list: ReleaseList) -> Result", + "display further information for the specified release", + ) + .add_command_hint( + "stackablectl release install [OPTIONS] ", + "install a release", + ) + .set_output(table.to_string()); + + Ok(output.render()) } OutputType::Json => serde_json::to_string(&release_list).context(JsonOutputFormatSnafu), OutputType::Yaml => serde_yaml::to_string(&release_list).context(YamlOutputFormatSnafu), @@ -191,6 +206,7 @@ async fn list_cmd(args: &ReleaseListArgs, release_list: ReleaseList) -> Result Result { info!("Describing release"); @@ -224,7 +240,16 @@ async fn describe_cmd( product_table.to_string().as_str(), ]); - Ok(table.to_string()) + let mut output = cli.output(); + + output + .add_command_hint( + format!("stackablectl release install {}", args.release), + "install the demo", + ) + .set_output(table.to_string()); + + Ok(output.render()) } OutputType::Json => serde_json::to_string(&release).context(JsonOutputFormatSnafu), OutputType::Yaml => serde_yaml::to_string(&release).context(YamlOutputFormatSnafu), @@ -236,7 +261,7 @@ async fn describe_cmd( #[instrument] async fn install_cmd( args: &ReleaseInstallArgs, - common_args: &Cli, + cli: &Cli, release_list: ReleaseList, ) -> Result { info!("Installing release"); @@ -264,7 +289,16 @@ async fn install_cmd( ) .context(ReleaseInstallSnafu)?; - Ok(format!("Installed release {}", args.release)) + let mut output = cli.output(); + + output + .add_command_hint( + "stackablectl operator installed", + "list installed operators", + ) + .set_output(format!("Installed release '{}'", args.release)); + + Ok(output.render()) } None => Ok("No such release".into()), } @@ -272,6 +306,7 @@ async fn install_cmd( async fn uninstall_cmd( args: &ReleaseUninstallArgs, + cli: &Cli, release_list: ReleaseList, ) -> Result { info!("Installing release"); @@ -282,7 +317,13 @@ async fn uninstall_cmd( .uninstall(&args.operator_namespace) .context(ReleaseUninstallSnafu)?; - Ok(format!("Uninstalled release {}", args.release)) + let mut output = cli.output(); + + output + .add_command_hint("stackablectl release list", "list available releases") + .set_output(format!("Uninstalled release '{}'", args.release)); + + Ok(output.render()) } None => Ok("No such release".into()), } From 8e6e9a1993fc973a13a6f232c683c1c4adc9cc95 Mon Sep 17 00:00:00 2001 From: Techassi Date: Tue, 10 Oct 2023 10:42:07 +0200 Subject: [PATCH 05/40] Finish result output --- rust/stackablectl/src/cmds/demo.rs | 1 + rust/stackablectl/src/cmds/operator.rs | 1 + rust/stackablectl/src/cmds/release.rs | 1 + rust/stackablectl/src/cmds/stack.rs | 75 ++++++++++++++++++-------- rust/stackablectl/src/cmds/stacklet.rs | 34 +++++++----- 5 files changed, 77 insertions(+), 35 deletions(-) diff --git a/rust/stackablectl/src/cmds/demo.rs b/rust/stackablectl/src/cmds/demo.rs index 59d8fd77..604edbb7 100644 --- a/rust/stackablectl/src/cmds/demo.rs +++ b/rust/stackablectl/src/cmds/demo.rs @@ -250,6 +250,7 @@ async fn describe_cmd( format!("stackablectl demo install {}", args.demo_name), "install the demo", ) + .add_command_hint("stackablectl demo list", "list all available demos") .set_output(table.to_string()); Ok(output.render()) diff --git a/rust/stackablectl/src/cmds/operator.rs b/rust/stackablectl/src/cmds/operator.rs index 23bdf76b..a966a320 100644 --- a/rust/stackablectl/src/cmds/operator.rs +++ b/rust/stackablectl/src/cmds/operator.rs @@ -268,6 +268,7 @@ async fn describe_cmd(args: &OperatorDescribeArgs, cli: &Cli) -> Result Result { + pub async fn run(&self, cli: &Cli, cache: Cache) -> Result { debug!("Handle stack args"); let transfer_client = FileTransferClient::new_with(cache); - let files = common_args.get_stack_files().context(PathOrUrlParseSnafu)?; + let files = cli.get_stack_files().context(PathOrUrlParseSnafu)?; let stack_list = StackList::build(&files, &transfer_client) .await .context(ListSnafu)?; match &self.subcommand { - StackCommands::List(args) => list_cmd(args, stack_list), - StackCommands::Describe(args) => describe_cmd(args, stack_list), + StackCommands::List(args) => list_cmd(args, cli, stack_list), + StackCommands::Describe(args) => describe_cmd(args, cli, stack_list), StackCommands::Install(args) => { - install_cmd(args, common_args, stack_list, &transfer_client).await + install_cmd(args, cli, stack_list, &transfer_client).await } } } } #[instrument] -fn list_cmd(args: &StackListArgs, stack_list: StackList) -> Result { +fn list_cmd(args: &StackListArgs, cli: &Cli, stack_list: StackList) -> Result { info!("Listing stacks"); match args.output_type { @@ -175,7 +175,20 @@ fn list_cmd(args: &StackListArgs, stack_list: StackList) -> Result", + "display further information for the specified stack", + ) + .add_command_hint( + "stackablectl stack install [OPTIONS] ...", + "install a stack", + ) + .set_output(table.to_string()); + + Ok(output.render()) } OutputType::Json => serde_json::to_string(&stack_list).context(JsonOutputFormatSnafu {}), OutputType::Yaml => serde_yaml::to_string(&stack_list).context(YamlOutputFormatSnafu {}), @@ -183,7 +196,11 @@ fn list_cmd(args: &StackListArgs, stack_list: StackList) -> Result Result { +fn describe_cmd( + args: &StackDescribeArgs, + cli: &Cli, + stack_list: StackList, +) -> Result { info!("Describing stack {}", args.stack_name); match stack_list.get(&args.stack_name) { @@ -216,7 +233,17 @@ fn describe_cmd(args: &StackDescribeArgs, stack_list: StackList) -> Result serde_json::to_string(&stack).context(JsonOutputFormatSnafu {}), OutputType::Yaml => serde_yaml::to_string(&stack).context(YamlOutputFormatSnafu {}), @@ -225,18 +252,16 @@ fn describe_cmd(args: &StackDescribeArgs, stack_list: StackList) -> Result Result { info!("Installing stack {}", args.stack_name); - let files = common_args - .get_release_files() - .context(PathOrUrlParseSnafu)?; + let files = cli.get_release_files().context(PathOrUrlParseSnafu)?; let release_list = ReleaseList::build(&files, transfer_client) .await @@ -301,16 +326,19 @@ async fn install_cmd( .await .context(StackSnafu)?; - let output = format!( - "Installed stack {}\n\n\ - Use \"stackablectl operator installed{}\" to display the installed operators\n\ - Use \"stackablectl stacklet list{}\" to display the installed stacklets", - args.stack_name, + let mut output = cli.output(); + + let operator_cmd = format!( + "stackablectl operator installed{}", if args.namespaces.operator_namespace.is_some() { format!(" --operator-namespace {}", operator_namespace) } else { "".into() - }, + } + ); + + let stacklet_cmd = format!( + "stackablectl stacklet list{}", if args.namespaces.product_namespace.is_some() { format!(" --product-namespace {}", product_namespace) } else { @@ -318,7 +346,12 @@ async fn install_cmd( } ); - Ok(output) + output + .add_command_hint(operator_cmd, "display the installed operators") + .add_command_hint(stacklet_cmd, "display the installed stacklets") + .set_output(format!("Installed stack '{}'", args.stack_name)); + + Ok(output.render()) } None => Ok("No such stack".into()), } diff --git a/rust/stackablectl/src/cmds/stacklet.rs b/rust/stackablectl/src/cmds/stacklet.rs index a5768237..45ab4293 100644 --- a/rust/stackablectl/src/cmds/stacklet.rs +++ b/rust/stackablectl/src/cmds/stacklet.rs @@ -19,8 +19,6 @@ use crate::{ utils::use_colored_output, }; -const CREDENTIALS_HINT: &str = "Use \"stackablectl stacklet credentials [OPTIONS] \" to display credentials for deployed stacklets."; - #[derive(Debug, Args)] pub struct StackletArgs { #[command(subcommand)] @@ -88,16 +86,16 @@ pub enum CmdError { } impl StackletArgs { - pub async fn run(&self, common_args: &Cli) -> Result { + pub async fn run(&self, cli: &Cli) -> Result { match &self.subcommand { - StackletCommands::List(args) => list_cmd(args, common_args).await, + StackletCommands::List(args) => list_cmd(args, cli).await, StackletCommands::Credentials(args) => credentials_cmd(args).await, } } } #[instrument] -async fn list_cmd(args: &StackletListArgs, common_args: &Cli) -> Result { +async fn list_cmd(args: &StackletListArgs, cli: &Cli) -> Result { info!("Listing installed stacklets"); // If the user wants to list stacklets from all namespaces, we use `None`. @@ -167,15 +165,23 @@ async fn list_cmd(args: &StackletListArgs, common_args: &Cli) -> Result ", + "display credentials for deployed stacklets", + ) + .set_output(format!( + "{table}{errors}", + errors = if !error_list.is_empty() { + format!("\n\n{}", error_list.join("\n")) + } else { + "".into() + } + )); + + Ok(output.render()) } OutputType::Json => serde_json::to_string(&stacklets).context(JsonOutputFormatSnafu), OutputType::Yaml => serde_yaml::to_string(&stacklets).context(YamlOutputFormatSnafu), From f24b2be924738efd0d39b6dc6c2cdd11389b2566 Mon Sep 17 00:00:00 2001 From: Techassi Date: Tue, 10 Oct 2023 12:47:43 +0200 Subject: [PATCH 06/40] Start refactoring of errors --- rust/stackable-cockpit/src/xfer/cache.rs | 4 ++-- rust/stackablectl/src/cmds/cache.rs | 7 ++----- rust/stackablectl/src/output/mod.rs | 7 ++----- .../src/output/templates/{result_empty.tpl => error.tpl} | 0 .../output/templates/{result_success.tpl => result.tpl} | 0 5 files changed, 6 insertions(+), 12 deletions(-) rename rust/stackablectl/src/output/templates/{result_empty.tpl => error.tpl} (100%) rename rust/stackablectl/src/output/templates/{result_success.tpl => result.tpl} (100%) diff --git a/rust/stackable-cockpit/src/xfer/cache.rs b/rust/stackable-cockpit/src/xfer/cache.rs index 66dcc277..fb6bee26 100644 --- a/rust/stackable-cockpit/src/xfer/cache.rs +++ b/rust/stackable-cockpit/src/xfer/cache.rs @@ -20,13 +20,13 @@ pub type Result = std::result::Result; #[derive(Debug, Snafu)] pub enum Error { - #[snafu(display("io error"))] + #[snafu(display("filesystem io error"))] CacheIoError { source: io::Error }, #[snafu(display("system time error"))] SystemTimeError { source: SystemTimeError }, - #[snafu(display("failed to parse string as integer"))] + #[snafu(display("failed to parse last auto-purge timestamp from file"))] ParseIntError { source: ParseIntError }, #[snafu(display("tried to write file with disabled cache"))] diff --git a/rust/stackablectl/src/cmds/cache.rs b/rust/stackablectl/src/cmds/cache.rs index 7bd191b6..7b92415a 100644 --- a/rust/stackablectl/src/cmds/cache.rs +++ b/rust/stackablectl/src/cmds/cache.rs @@ -6,7 +6,7 @@ use snafu::{ResultExt, Snafu}; use stackable_cockpit::xfer::cache::{self, Cache, DeleteFilter}; use tracing::{info, instrument}; -use crate::cli::{CacheSettingsError, Cli}; +use crate::cli::Cli; #[derive(Debug, Args)] pub struct CacheArgs { @@ -34,10 +34,7 @@ pub struct CacheCleanArgs { #[derive(Debug, Snafu)] pub enum CmdError { - #[snafu(display("cache settings error"))] - CacheSettingsError { source: CacheSettingsError }, - - #[snafu(display("cache error"))] + #[snafu(display("failed to read from cache"))] CacheError { source: cache::Error }, } diff --git a/rust/stackablectl/src/output/mod.rs b/rust/stackablectl/src/output/mod.rs index a42bbcd3..a4527181 100644 --- a/rust/stackablectl/src/output/mod.rs +++ b/rust/stackablectl/src/output/mod.rs @@ -68,11 +68,8 @@ impl Output { renderer .add_raw_templates(vec![ - ( - "result_success", - include_str!("templates/result_success.tpl"), - ), - ("result_empty", include_str!("templates/result_empty.tpl")), + ("result", include_str!("templates/result.tpl")), + ("error", include_str!("templates/error.tpl")), ]) .context(CreationSnafu)?; diff --git a/rust/stackablectl/src/output/templates/result_empty.tpl b/rust/stackablectl/src/output/templates/error.tpl similarity index 100% rename from rust/stackablectl/src/output/templates/result_empty.tpl rename to rust/stackablectl/src/output/templates/error.tpl diff --git a/rust/stackablectl/src/output/templates/result_success.tpl b/rust/stackablectl/src/output/templates/result.tpl similarity index 100% rename from rust/stackablectl/src/output/templates/result_success.tpl rename to rust/stackablectl/src/output/templates/result.tpl From 6f6d463718103c29a408645770bc12b43a55f18f Mon Sep 17 00:00:00 2001 From: Techassi Date: Mon, 16 Oct 2023 15:37:37 +0200 Subject: [PATCH 07/40] Make output generic over context --- extra/completions/_stackablectl | 32 ++- extra/completions/stackablectl.bash | 60 +++--- extra/completions/stackablectl.fish | 31 ++- extra/man/stackablectl.1 | 5 +- rust/stackablectl/README.md | 3 + rust/stackablectl/src/cli/mod.rs | 11 +- rust/stackablectl/src/cmds/cache.rs | 11 +- rust/stackablectl/src/cmds/completions.rs | 2 +- rust/stackablectl/src/cmds/demo.rs | 39 ++-- rust/stackablectl/src/cmds/operator.rs | 61 +++--- rust/stackablectl/src/cmds/release.rs | 48 +++-- rust/stackablectl/src/cmds/stack.rs | 39 ++-- rust/stackablectl/src/cmds/stacklet.rs | 18 +- rust/stackablectl/src/output/error.rs | 27 +++ rust/stackablectl/src/output/mod.rs | 189 +++++++----------- rust/stackablectl/src/output/result.rs | 56 ++++++ .../src/output/templates/error.tpl | 15 ++ 17 files changed, 393 insertions(+), 254 deletions(-) create mode 100644 rust/stackablectl/src/output/error.rs create mode 100644 rust/stackablectl/src/output/result.rs diff --git a/extra/completions/_stackablectl b/extra/completions/_stackablectl index 459b1484..52a30707 100644 --- a/extra/completions/_stackablectl +++ b/extra/completions/_stackablectl @@ -26,6 +26,7 @@ _stackablectl() { '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ +'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -54,6 +55,7 @@ _arguments "${_arguments_options[@]}" \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ +'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -89,6 +91,7 @@ yaml\:"Print output formatted as YAML"))' \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ +'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -116,6 +119,7 @@ yaml\:"Print output formatted as YAML"))' \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ +'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -147,6 +151,7 @@ minikube\:"Use a minikube cluster"))' \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ +'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -171,6 +176,7 @@ _arguments "${_arguments_options[@]}" \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ +'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -201,6 +207,7 @@ yaml\:"Print output formatted as YAML"))' \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ +'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -266,6 +273,7 @@ _arguments "${_arguments_options[@]}" \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ +'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -301,6 +309,7 @@ yaml\:"Print output formatted as YAML"))' \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ +'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -328,6 +337,7 @@ yaml\:"Print output formatted as YAML"))' \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ +'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -363,6 +373,7 @@ minikube\:"Use a minikube cluster"))' \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ +'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -387,6 +398,7 @@ _arguments "${_arguments_options[@]}" \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ +'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -449,6 +461,7 @@ _arguments "${_arguments_options[@]}" \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ +'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -484,6 +497,7 @@ yaml\:"Print output formatted as YAML"))' \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ +'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -511,6 +525,7 @@ yaml\:"Print output formatted as YAML"))' \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ +'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -548,6 +563,7 @@ minikube\:"Use a minikube cluster"))' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ '--skip-release[Skip the installation of the release during the stack install process]' \ +'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -606,6 +622,7 @@ _arguments "${_arguments_options[@]}" \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ +'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -638,6 +655,7 @@ _arguments "${_arguments_options[@]}" \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ +'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -672,8 +690,7 @@ yaml\:"Print output formatted as YAML"))' \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ -'-c[Controls if the output will use color. This only applies to the output type '\''plain'\'']' \ -'--color[Controls if the output will use color. This only applies to the output type '\''plain'\'']' \ +'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -727,6 +744,7 @@ _arguments "${_arguments_options[@]}" \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ +'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -762,6 +780,7 @@ yaml\:"Print output formatted as YAML"))' \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ +'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -789,6 +808,7 @@ yaml\:"Print output formatted as YAML"))' \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ +'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -826,6 +846,7 @@ minikube\:"Use a minikube cluster"))' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ '--skip-release[Skip the installation of the release during the stack install process]' \ +'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -884,6 +905,7 @@ _arguments "${_arguments_options[@]}" \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ +'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -913,6 +935,7 @@ _arguments "${_arguments_options[@]}" \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ +'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -934,6 +957,7 @@ _arguments "${_arguments_options[@]}" \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ +'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -955,6 +979,7 @@ _arguments "${_arguments_options[@]}" \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ +'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -1012,6 +1037,7 @@ _arguments "${_arguments_options[@]}" \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ +'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -1041,6 +1067,7 @@ _arguments "${_arguments_options[@]}" \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ +'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -1064,6 +1091,7 @@ _arguments "${_arguments_options[@]}" \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ '--old[Only remove outdated files in the cache]' \ '--outdated[Only remove outdated files in the cache]' \ +'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ diff --git a/extra/completions/stackablectl.bash b/extra/completions/stackablectl.bash index 23c52906..1f0768fa 100644 --- a/extra/completions/stackablectl.bash +++ b/extra/completions/stackablectl.bash @@ -307,7 +307,7 @@ _stackablectl() { case "${cmd}" in stackablectl) - opts="-l -d -s -r -h -V --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version operator release stack stacklet demo completions cache help" + opts="-l -d -s -r -h -V --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version operator release stack stacklet demo completions cache help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -365,7 +365,7 @@ _stackablectl() { return 0 ;; stackablectl__cache) - opts="-l -d -s -r -h -V --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version list clean help" + opts="-l -d -s -r -h -V --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version list clean help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -423,7 +423,7 @@ _stackablectl() { return 0 ;; stackablectl__cache__clean) - opts="-l -d -s -r -h -V --outdated --old --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" + opts="-l -d -s -r -h -V --outdated --old --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -537,7 +537,7 @@ _stackablectl() { return 0 ;; stackablectl__cache__list) - opts="-l -d -s -r -h -V --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" + opts="-l -d -s -r -h -V --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -595,7 +595,7 @@ _stackablectl() { return 0 ;; stackablectl__completions) - opts="-l -d -s -r -h -V --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version bash fish zsh help" + opts="-l -d -s -r -h -V --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version bash fish zsh help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -653,7 +653,7 @@ _stackablectl() { return 0 ;; stackablectl__completions__bash) - opts="-l -d -s -r -h -V --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" + opts="-l -d -s -r -h -V --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -711,7 +711,7 @@ _stackablectl() { return 0 ;; stackablectl__completions__fish) - opts="-l -d -s -r -h -V --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" + opts="-l -d -s -r -h -V --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -839,7 +839,7 @@ _stackablectl() { return 0 ;; stackablectl__completions__zsh) - opts="-l -d -s -r -h -V --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" + opts="-l -d -s -r -h -V --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -897,7 +897,7 @@ _stackablectl() { return 0 ;; stackablectl__demo) - opts="-l -d -s -r -h -V --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version list describe install help" + opts="-l -d -s -r -h -V --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version list describe install help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -955,7 +955,7 @@ _stackablectl() { return 0 ;; stackablectl__demo__describe) - opts="-o -l -d -s -r -h -V --output --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version " + opts="-o -l -d -s -r -h -V --output --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version " if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -1091,7 +1091,7 @@ _stackablectl() { return 0 ;; stackablectl__demo__install) - opts="-c -n -l -d -s -r -h -V --skip-release --stack-parameters --parameters --cluster --cluster-name --cluster-nodes --cluster-cp-nodes --operator-ns --operator-namespace --product-ns --product-namespace --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version " + opts="-c -n -l -d -s -r -h -V --skip-release --stack-parameters --parameters --cluster --cluster-name --cluster-nodes --cluster-cp-nodes --operator-ns --operator-namespace --product-ns --product-namespace --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version " if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -1197,7 +1197,7 @@ _stackablectl() { return 0 ;; stackablectl__demo__list) - opts="-o -l -d -s -r -h -V --output --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" + opts="-o -l -d -s -r -h -V --output --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -1697,7 +1697,7 @@ _stackablectl() { return 0 ;; stackablectl__operator) - opts="-l -d -s -r -h -V --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version list describe install uninstall installed help" + opts="-l -d -s -r -h -V --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version list describe install uninstall installed help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -1755,7 +1755,7 @@ _stackablectl() { return 0 ;; stackablectl__operator__describe) - opts="-o -l -d -s -r -h -V --output --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version " + opts="-o -l -d -s -r -h -V --output --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version " if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -1919,7 +1919,7 @@ _stackablectl() { return 0 ;; stackablectl__operator__install) - opts="-c -l -d -s -r -h -V --operator-ns --operator-namespace --cluster --cluster-name --cluster-nodes --cluster-cp-nodes --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version ..." + opts="-c -l -d -s -r -h -V --operator-ns --operator-namespace --cluster --cluster-name --cluster-nodes --cluster-cp-nodes --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version ..." if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -2005,7 +2005,7 @@ _stackablectl() { return 0 ;; stackablectl__operator__installed) - opts="-o -l -d -s -r -h -V --output --operator-ns --operator-namespace --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" + opts="-o -l -d -s -r -h -V --output --operator-ns --operator-namespace --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -2079,7 +2079,7 @@ _stackablectl() { return 0 ;; stackablectl__operator__list) - opts="-o -l -d -s -r -h -V --output --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" + opts="-o -l -d -s -r -h -V --output --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -2145,7 +2145,7 @@ _stackablectl() { return 0 ;; stackablectl__operator__uninstall) - opts="-l -d -s -r -h -V --operator-ns --operator-namespace --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version ..." + opts="-l -d -s -r -h -V --operator-ns --operator-namespace --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version ..." if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -2211,7 +2211,7 @@ _stackablectl() { return 0 ;; stackablectl__release) - opts="-l -d -s -r -h -V --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version list describe install uninstall help" + opts="-l -d -s -r -h -V --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version list describe install uninstall help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -2269,7 +2269,7 @@ _stackablectl() { return 0 ;; stackablectl__release__describe) - opts="-o -l -d -s -r -h -V --output --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version " + opts="-o -l -d -s -r -h -V --output --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version " if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -2419,7 +2419,7 @@ _stackablectl() { return 0 ;; stackablectl__release__install) - opts="-i -e -c -l -d -s -r -h -V --include --exclude --operator-ns --operator-namespace --cluster --cluster-name --cluster-nodes --cluster-cp-nodes --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version " + opts="-i -e -c -l -d -s -r -h -V --include --exclude --operator-ns --operator-namespace --cluster --cluster-name --cluster-nodes --cluster-cp-nodes --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version " if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -2521,7 +2521,7 @@ _stackablectl() { return 0 ;; stackablectl__release__list) - opts="-o -l -d -s -r -h -V --output --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" + opts="-o -l -d -s -r -h -V --output --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -2587,7 +2587,7 @@ _stackablectl() { return 0 ;; stackablectl__release__uninstall) - opts="-l -d -s -r -h -V --operator-ns --operator-namespace --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version " + opts="-l -d -s -r -h -V --operator-ns --operator-namespace --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version " if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -2653,7 +2653,7 @@ _stackablectl() { return 0 ;; stackablectl__stack) - opts="-l -d -s -r -h -V --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version list describe install help" + opts="-l -d -s -r -h -V --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version list describe install help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -2711,7 +2711,7 @@ _stackablectl() { return 0 ;; stackablectl__stack__describe) - opts="-o -l -d -s -r -h -V --output --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version " + opts="-o -l -d -s -r -h -V --output --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version " if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -2847,7 +2847,7 @@ _stackablectl() { return 0 ;; stackablectl__stack__install) - opts="-c -n -l -d -s -r -h -V --skip-release --stack-parameters --parameters --cluster --cluster-name --cluster-nodes --cluster-cp-nodes --operator-ns --operator-namespace --product-ns --product-namespace --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version " + opts="-c -n -l -d -s -r -h -V --skip-release --stack-parameters --parameters --cluster --cluster-name --cluster-nodes --cluster-cp-nodes --operator-ns --operator-namespace --product-ns --product-namespace --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version " if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -2953,7 +2953,7 @@ _stackablectl() { return 0 ;; stackablectl__stack__list) - opts="-o -l -d -s -r -h -V --output --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" + opts="-o -l -d -s -r -h -V --output --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -3019,7 +3019,7 @@ _stackablectl() { return 0 ;; stackablectl__stacklet) - opts="-l -d -s -r -h -V --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version credentials list help" + opts="-l -d -s -r -h -V --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version credentials list help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -3077,7 +3077,7 @@ _stackablectl() { return 0 ;; stackablectl__stacklet__credentials) - opts="-n -l -d -s -r -h -V --product-ns --product-namespace --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version " + opts="-n -l -d -s -r -h -V --product-ns --product-namespace --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version " if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -3203,7 +3203,7 @@ _stackablectl() { return 0 ;; stackablectl__stacklet__list) - opts="-c -o -n -l -d -s -r -h -V --color --output --operator-ns --operator-namespace --product-ns --product-namespace --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" + opts="-o -n -l -d -s -r -h -V --output --operator-ns --operator-namespace --product-ns --product-namespace --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 diff --git a/extra/completions/stackablectl.fish b/extra/completions/stackablectl.fish index 6a55948c..cffc541f 100644 --- a/extra/completions/stackablectl.fish +++ b/extra/completions/stackablectl.fish @@ -5,6 +5,7 @@ complete -c stackablectl -n "__fish_use_subcommand" -s r -l release-file -d 'Pro complete -c stackablectl -n "__fish_use_subcommand" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_use_subcommand" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_use_subcommand" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f +complete -c stackablectl -n "__fish_use_subcommand" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_use_subcommand" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_use_subcommand" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_use_subcommand" -s h -l help -d 'Print help (see more with \'--help\')' @@ -24,6 +25,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from operator; and not __fis complete -c stackablectl -n "__fish_seen_subcommand_from operator; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from installed; and not __fish_seen_subcommand_from help" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from operator; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from installed; and not __fish_seen_subcommand_from help" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from operator; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from installed; and not __fish_seen_subcommand_from help" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f +complete -c stackablectl -n "__fish_seen_subcommand_from operator; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from installed; and not __fish_seen_subcommand_from help" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from installed; and not __fish_seen_subcommand_from help" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from installed; and not __fish_seen_subcommand_from help" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from installed; and not __fish_seen_subcommand_from help" -s h -l help -d 'Print help (see more with \'--help\')' @@ -42,6 +44,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_se complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from list" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from list" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from list" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f +complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from list" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from list" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from list" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from list" -s h -l help -d 'Print help (see more with \'--help\')' @@ -54,6 +57,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_se complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from describe" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from describe" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from describe" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f +complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from describe" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from describe" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from describe" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from describe" -s h -l help -d 'Print help (see more with \'--help\')' @@ -70,6 +74,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_se complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from install" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from install" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from install" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f +complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from install" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from install" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from install" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from install" -s h -l help -d 'Print help (see more with \'--help\')' @@ -82,6 +87,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_se complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from uninstall" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from uninstall" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from uninstall" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f +complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from uninstall" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from uninstall" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from uninstall" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from uninstall" -s h -l help -d 'Print help (see more with \'--help\')' @@ -95,6 +101,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_se complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from installed" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from installed" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from installed" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f +complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from installed" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from installed" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from installed" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from installed" -s h -l help -d 'Print help (see more with \'--help\')' @@ -112,6 +119,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from release; and not __fish complete -c stackablectl -n "__fish_seen_subcommand_from release; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from help" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from release; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from help" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from release; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from help" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f +complete -c stackablectl -n "__fish_seen_subcommand_from release; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from help" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from release; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from help" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from release; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from help" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from release; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from help" -s h -l help -d 'Print help (see more with \'--help\')' @@ -129,6 +137,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_see complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from list" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from list" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from list" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f +complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from list" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from list" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from list" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from list" -s h -l help -d 'Print help (see more with \'--help\')' @@ -141,6 +150,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_see complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from describe" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from describe" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from describe" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f +complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from describe" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from describe" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from describe" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from describe" -s h -l help -d 'Print help (see more with \'--help\')' @@ -159,6 +169,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_see complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from install" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from install" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from install" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f +complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from install" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from install" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from install" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from install" -s h -l help -d 'Print help (see more with \'--help\')' @@ -171,6 +182,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_see complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from uninstall" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from uninstall" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from uninstall" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f +complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from uninstall" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from uninstall" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from uninstall" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from uninstall" -s h -l help -d 'Print help (see more with \'--help\')' @@ -187,6 +199,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from stack; and not __fish_s complete -c stackablectl -n "__fish_seen_subcommand_from stack; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from help" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from stack; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from help" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from stack; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from help" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f +complete -c stackablectl -n "__fish_seen_subcommand_from stack; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from help" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from stack; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from help" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from stack; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from help" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from stack; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from help" -s h -l help -d 'Print help (see more with \'--help\')' @@ -203,6 +216,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_ complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from list" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from list" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from list" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f +complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from list" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from list" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from list" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from list" -s h -l help -d 'Print help (see more with \'--help\')' @@ -215,6 +229,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_ complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from describe" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from describe" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from describe" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f +complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from describe" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from describe" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from describe" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from describe" -s h -l help -d 'Print help (see more with \'--help\')' @@ -235,6 +250,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_ complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from install" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from install" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from install" -l skip-release -d 'Skip the installation of the release during the stack install process' +complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from install" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from install" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from install" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from install" -s h -l help -d 'Print help (see more with \'--help\')' @@ -250,6 +266,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and not __fis complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and not __fish_seen_subcommand_from credentials; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from help" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and not __fish_seen_subcommand_from credentials; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from help" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and not __fish_seen_subcommand_from credentials; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from help" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f +complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and not __fish_seen_subcommand_from credentials; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from help" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and not __fish_seen_subcommand_from credentials; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from help" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and not __fish_seen_subcommand_from credentials; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from help" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and not __fish_seen_subcommand_from credentials; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from help" -s h -l help -d 'Print help (see more with \'--help\')' @@ -265,6 +282,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_se complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_seen_subcommand_from credentials" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_seen_subcommand_from credentials" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_seen_subcommand_from credentials" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f +complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_seen_subcommand_from credentials" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_seen_subcommand_from credentials" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_seen_subcommand_from credentials" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_seen_subcommand_from credentials" -s h -l help -d 'Print help (see more with \'--help\')' @@ -279,7 +297,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_se complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_seen_subcommand_from list" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_seen_subcommand_from list" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_seen_subcommand_from list" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f -complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_seen_subcommand_from list" -s c -l color -d 'Controls if the output will use color. This only applies to the output type \'plain\'' +complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_seen_subcommand_from list" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_seen_subcommand_from list" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_seen_subcommand_from list" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_seen_subcommand_from list" -s h -l help -d 'Print help (see more with \'--help\')' @@ -294,6 +312,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from demo; and not __fish_se complete -c stackablectl -n "__fish_seen_subcommand_from demo; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from help" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from demo; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from help" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from demo; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from help" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f +complete -c stackablectl -n "__fish_seen_subcommand_from demo; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from help" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from demo; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from help" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from demo; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from help" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from demo; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from help" -s h -l help -d 'Print help (see more with \'--help\')' @@ -310,6 +329,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_s complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from list" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from list" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from list" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f +complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from list" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from list" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from list" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from list" -s h -l help -d 'Print help (see more with \'--help\')' @@ -322,6 +342,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_s complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from describe" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from describe" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from describe" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f +complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from describe" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from describe" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from describe" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from describe" -s h -l help -d 'Print help (see more with \'--help\')' @@ -342,6 +363,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_s complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from install" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from install" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from install" -l skip-release -d 'Skip the installation of the release during the stack install process' +complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from install" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from install" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from install" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from install" -s h -l help -d 'Print help (see more with \'--help\')' @@ -357,6 +379,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from completions; and not __ complete -c stackablectl -n "__fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from bash; and not __fish_seen_subcommand_from fish; and not __fish_seen_subcommand_from zsh; and not __fish_seen_subcommand_from help" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from bash; and not __fish_seen_subcommand_from fish; and not __fish_seen_subcommand_from zsh; and not __fish_seen_subcommand_from help" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from bash; and not __fish_seen_subcommand_from fish; and not __fish_seen_subcommand_from zsh; and not __fish_seen_subcommand_from help" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f +complete -c stackablectl -n "__fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from bash; and not __fish_seen_subcommand_from fish; and not __fish_seen_subcommand_from zsh; and not __fish_seen_subcommand_from help" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from bash; and not __fish_seen_subcommand_from fish; and not __fish_seen_subcommand_from zsh; and not __fish_seen_subcommand_from help" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from bash; and not __fish_seen_subcommand_from fish; and not __fish_seen_subcommand_from zsh; and not __fish_seen_subcommand_from help" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from bash; and not __fish_seen_subcommand_from fish; and not __fish_seen_subcommand_from zsh; and not __fish_seen_subcommand_from help" -s h -l help -d 'Print help (see more with \'--help\')' @@ -372,6 +395,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from bash" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from bash" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from bash" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f +complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from bash" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from bash" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from bash" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from bash" -s h -l help -d 'Print help (see more with \'--help\')' @@ -383,6 +407,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from fish" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from fish" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from fish" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f +complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from fish" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from fish" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from fish" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from fish" -s h -l help -d 'Print help (see more with \'--help\')' @@ -394,6 +419,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from zsh" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from zsh" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from zsh" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f +complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from zsh" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from zsh" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from zsh" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from zsh" -s h -l help -d 'Print help (see more with \'--help\')' @@ -409,6 +435,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from cache; and not __fish_s complete -c stackablectl -n "__fish_seen_subcommand_from cache; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from clean; and not __fish_seen_subcommand_from help" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from cache; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from clean; and not __fish_seen_subcommand_from help" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from cache; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from clean; and not __fish_seen_subcommand_from help" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f +complete -c stackablectl -n "__fish_seen_subcommand_from cache; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from clean; and not __fish_seen_subcommand_from help" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from cache; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from clean; and not __fish_seen_subcommand_from help" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from cache; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from clean; and not __fish_seen_subcommand_from help" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from cache; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from clean; and not __fish_seen_subcommand_from help" -s h -l help -d 'Print help (see more with \'--help\')' @@ -423,6 +450,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from cache; and __fish_seen_ complete -c stackablectl -n "__fish_seen_subcommand_from cache; and __fish_seen_subcommand_from list" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from cache; and __fish_seen_subcommand_from list" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from cache; and __fish_seen_subcommand_from list" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f +complete -c stackablectl -n "__fish_seen_subcommand_from cache; and __fish_seen_subcommand_from list" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from cache; and __fish_seen_subcommand_from list" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from cache; and __fish_seen_subcommand_from list" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from cache; and __fish_seen_subcommand_from list" -s h -l help -d 'Print help (see more with \'--help\')' @@ -435,6 +463,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from cache; and __fish_seen_ complete -c stackablectl -n "__fish_seen_subcommand_from cache; and __fish_seen_subcommand_from clean" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from cache; and __fish_seen_subcommand_from clean" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from cache; and __fish_seen_subcommand_from clean" -l old -l outdated -d 'Only remove outdated files in the cache' +complete -c stackablectl -n "__fish_seen_subcommand_from cache; and __fish_seen_subcommand_from clean" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from cache; and __fish_seen_subcommand_from clean" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from cache; and __fish_seen_subcommand_from clean" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from cache; and __fish_seen_subcommand_from clean" -s h -l help -d 'Print help (see more with \'--help\')' diff --git a/extra/man/stackablectl.1 b/extra/man/stackablectl.1 index c251c5b8..139ed406 100644 --- a/extra/man/stackablectl.1 +++ b/extra/man/stackablectl.1 @@ -4,7 +4,7 @@ .SH NAME stackablectl \- Command line tool to interact with the Stackable Data Platform .SH SYNOPSIS -\fBstackablectl\fR [\fB\-l\fR|\fB\-\-log\-level\fR] [\fB\-\-no\-cache\fR] [\fB\-\-offline\fR] [\fB\-d\fR|\fB\-\-demo\-file\fR] [\fB\-s\fR|\fB\-\-stack\-file\fR] [\fB\-r\fR|\fB\-\-release\-file\fR] [\fB\-\-helm\-repo\-stable\fR] [\fB\-\-helm\-repo\-test\fR] [\fB\-\-helm\-repo\-dev\fR] [\fB\-h\fR|\fB\-\-help\fR] [\fB\-V\fR|\fB\-\-version\fR] <\fIsubcommands\fR> +\fBstackablectl\fR [\fB\-l\fR|\fB\-\-log\-level\fR] [\fB\-\-no\-color\fR] [\fB\-\-no\-cache\fR] [\fB\-\-offline\fR] [\fB\-d\fR|\fB\-\-demo\-file\fR] [\fB\-s\fR|\fB\-\-stack\-file\fR] [\fB\-r\fR|\fB\-\-release\-file\fR] [\fB\-\-helm\-repo\-stable\fR] [\fB\-\-helm\-repo\-test\fR] [\fB\-\-helm\-repo\-dev\fR] [\fB\-h\fR|\fB\-\-help\fR] [\fB\-V\fR|\fB\-\-version\fR] <\fIsubcommands\fR> .SH DESCRIPTION Command line tool to interact with the Stackable Data Platform .SH OPTIONS @@ -12,6 +12,9 @@ Command line tool to interact with the Stackable Data Platform \fB\-l\fR, \fB\-\-log\-level\fR=\fILOG_LEVEL\fR Log level this application uses .TP +\fB\-\-no\-color\fR +Disable colored output +.TP \fB\-\-no\-cache\fR Do not cache the remote (default) demo, stack and release files diff --git a/rust/stackablectl/README.md b/rust/stackablectl/README.md index 54e6de31..478eebe7 100644 --- a/rust/stackablectl/README.md +++ b/rust/stackablectl/README.md @@ -28,6 +28,9 @@ Options: -l, --log-level Log level this application uses + --no-color + Disable colored output + --no-cache Do not cache the remote (default) demo, stack and release files diff --git a/rust/stackablectl/src/cli/mod.rs b/rust/stackablectl/src/cli/mod.rs index 2e2bc2ed..5dab91de 100644 --- a/rust/stackablectl/src/cli/mod.rs +++ b/rust/stackablectl/src/cli/mod.rs @@ -23,7 +23,7 @@ use crate::{ REMOTE_RELEASE_FILE, REMOTE_STACK_FILE, USER_DIR_APPLICATION_NAME, USER_DIR_ORGANIZATION_NAME, USER_DIR_QUALIFIER, }, - output::Output, + output::{Output, ResultContext}, }; #[derive(Debug, Snafu)] @@ -60,6 +60,10 @@ pub struct Cli { #[arg(short, long, global = true)] pub log_level: Option, + /// Disable colored output. + #[arg(long, global = true)] + pub no_color: bool, + /// Do not cache the remote (default) demo, stack and release files #[arg( long, @@ -195,8 +199,9 @@ impl Cli { } // Output utility functions - pub fn output(&self) -> Output { - Output::new().unwrap() + pub fn result(&self) -> Output { + // TODO (Techassi): Remove unwrap + Output::result(ResultContext::default(), self.no_color).unwrap() } } diff --git a/rust/stackablectl/src/cmds/cache.rs b/rust/stackablectl/src/cmds/cache.rs index 7b92415a..ce12c18f 100644 --- a/rust/stackablectl/src/cmds/cache.rs +++ b/rust/stackablectl/src/cmds/cache.rs @@ -74,12 +74,13 @@ async fn list_cmd(cache: Cache, cli: &Cli) -> Result { table.add_row(vec![file_path, format!("{modified} seconds ago")]); } - let mut output = cli.output(); - output - .add_command_hint("stackablectl cache clean", "to clean all cached files") - .set_output(table.to_string()); + let mut result = cli.result(); - Ok(output.render()) + result + .with_command_hint("stackablectl cache clean", "to clean all cached files") + .with_output(table.to_string()); + + Ok(result.render().unwrap()) } #[instrument(skip_all)] diff --git a/rust/stackablectl/src/cmds/completions.rs b/rust/stackablectl/src/cmds/completions.rs index 72446792..9c2eef91 100644 --- a/rust/stackablectl/src/cmds/completions.rs +++ b/rust/stackablectl/src/cmds/completions.rs @@ -24,7 +24,7 @@ pub enum CompletionCommands { #[derive(Debug, Snafu)] pub enum CmdError { - #[snafu(display("string error: {source}"))] + #[snafu(display("failed to convert completion outout into string: {source}"))] StringError { source: std::string::FromUtf8Error }, } diff --git a/rust/stackablectl/src/cmds/demo.rs b/rust/stackablectl/src/cmds/demo.rs index 604edbb7..9c55ffe4 100644 --- a/rust/stackablectl/src/cmds/demo.rs +++ b/rust/stackablectl/src/cmds/demo.rs @@ -193,20 +193,21 @@ async fn list_cmd(args: &DemoListArgs, cli: &Cli, list: DemoList) -> Result", "display further information for the specified demo", ) - .add_command_hint( + .with_command_hint( "stackablectl demo install [OPTIONS] ", "install a demo", ) - .set_output(table.to_string()); + .with_output(table.to_string()); - Ok(output.render()) + // TODO (Techassi): Remove unwrap + Ok(result.render().unwrap()) } OutputType::Json => serde_json::to_string(&list.inner()).context(JsonOutputFormatSnafu), OutputType::Yaml => serde_yaml::to_string(&list.inner()).context(YamlOutputFormatSnafu), @@ -243,17 +244,18 @@ async fn describe_cmd( // TODO (Techassi): Add parameter output - let mut output = cli.output(); + let mut result = cli.result(); - output - .add_command_hint( + result + .with_command_hint( format!("stackablectl demo install {}", args.demo_name), "install the demo", ) - .add_command_hint("stackablectl demo list", "list all available demos") - .set_output(table.to_string()); + .with_command_hint("stackablectl demo list", "list all available demos") + .with_output(table.to_string()); - Ok(output.render()) + // TODO (Techassi): Remove unwrap + Ok(result.render().unwrap()) } OutputType::Json => serde_json::to_string(&demo).context(JsonOutputFormatSnafu), OutputType::Yaml => serde_yaml::to_string(&demo).context(YamlOutputFormatSnafu), @@ -332,7 +334,7 @@ async fn install_cmd( .await .context(DemoSnafu)?; - let mut output = cli.output(); + let mut result = cli.result(); let operator_cmd = format!( "stackablectl operator installed{}", @@ -352,10 +354,11 @@ async fn install_cmd( } ); - output - .add_command_hint(operator_cmd, "display the installed operators") - .add_command_hint(stacklet_cmd, "display the installed stacklets") - .set_output(format!("Installed demo '{}'", args.demo_name)); + result + .with_command_hint(operator_cmd, "display the installed operators") + .with_command_hint(stacklet_cmd, "display the installed stacklets") + .with_output(format!("Installed demo '{}'", args.demo_name)); - Ok(output.render()) + // TODO (Techassi): Remove unwrap + Ok(result.render().unwrap()) } diff --git a/rust/stackablectl/src/cmds/operator.rs b/rust/stackablectl/src/cmds/operator.rs index a966a320..9766d3ee 100644 --- a/rust/stackablectl/src/cmds/operator.rs +++ b/rust/stackablectl/src/cmds/operator.rs @@ -201,20 +201,21 @@ async fn list_cmd(args: &OperatorListArgs, cli: &Cli) -> Result", "display further information for the specified operator", ) - .add_command_hint( + .with_command_hint( "stackablectl operator install [OPTIONS] ...", "install one or more operators", ) - .set_output(table.to_string()); + .with_output(table.to_string()); - Ok(output.render()) + // TODO (Techassi): Remove unwrap + Ok(result.render().unwrap()) } OutputType::Json => { Ok(serde_json::to_string(&versions_list).context(JsonOutputFormatSnafu)?) @@ -261,17 +262,18 @@ async fn describe_cmd(args: &OperatorDescribeArgs, cli: &Cli) -> Result serde_json::to_string(&versions_list).context(JsonOutputFormatSnafu), OutputType::Yaml => serde_yaml::to_string(&versions_list).context(YamlOutputFormatSnafu), @@ -302,14 +304,14 @@ async fn install_cmd(args: &OperatorInstallArgs, cli: &Cli) -> Result Result Result Result Result...", "install one or more additional operators", ) - .add_command_hint( + .with_command_hint( "stackablectl operator uninstall [OPTIONS] ...", "uninstall one or more operators", ) - .set_output(table.to_string()); + .with_output(table.to_string()); - Ok(output.render()) + // TODO (Techassi): Remove unwrap + Ok(result.render().unwrap()) } OutputType::Json => Ok(serde_json::to_string(&installed).context(JsonOutputFormatSnafu)?), OutputType::Yaml => Ok(serde_yaml::to_string(&installed).context(YamlOutputFormatSnafu)?), diff --git a/rust/stackablectl/src/cmds/release.rs b/rust/stackablectl/src/cmds/release.rs index 0fa0f3f4..f06b7493 100644 --- a/rust/stackablectl/src/cmds/release.rs +++ b/rust/stackablectl/src/cmds/release.rs @@ -183,20 +183,21 @@ async fn list_cmd( ]); } - let mut output = cli.output(); + let mut result = cli.result(); - output - .add_command_hint( + result + .with_command_hint( "stackablectl release describe [OPTIONS] ", "display further information for the specified release", ) - .add_command_hint( + .with_command_hint( "stackablectl release install [OPTIONS] ", "install a release", ) - .set_output(table.to_string()); + .with_output(table.to_string()); - Ok(output.render()) + // TODO (Techassi): Remove unwrap + Ok(result.render().unwrap()) } OutputType::Json => serde_json::to_string(&release_list).context(JsonOutputFormatSnafu), OutputType::Yaml => serde_yaml::to_string(&release_list).context(YamlOutputFormatSnafu), @@ -240,17 +241,18 @@ async fn describe_cmd( product_table.to_string().as_str(), ]); - let mut output = cli.output(); + let mut result = cli.result(); - output - .add_command_hint( + result + .with_command_hint( format!("stackablectl release install {}", args.release), "install the demo", ) - .add_command_hint("stackablectl release list", "list all available releases") - .set_output(table.to_string()); + .with_command_hint("stackablectl release list", "list all available releases") + .with_output(table.to_string()); - Ok(output.render()) + // TODO (Techassi): Remove unwrap + Ok(result.render().unwrap()) } OutputType::Json => serde_json::to_string(&release).context(JsonOutputFormatSnafu), OutputType::Yaml => serde_yaml::to_string(&release).context(YamlOutputFormatSnafu), @@ -290,16 +292,17 @@ async fn install_cmd( ) .context(ReleaseInstallSnafu)?; - let mut output = cli.output(); + let mut result = cli.result(); - output - .add_command_hint( + result + .with_command_hint( "stackablectl operator installed", "list installed operators", ) - .set_output(format!("Installed release '{}'", args.release)); + .with_output(format!("Installed release '{}'", args.release)); - Ok(output.render()) + // TODO (Techassi): Remove unwrap + Ok(result.render().unwrap()) } None => Ok("No such release".into()), } @@ -318,13 +321,14 @@ async fn uninstall_cmd( .uninstall(&args.operator_namespace) .context(ReleaseUninstallSnafu)?; - let mut output = cli.output(); + let mut result = cli.result(); - output - .add_command_hint("stackablectl release list", "list available releases") - .set_output(format!("Uninstalled release '{}'", args.release)); + result + .with_command_hint("stackablectl release list", "list available releases") + .with_output(format!("Uninstalled release '{}'", args.release)); - Ok(output.render()) + // TODO (Techassi): Remove unwrap + Ok(result.render().unwrap()) } None => Ok("No such release".into()), } diff --git a/rust/stackablectl/src/cmds/stack.rs b/rust/stackablectl/src/cmds/stack.rs index 9c9c5a82..de071410 100644 --- a/rust/stackablectl/src/cmds/stack.rs +++ b/rust/stackablectl/src/cmds/stack.rs @@ -175,20 +175,21 @@ fn list_cmd(args: &StackListArgs, cli: &Cli, stack_list: StackList) -> Result", "display further information for the specified stack", ) - .add_command_hint( + .with_command_hint( "stackablectl stack install [OPTIONS] ...", "install a stack", ) - .set_output(table.to_string()); + .with_output(table.to_string()); - Ok(output.render()) + // TODO (Techassi): Remove unwrap + Ok(result.render().unwrap()) } OutputType::Json => serde_json::to_string(&stack_list).context(JsonOutputFormatSnafu {}), OutputType::Yaml => serde_yaml::to_string(&stack_list).context(YamlOutputFormatSnafu {}), @@ -233,17 +234,18 @@ fn describe_cmd( .add_row(vec!["LABELS", stack.labels.join(", ").as_str()]) .add_row(vec!["PARAMETERS", parameter_table.to_string().as_str()]); - let mut output = cli.output(); + let mut result = cli.result(); - output - .add_command_hint( + result + .with_command_hint( format!("stackablectl stack install {}", args.stack_name), "install the stack", ) - .add_command_hint("stackablectl stack list", "list all available stacks") - .set_output(table.to_string()); + .with_command_hint("stackablectl stack list", "list all available stacks") + .with_output(table.to_string()); - Ok(output.render()) + // TODO (Techassi): Remove unwrap + Ok(result.render().unwrap()) } OutputType::Json => serde_json::to_string(&stack).context(JsonOutputFormatSnafu {}), OutputType::Yaml => serde_yaml::to_string(&stack).context(YamlOutputFormatSnafu {}), @@ -326,7 +328,7 @@ async fn install_cmd( .await .context(StackSnafu)?; - let mut output = cli.output(); + let mut result = cli.result(); let operator_cmd = format!( "stackablectl operator installed{}", @@ -346,12 +348,13 @@ async fn install_cmd( } ); - output - .add_command_hint(operator_cmd, "display the installed operators") - .add_command_hint(stacklet_cmd, "display the installed stacklets") - .set_output(format!("Installed stack '{}'", args.stack_name)); + result + .with_command_hint(operator_cmd, "display the installed operators") + .with_command_hint(stacklet_cmd, "display the installed stacklets") + .with_output(format!("Installed stack '{}'", args.stack_name)); - Ok(output.render()) + // TODO (Techassi): Remove unwrap + Ok(result.render().unwrap()) } None => Ok("No such stack".into()), } diff --git a/rust/stackablectl/src/cmds/stacklet.rs b/rust/stackablectl/src/cmds/stacklet.rs index 45ab4293..523f7b19 100644 --- a/rust/stackablectl/src/cmds/stacklet.rs +++ b/rust/stackablectl/src/cmds/stacklet.rs @@ -58,11 +58,6 @@ a different namespace for credential lookup.")] #[derive(Debug, Args)] pub struct StackletListArgs { - /// Controls if the output will use color. This only applies to the output - /// type 'plain'. - #[arg(short = 'c', long = "color")] - use_color: bool, - #[arg(short, long = "output", value_enum, default_value_t)] output_type: OutputType, @@ -113,7 +108,7 @@ async fn list_cmd(args: &StackletListArgs, cli: &Cli) -> Result { // Determine if colored output will be enabled based on the provided // flag and the terminal support. - let use_color = use_colored_output(args.use_color); + let use_color = use_colored_output(!cli.no_color); // The main table displays all installed (and discovered) stacklets // and their condition. @@ -165,14 +160,14 @@ async fn list_cmd(args: &StackletListArgs, cli: &Cli) -> Result ", "display credentials for deployed stacklets", ) - .set_output(format!( + .with_output(format!( "{table}{errors}", errors = if !error_list.is_empty() { format!("\n\n{}", error_list.join("\n")) @@ -181,7 +176,8 @@ async fn list_cmd(args: &StackletListArgs, cli: &Cli) -> Result serde_json::to_string(&stacklets).context(JsonOutputFormatSnafu), OutputType::Yaml => serde_yaml::to_string(&stacklets).context(YamlOutputFormatSnafu), diff --git a/rust/stackablectl/src/output/error.rs b/rust/stackablectl/src/output/error.rs new file mode 100644 index 00000000..e87400a1 --- /dev/null +++ b/rust/stackablectl/src/output/error.rs @@ -0,0 +1,27 @@ +use stackable_cockpit::constants::{DEFAULT_OPERATOR_NAMESPACE, DEFAULT_PRODUCT_NAMESPACE}; + +use crate::output::ContextExt; + +#[derive(Debug, Default)] +pub struct ErrorContext { + pub post_hints: Vec, + pub pre_hints: Vec, + + pub error_report: String, +} + +impl ContextExt for ErrorContext { + fn into_context(self) -> tera::Context { + let mut ctx = tera::Context::new(); + + ctx.insert("default_operator_namespace", DEFAULT_OPERATOR_NAMESPACE); + ctx.insert("default_product_namespace", DEFAULT_PRODUCT_NAMESPACE); + + ctx.insert("post_hints", &self.post_hints); + ctx.insert("pre_hints", &self.pre_hints); + + ctx.insert("error_report", &self.error_report); + + ctx + } +} diff --git a/rust/stackablectl/src/output/mod.rs b/rust/stackablectl/src/output/mod.rs index a4527181..ca9fab5d 100644 --- a/rust/stackablectl/src/output/mod.rs +++ b/rust/stackablectl/src/output/mod.rs @@ -1,8 +1,16 @@ -use nu_ansi_term::Color::Green; +use std::ops::{Deref, DerefMut}; + use snafu::{ResultExt, Snafu}; -use stackable_cockpit::constants::{DEFAULT_OPERATOR_NAMESPACE, DEFAULT_PRODUCT_NAMESPACE}; use tera::Tera; +mod error; +mod result; + +pub use error::ErrorContext; +pub use result::ResultContext; + +use crate::utils::use_colored_output; + pub type Result = std::result::Result; #[derive(Debug, Snafu)] @@ -14,57 +22,51 @@ pub enum Error { RenderError { source: tera::Error }, } +#[derive(Debug)] +pub enum OutputKind { + Result(C), + Error(C), +} + pub trait ContextExt { fn into_context(self) -> tera::Context; } -#[derive(Debug, Default)] -pub struct Context { - pub used_operator_namespace: String, - pub used_product_namespace: String, - - pub command_hints: Vec, - pub post_hints: Vec, - pub pre_hints: Vec, - - pub output: String, +#[derive(Debug)] +pub struct Output +where + C: ContextExt, +{ + kind: OutputKind, + no_color: bool, + renderer: Tera, } -impl ContextExt for Context { - fn into_context(self) -> tera::Context { - let mut ctx = tera::Context::new(); - - ctx.insert("default_operator_namespace", DEFAULT_OPERATOR_NAMESPACE); - ctx.insert("default_product_namespace", DEFAULT_PRODUCT_NAMESPACE); - - ctx.insert("used_operator_namespace", &self.used_operator_namespace); - ctx.insert("used_product_namespace", &self.used_product_namespace); - - ctx.insert("command_hints", &self.command_hints); - ctx.insert("post_hints", &self.post_hints); - ctx.insert("pre_hints", &self.pre_hints); - - ctx.insert("output", &self.output); +impl Output +where + C: ContextExt, +{ + pub fn new(kind: OutputKind, no_color: bool) -> Result { + let renderer = Self::create_renderer()?; + let no_color = use_colored_output(!no_color); + + Ok(Self { + no_color, + renderer, + kind, + }) + } - ctx + pub fn result(context: C, no_color: bool) -> Result { + Self::new(OutputKind::Result(context), no_color) } -} -#[derive(Debug)] -pub struct Output { - context: Context, - renderer: Tera, -} + pub fn error(context: C, no_color: bool) -> Result { + Self::new(OutputKind::Error(context), no_color) + } -impl Output { - /// Creates a new centralized [`Output`] facility, which allows printing - /// unified console output. Internally, it uses a templated renderer which - /// uses backed in templates to render the console output. The [`Context`] - /// values can be set using the appropriate associated functions, like - /// [`Output::add_pre_hint()`]. - pub fn new() -> Result { + fn create_renderer() -> Result { let mut renderer = Tera::default(); - let context = Context::default(); renderer .add_raw_templates(vec![ @@ -73,86 +75,45 @@ impl Output { ]) .context(CreationSnafu)?; - Ok(Self { renderer, context }) - } - - /// Adds a hint which is printed **before** the main output. This can be - /// used to display hints or short messages in front of the main content. - /// Examples are: the current `stackablectl` version, execution time or - /// the current Kubernetes namespace. - pub fn add_pre_hint(&mut self, pre_hint: T) -> &mut Self - where - T: Into, - { - self.context.pre_hints.push(pre_hint.into()); - self - } - - /// Adds a hint which is printed **after** the main output. This can be - /// used to display hints or short messages after of the main content. - /// To print command recommendations, use [`Output::add_command_hint`]. - pub fn add_post_hint(&mut self, post_hint: T) -> &mut Self - where - T: Into, - { - self.context.post_hints.push(post_hint.into()); - self + Ok(renderer) } - /// Format a command hint. This will produce a sentence like 'Use \ - /// to \'. The `description` must start with lowercase letters, - /// must complete previosly mentioned sentence, and must not end with a period. - pub fn add_command_hint(&mut self, command: C, description: D) -> &mut Self - where - C: Into, - D: Into, - { - self.context.command_hints.push(format!( - "Use {} to {}.", - Green.bold().paint(format!("\"{}\"", command.into())), - description.into() - )); - self - } - - pub fn set_operator_namespace(&mut self, namespace: T) -> &mut Self - where - T: Into, - { - self.context.used_operator_namespace = namespace.into(); - self - } - - pub fn set_product_namespace(&mut self, namespace: T) -> &mut Self - where - T: Into, - { - self.context.used_product_namespace = namespace.into(); - self + pub fn render(self) -> Result { + match self.kind { + OutputKind::Result(ctx) => self + .renderer + .render("result", &ctx.into_context()) + .context(RenderSnafu), + OutputKind::Error(ctx) => self + .renderer + .render("error", &ctx.into_context()) + .context(RenderSnafu), + } } +} - pub fn set_output(&mut self, output: T) -> &mut Self - where - T: Into, - { - self.context.output = output.into(); - self - } +impl Deref for Output +where + C: ContextExt, +{ + type Target = C; - pub fn render(self) -> String { - // TODO (Techassi): Remove unwrap - self.renderer - .render("result_success", &self.context.into_context()) - .unwrap() + fn deref(&self) -> &Self::Target { + match &self.kind { + OutputKind::Result(c) => c, + OutputKind::Error(c) => c, + } } } -/// Format a command hint. This will produce a sentence like 'Use \ -/// to \'. The `description` must start with lowercase letters, -/// must complete previosly mentioned sentence, and must not end with a period. -pub fn format_command_hint(command: T, description: T) -> String +impl DerefMut for Output where - T: AsRef, + C: ContextExt, { - format!("Use \"{}\" to {}.", command.as_ref(), description.as_ref()) + fn deref_mut(&mut self) -> &mut Self::Target { + match &mut self.kind { + OutputKind::Result(c) => c, + OutputKind::Error(c) => c, + } + } } diff --git a/rust/stackablectl/src/output/result.rs b/rust/stackablectl/src/output/result.rs new file mode 100644 index 00000000..47fe07f6 --- /dev/null +++ b/rust/stackablectl/src/output/result.rs @@ -0,0 +1,56 @@ +use nu_ansi_term::Color::Green; +use stackable_cockpit::constants::{DEFAULT_OPERATOR_NAMESPACE, DEFAULT_PRODUCT_NAMESPACE}; + +use crate::output::ContextExt; + +#[derive(Debug, Default)] +pub struct ResultContext { + pub used_operator_namespace: String, + pub used_product_namespace: String, + + pub command_hints: Vec, + pub post_hints: Vec, + pub pre_hints: Vec, + + pub output: String, +} + +impl ContextExt for ResultContext { + fn into_context(self) -> tera::Context { + let mut ctx = tera::Context::new(); + + ctx.insert("default_operator_namespace", DEFAULT_OPERATOR_NAMESPACE); + ctx.insert("default_product_namespace", DEFAULT_PRODUCT_NAMESPACE); + + ctx.insert("used_operator_namespace", &self.used_operator_namespace); + ctx.insert("used_product_namespace", &self.used_product_namespace); + + ctx.insert("command_hints", &self.command_hints); + ctx.insert("post_hints", &self.post_hints); + ctx.insert("pre_hints", &self.pre_hints); + + ctx.insert("output", &self.output); + + ctx + } +} + +impl ResultContext { + pub fn with_output(&mut self, output: impl Into) -> &mut Self { + self.output = output.into(); + self + } + + pub fn with_command_hint( + &mut self, + command: impl Into, + description: impl Into, + ) -> &mut Self { + self.command_hints.push(format!( + "Use {} to {}.", + Green.bold().paint(format!("\"{}\"", command.into())), + description.into() + )); + self + } +} diff --git a/rust/stackablectl/src/output/templates/error.tpl b/rust/stackablectl/src/output/templates/error.tpl index e69de29b..d73a4022 100644 --- a/rust/stackablectl/src/output/templates/error.tpl +++ b/rust/stackablectl/src/output/templates/error.tpl @@ -0,0 +1,15 @@ +An unrecoverable error occured. + +{% if pre_hints | length != 0 -%} +{% for pre_hint in pre_hints -%} +{{ pre_hint }} +{% endfor %} +{% endif -%} + +{{ error_report }} + +{% if post_hints | length != 0 -%} +{% for post_hint in post_hints -%} +{{ post_hint }} +{% endfor -%} +{% endif -%} From 0eadd9b232ab9ad8aad074f13040c2f4673088fe Mon Sep 17 00:00:00 2001 From: Techassi Date: Tue, 17 Oct 2023 11:31:38 +0200 Subject: [PATCH 08/40] Use compile time colors --- Cargo.lock | 48 +++++++++++++++---- Cargo.toml | 3 +- extra/completions/_stackablectl | 30 ------------ extra/completions/stackablectl.bash | 60 ++++++++++++------------ extra/completions/stackablectl.fish | 30 ------------ extra/man/stackablectl.1 | 5 +- rust-toolchain.toml | 2 +- rust/stackable-cockpit/src/xfer/cache.rs | 4 +- rust/stackablectl/Cargo.toml | 2 +- rust/stackablectl/README.md | 3 -- rust/stackablectl/src/cli/mod.rs | 6 +-- rust/stackablectl/src/cmds/stacklet.rs | 53 ++++++--------------- rust/stackablectl/src/output/error.rs | 11 ++++- rust/stackablectl/src/output/mod.rs | 48 +++++++------------ rust/stackablectl/src/output/result.rs | 28 +++++++++-- 15 files changed, 141 insertions(+), 192 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 26e863aa..614d291e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -427,6 +427,27 @@ dependencies = [ "roff", ] +[[package]] +name = "color-print" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a858372ff14bab9b1b30ea504f2a4bc534582aee3e42ba2d41d2a7baba63d5d" +dependencies = [ + "color-print-proc-macro", +] + +[[package]] +name = "color-print-proc-macro" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57e37866456a721d0a404439a1adae37a31be4e0055590d053dfe6981e05003f" +dependencies = [ + "nom", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "colorchoice" version = "1.0.0" @@ -1509,6 +1530,12 @@ dependencies = [ "unicase", ] +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "miniz_oxide" version = "0.7.1" @@ -1531,22 +1558,23 @@ dependencies = [ ] [[package]] -name = "nu-ansi-term" -version = "0.46.0" +name = "nom" +version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" dependencies = [ - "overload", - "winapi", + "memchr", + "minimal-lexical", ] [[package]] name = "nu-ansi-term" -version = "0.49.0" +version = "0.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c073d3c1930d0751774acf49e66653acecb416c3a54c6ec095a9b11caddb5a68" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" dependencies = [ - "windows-sys 0.48.0", + "overload", + "winapi", ] [[package]] @@ -2667,12 +2695,12 @@ version = "1.0.0-rc2" dependencies = [ "clap", "clap_complete", + "color-print", "comfy-table", "directories", "dotenvy", "indexmap 2.0.0", "lazy_static", - "nu-ansi-term 0.49.0", "rand", "reqwest", "semver", @@ -3069,7 +3097,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" dependencies = [ "matchers", - "nu-ansi-term 0.46.0", + "nu-ansi-term", "once_cell", "regex", "sharded-slab", diff --git a/Cargo.toml b/Cargo.toml index d7cc0f73..2e9f8069 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,6 @@ [workspace] members = ["rust/*", "web", "."] +resolver = "2" [workspace.package] # Currently we version stackablectl separately from the other tools in this repo, @@ -19,6 +20,7 @@ axum = { version = "0.6", features = ["http2", "headers"] } bcrypt = "0.15" clap = { version = "4.2.1", features = ["derive", "env"] } clap_complete = "4.2" +color-print = "0.3.5" comfy-table = { version = "7.0", features = ["custom_styling"] } directories = "5.0" dotenvy = "0.15" @@ -28,7 +30,6 @@ indexmap = { version = "2.0", features = ["serde"] } k8s-openapi = { version = "0.19", default-features = false, features = ["v1_27"] } kube = { version = "0.85", default-features = false, features = ["client", "rustls-tls"] } lazy_static = "1.4" -nu-ansi-term = "0.49" once_cell = "1.18" phf = "0.11" phf_codegen = "0.11" diff --git a/extra/completions/_stackablectl b/extra/completions/_stackablectl index 52a30707..661d82d8 100644 --- a/extra/completions/_stackablectl +++ b/extra/completions/_stackablectl @@ -26,7 +26,6 @@ _stackablectl() { '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ -'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -55,7 +54,6 @@ _arguments "${_arguments_options[@]}" \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ -'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -91,7 +89,6 @@ yaml\:"Print output formatted as YAML"))' \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ -'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -119,7 +116,6 @@ yaml\:"Print output formatted as YAML"))' \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ -'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -151,7 +147,6 @@ minikube\:"Use a minikube cluster"))' \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ -'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -176,7 +171,6 @@ _arguments "${_arguments_options[@]}" \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ -'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -207,7 +201,6 @@ yaml\:"Print output formatted as YAML"))' \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ -'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -273,7 +266,6 @@ _arguments "${_arguments_options[@]}" \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ -'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -309,7 +301,6 @@ yaml\:"Print output formatted as YAML"))' \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ -'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -337,7 +328,6 @@ yaml\:"Print output formatted as YAML"))' \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ -'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -373,7 +363,6 @@ minikube\:"Use a minikube cluster"))' \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ -'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -398,7 +387,6 @@ _arguments "${_arguments_options[@]}" \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ -'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -461,7 +449,6 @@ _arguments "${_arguments_options[@]}" \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ -'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -497,7 +484,6 @@ yaml\:"Print output formatted as YAML"))' \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ -'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -525,7 +511,6 @@ yaml\:"Print output formatted as YAML"))' \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ -'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -563,7 +548,6 @@ minikube\:"Use a minikube cluster"))' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ '--skip-release[Skip the installation of the release during the stack install process]' \ -'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -622,7 +606,6 @@ _arguments "${_arguments_options[@]}" \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ -'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -655,7 +638,6 @@ _arguments "${_arguments_options[@]}" \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ -'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -690,7 +672,6 @@ yaml\:"Print output formatted as YAML"))' \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ -'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -744,7 +725,6 @@ _arguments "${_arguments_options[@]}" \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ -'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -780,7 +760,6 @@ yaml\:"Print output formatted as YAML"))' \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ -'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -808,7 +787,6 @@ yaml\:"Print output formatted as YAML"))' \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ -'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -846,7 +824,6 @@ minikube\:"Use a minikube cluster"))' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ '--skip-release[Skip the installation of the release during the stack install process]' \ -'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -905,7 +882,6 @@ _arguments "${_arguments_options[@]}" \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ -'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -935,7 +911,6 @@ _arguments "${_arguments_options[@]}" \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ -'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -957,7 +932,6 @@ _arguments "${_arguments_options[@]}" \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ -'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -979,7 +953,6 @@ _arguments "${_arguments_options[@]}" \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ -'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -1037,7 +1010,6 @@ _arguments "${_arguments_options[@]}" \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ -'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -1067,7 +1039,6 @@ _arguments "${_arguments_options[@]}" \ '--helm-repo-stable=[Provide a custom Helm stable repository URL]:URL:_urls' \ '--helm-repo-test=[Provide a custom Helm test repository URL]:URL:_urls' \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ -'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ @@ -1091,7 +1062,6 @@ _arguments "${_arguments_options[@]}" \ '--helm-repo-dev=[Provide a custom Helm dev repository URL]:URL:_urls' \ '--old[Only remove outdated files in the cache]' \ '--outdated[Only remove outdated files in the cache]' \ -'--no-color[Disable colored output]' \ '--no-cache[Do not cache the remote (default) demo, stack and release files]' \ '--offline[Do not request any remote files via the network]' \ '-h[Print help (see more with '\''--help'\'')]' \ diff --git a/extra/completions/stackablectl.bash b/extra/completions/stackablectl.bash index 1f0768fa..c3b2252a 100644 --- a/extra/completions/stackablectl.bash +++ b/extra/completions/stackablectl.bash @@ -307,7 +307,7 @@ _stackablectl() { case "${cmd}" in stackablectl) - opts="-l -d -s -r -h -V --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version operator release stack stacklet demo completions cache help" + opts="-l -d -s -r -h -V --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version operator release stack stacklet demo completions cache help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -365,7 +365,7 @@ _stackablectl() { return 0 ;; stackablectl__cache) - opts="-l -d -s -r -h -V --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version list clean help" + opts="-l -d -s -r -h -V --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version list clean help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -423,7 +423,7 @@ _stackablectl() { return 0 ;; stackablectl__cache__clean) - opts="-l -d -s -r -h -V --outdated --old --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" + opts="-l -d -s -r -h -V --outdated --old --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -537,7 +537,7 @@ _stackablectl() { return 0 ;; stackablectl__cache__list) - opts="-l -d -s -r -h -V --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" + opts="-l -d -s -r -h -V --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -595,7 +595,7 @@ _stackablectl() { return 0 ;; stackablectl__completions) - opts="-l -d -s -r -h -V --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version bash fish zsh help" + opts="-l -d -s -r -h -V --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version bash fish zsh help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -653,7 +653,7 @@ _stackablectl() { return 0 ;; stackablectl__completions__bash) - opts="-l -d -s -r -h -V --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" + opts="-l -d -s -r -h -V --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -711,7 +711,7 @@ _stackablectl() { return 0 ;; stackablectl__completions__fish) - opts="-l -d -s -r -h -V --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" + opts="-l -d -s -r -h -V --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -839,7 +839,7 @@ _stackablectl() { return 0 ;; stackablectl__completions__zsh) - opts="-l -d -s -r -h -V --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" + opts="-l -d -s -r -h -V --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -897,7 +897,7 @@ _stackablectl() { return 0 ;; stackablectl__demo) - opts="-l -d -s -r -h -V --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version list describe install help" + opts="-l -d -s -r -h -V --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version list describe install help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -955,7 +955,7 @@ _stackablectl() { return 0 ;; stackablectl__demo__describe) - opts="-o -l -d -s -r -h -V --output --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version " + opts="-o -l -d -s -r -h -V --output --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version " if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -1091,7 +1091,7 @@ _stackablectl() { return 0 ;; stackablectl__demo__install) - opts="-c -n -l -d -s -r -h -V --skip-release --stack-parameters --parameters --cluster --cluster-name --cluster-nodes --cluster-cp-nodes --operator-ns --operator-namespace --product-ns --product-namespace --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version " + opts="-c -n -l -d -s -r -h -V --skip-release --stack-parameters --parameters --cluster --cluster-name --cluster-nodes --cluster-cp-nodes --operator-ns --operator-namespace --product-ns --product-namespace --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version " if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -1197,7 +1197,7 @@ _stackablectl() { return 0 ;; stackablectl__demo__list) - opts="-o -l -d -s -r -h -V --output --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" + opts="-o -l -d -s -r -h -V --output --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -1697,7 +1697,7 @@ _stackablectl() { return 0 ;; stackablectl__operator) - opts="-l -d -s -r -h -V --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version list describe install uninstall installed help" + opts="-l -d -s -r -h -V --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version list describe install uninstall installed help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -1755,7 +1755,7 @@ _stackablectl() { return 0 ;; stackablectl__operator__describe) - opts="-o -l -d -s -r -h -V --output --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version " + opts="-o -l -d -s -r -h -V --output --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version " if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -1919,7 +1919,7 @@ _stackablectl() { return 0 ;; stackablectl__operator__install) - opts="-c -l -d -s -r -h -V --operator-ns --operator-namespace --cluster --cluster-name --cluster-nodes --cluster-cp-nodes --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version ..." + opts="-c -l -d -s -r -h -V --operator-ns --operator-namespace --cluster --cluster-name --cluster-nodes --cluster-cp-nodes --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version ..." if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -2005,7 +2005,7 @@ _stackablectl() { return 0 ;; stackablectl__operator__installed) - opts="-o -l -d -s -r -h -V --output --operator-ns --operator-namespace --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" + opts="-o -l -d -s -r -h -V --output --operator-ns --operator-namespace --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -2079,7 +2079,7 @@ _stackablectl() { return 0 ;; stackablectl__operator__list) - opts="-o -l -d -s -r -h -V --output --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" + opts="-o -l -d -s -r -h -V --output --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -2145,7 +2145,7 @@ _stackablectl() { return 0 ;; stackablectl__operator__uninstall) - opts="-l -d -s -r -h -V --operator-ns --operator-namespace --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version ..." + opts="-l -d -s -r -h -V --operator-ns --operator-namespace --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version ..." if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -2211,7 +2211,7 @@ _stackablectl() { return 0 ;; stackablectl__release) - opts="-l -d -s -r -h -V --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version list describe install uninstall help" + opts="-l -d -s -r -h -V --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version list describe install uninstall help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -2269,7 +2269,7 @@ _stackablectl() { return 0 ;; stackablectl__release__describe) - opts="-o -l -d -s -r -h -V --output --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version " + opts="-o -l -d -s -r -h -V --output --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version " if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -2419,7 +2419,7 @@ _stackablectl() { return 0 ;; stackablectl__release__install) - opts="-i -e -c -l -d -s -r -h -V --include --exclude --operator-ns --operator-namespace --cluster --cluster-name --cluster-nodes --cluster-cp-nodes --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version " + opts="-i -e -c -l -d -s -r -h -V --include --exclude --operator-ns --operator-namespace --cluster --cluster-name --cluster-nodes --cluster-cp-nodes --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version " if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -2521,7 +2521,7 @@ _stackablectl() { return 0 ;; stackablectl__release__list) - opts="-o -l -d -s -r -h -V --output --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" + opts="-o -l -d -s -r -h -V --output --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -2587,7 +2587,7 @@ _stackablectl() { return 0 ;; stackablectl__release__uninstall) - opts="-l -d -s -r -h -V --operator-ns --operator-namespace --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version " + opts="-l -d -s -r -h -V --operator-ns --operator-namespace --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version " if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -2653,7 +2653,7 @@ _stackablectl() { return 0 ;; stackablectl__stack) - opts="-l -d -s -r -h -V --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version list describe install help" + opts="-l -d -s -r -h -V --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version list describe install help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -2711,7 +2711,7 @@ _stackablectl() { return 0 ;; stackablectl__stack__describe) - opts="-o -l -d -s -r -h -V --output --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version " + opts="-o -l -d -s -r -h -V --output --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version " if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -2847,7 +2847,7 @@ _stackablectl() { return 0 ;; stackablectl__stack__install) - opts="-c -n -l -d -s -r -h -V --skip-release --stack-parameters --parameters --cluster --cluster-name --cluster-nodes --cluster-cp-nodes --operator-ns --operator-namespace --product-ns --product-namespace --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version " + opts="-c -n -l -d -s -r -h -V --skip-release --stack-parameters --parameters --cluster --cluster-name --cluster-nodes --cluster-cp-nodes --operator-ns --operator-namespace --product-ns --product-namespace --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version " if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -2953,7 +2953,7 @@ _stackablectl() { return 0 ;; stackablectl__stack__list) - opts="-o -l -d -s -r -h -V --output --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" + opts="-o -l -d -s -r -h -V --output --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -3019,7 +3019,7 @@ _stackablectl() { return 0 ;; stackablectl__stacklet) - opts="-l -d -s -r -h -V --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version credentials list help" + opts="-l -d -s -r -h -V --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version credentials list help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -3077,7 +3077,7 @@ _stackablectl() { return 0 ;; stackablectl__stacklet__credentials) - opts="-n -l -d -s -r -h -V --product-ns --product-namespace --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version " + opts="-n -l -d -s -r -h -V --product-ns --product-namespace --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version " if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -3203,7 +3203,7 @@ _stackablectl() { return 0 ;; stackablectl__stacklet__list) - opts="-o -n -l -d -s -r -h -V --output --operator-ns --operator-namespace --product-ns --product-namespace --log-level --no-color --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" + opts="-o -n -l -d -s -r -h -V --output --operator-ns --operator-namespace --product-ns --product-namespace --log-level --no-cache --offline --demo-file --stack-file --release-file --helm-repo-stable --helm-repo-test --helm-repo-dev --help --version" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 diff --git a/extra/completions/stackablectl.fish b/extra/completions/stackablectl.fish index cffc541f..3457d739 100644 --- a/extra/completions/stackablectl.fish +++ b/extra/completions/stackablectl.fish @@ -5,7 +5,6 @@ complete -c stackablectl -n "__fish_use_subcommand" -s r -l release-file -d 'Pro complete -c stackablectl -n "__fish_use_subcommand" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_use_subcommand" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_use_subcommand" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f -complete -c stackablectl -n "__fish_use_subcommand" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_use_subcommand" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_use_subcommand" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_use_subcommand" -s h -l help -d 'Print help (see more with \'--help\')' @@ -25,7 +24,6 @@ complete -c stackablectl -n "__fish_seen_subcommand_from operator; and not __fis complete -c stackablectl -n "__fish_seen_subcommand_from operator; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from installed; and not __fish_seen_subcommand_from help" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from operator; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from installed; and not __fish_seen_subcommand_from help" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from operator; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from installed; and not __fish_seen_subcommand_from help" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f -complete -c stackablectl -n "__fish_seen_subcommand_from operator; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from installed; and not __fish_seen_subcommand_from help" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from installed; and not __fish_seen_subcommand_from help" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from installed; and not __fish_seen_subcommand_from help" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from installed; and not __fish_seen_subcommand_from help" -s h -l help -d 'Print help (see more with \'--help\')' @@ -44,7 +42,6 @@ complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_se complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from list" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from list" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from list" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f -complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from list" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from list" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from list" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from list" -s h -l help -d 'Print help (see more with \'--help\')' @@ -57,7 +54,6 @@ complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_se complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from describe" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from describe" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from describe" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f -complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from describe" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from describe" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from describe" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from describe" -s h -l help -d 'Print help (see more with \'--help\')' @@ -74,7 +70,6 @@ complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_se complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from install" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from install" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from install" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f -complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from install" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from install" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from install" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from install" -s h -l help -d 'Print help (see more with \'--help\')' @@ -87,7 +82,6 @@ complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_se complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from uninstall" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from uninstall" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from uninstall" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f -complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from uninstall" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from uninstall" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from uninstall" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from uninstall" -s h -l help -d 'Print help (see more with \'--help\')' @@ -101,7 +95,6 @@ complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_se complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from installed" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from installed" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from installed" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f -complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from installed" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from installed" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from installed" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from installed" -s h -l help -d 'Print help (see more with \'--help\')' @@ -119,7 +112,6 @@ complete -c stackablectl -n "__fish_seen_subcommand_from release; and not __fish complete -c stackablectl -n "__fish_seen_subcommand_from release; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from help" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from release; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from help" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from release; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from help" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f -complete -c stackablectl -n "__fish_seen_subcommand_from release; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from help" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from release; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from help" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from release; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from help" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from release; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from help" -s h -l help -d 'Print help (see more with \'--help\')' @@ -137,7 +129,6 @@ complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_see complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from list" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from list" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from list" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f -complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from list" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from list" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from list" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from list" -s h -l help -d 'Print help (see more with \'--help\')' @@ -150,7 +141,6 @@ complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_see complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from describe" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from describe" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from describe" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f -complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from describe" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from describe" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from describe" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from describe" -s h -l help -d 'Print help (see more with \'--help\')' @@ -169,7 +159,6 @@ complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_see complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from install" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from install" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from install" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f -complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from install" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from install" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from install" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from install" -s h -l help -d 'Print help (see more with \'--help\')' @@ -182,7 +171,6 @@ complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_see complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from uninstall" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from uninstall" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from uninstall" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f -complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from uninstall" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from uninstall" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from uninstall" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from uninstall" -s h -l help -d 'Print help (see more with \'--help\')' @@ -199,7 +187,6 @@ complete -c stackablectl -n "__fish_seen_subcommand_from stack; and not __fish_s complete -c stackablectl -n "__fish_seen_subcommand_from stack; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from help" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from stack; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from help" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from stack; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from help" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f -complete -c stackablectl -n "__fish_seen_subcommand_from stack; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from help" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from stack; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from help" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from stack; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from help" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from stack; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from help" -s h -l help -d 'Print help (see more with \'--help\')' @@ -216,7 +203,6 @@ complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_ complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from list" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from list" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from list" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f -complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from list" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from list" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from list" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from list" -s h -l help -d 'Print help (see more with \'--help\')' @@ -229,7 +215,6 @@ complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_ complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from describe" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from describe" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from describe" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f -complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from describe" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from describe" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from describe" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from describe" -s h -l help -d 'Print help (see more with \'--help\')' @@ -250,7 +235,6 @@ complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_ complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from install" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from install" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from install" -l skip-release -d 'Skip the installation of the release during the stack install process' -complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from install" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from install" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from install" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from install" -s h -l help -d 'Print help (see more with \'--help\')' @@ -266,7 +250,6 @@ complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and not __fis complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and not __fish_seen_subcommand_from credentials; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from help" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and not __fish_seen_subcommand_from credentials; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from help" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and not __fish_seen_subcommand_from credentials; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from help" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f -complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and not __fish_seen_subcommand_from credentials; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from help" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and not __fish_seen_subcommand_from credentials; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from help" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and not __fish_seen_subcommand_from credentials; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from help" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and not __fish_seen_subcommand_from credentials; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from help" -s h -l help -d 'Print help (see more with \'--help\')' @@ -282,7 +265,6 @@ complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_se complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_seen_subcommand_from credentials" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_seen_subcommand_from credentials" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_seen_subcommand_from credentials" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f -complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_seen_subcommand_from credentials" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_seen_subcommand_from credentials" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_seen_subcommand_from credentials" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_seen_subcommand_from credentials" -s h -l help -d 'Print help (see more with \'--help\')' @@ -297,7 +279,6 @@ complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_se complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_seen_subcommand_from list" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_seen_subcommand_from list" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_seen_subcommand_from list" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f -complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_seen_subcommand_from list" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_seen_subcommand_from list" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_seen_subcommand_from list" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_seen_subcommand_from list" -s h -l help -d 'Print help (see more with \'--help\')' @@ -312,7 +293,6 @@ complete -c stackablectl -n "__fish_seen_subcommand_from demo; and not __fish_se complete -c stackablectl -n "__fish_seen_subcommand_from demo; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from help" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from demo; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from help" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from demo; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from help" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f -complete -c stackablectl -n "__fish_seen_subcommand_from demo; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from help" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from demo; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from help" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from demo; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from help" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from demo; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from help" -s h -l help -d 'Print help (see more with \'--help\')' @@ -329,7 +309,6 @@ complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_s complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from list" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from list" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from list" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f -complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from list" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from list" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from list" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from list" -s h -l help -d 'Print help (see more with \'--help\')' @@ -342,7 +321,6 @@ complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_s complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from describe" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from describe" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from describe" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f -complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from describe" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from describe" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from describe" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from describe" -s h -l help -d 'Print help (see more with \'--help\')' @@ -363,7 +341,6 @@ complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_s complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from install" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from install" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from install" -l skip-release -d 'Skip the installation of the release during the stack install process' -complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from install" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from install" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from install" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from install" -s h -l help -d 'Print help (see more with \'--help\')' @@ -379,7 +356,6 @@ complete -c stackablectl -n "__fish_seen_subcommand_from completions; and not __ complete -c stackablectl -n "__fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from bash; and not __fish_seen_subcommand_from fish; and not __fish_seen_subcommand_from zsh; and not __fish_seen_subcommand_from help" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from bash; and not __fish_seen_subcommand_from fish; and not __fish_seen_subcommand_from zsh; and not __fish_seen_subcommand_from help" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from bash; and not __fish_seen_subcommand_from fish; and not __fish_seen_subcommand_from zsh; and not __fish_seen_subcommand_from help" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f -complete -c stackablectl -n "__fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from bash; and not __fish_seen_subcommand_from fish; and not __fish_seen_subcommand_from zsh; and not __fish_seen_subcommand_from help" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from bash; and not __fish_seen_subcommand_from fish; and not __fish_seen_subcommand_from zsh; and not __fish_seen_subcommand_from help" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from bash; and not __fish_seen_subcommand_from fish; and not __fish_seen_subcommand_from zsh; and not __fish_seen_subcommand_from help" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from bash; and not __fish_seen_subcommand_from fish; and not __fish_seen_subcommand_from zsh; and not __fish_seen_subcommand_from help" -s h -l help -d 'Print help (see more with \'--help\')' @@ -395,7 +371,6 @@ complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from bash" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from bash" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from bash" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f -complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from bash" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from bash" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from bash" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from bash" -s h -l help -d 'Print help (see more with \'--help\')' @@ -407,7 +382,6 @@ complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from fish" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from fish" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from fish" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f -complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from fish" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from fish" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from fish" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from fish" -s h -l help -d 'Print help (see more with \'--help\')' @@ -419,7 +393,6 @@ complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from zsh" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from zsh" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from zsh" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f -complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from zsh" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from zsh" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from zsh" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from completions; and __fish_seen_subcommand_from zsh" -s h -l help -d 'Print help (see more with \'--help\')' @@ -435,7 +408,6 @@ complete -c stackablectl -n "__fish_seen_subcommand_from cache; and not __fish_s complete -c stackablectl -n "__fish_seen_subcommand_from cache; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from clean; and not __fish_seen_subcommand_from help" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from cache; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from clean; and not __fish_seen_subcommand_from help" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from cache; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from clean; and not __fish_seen_subcommand_from help" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f -complete -c stackablectl -n "__fish_seen_subcommand_from cache; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from clean; and not __fish_seen_subcommand_from help" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from cache; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from clean; and not __fish_seen_subcommand_from help" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from cache; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from clean; and not __fish_seen_subcommand_from help" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from cache; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from clean; and not __fish_seen_subcommand_from help" -s h -l help -d 'Print help (see more with \'--help\')' @@ -450,7 +422,6 @@ complete -c stackablectl -n "__fish_seen_subcommand_from cache; and __fish_seen_ complete -c stackablectl -n "__fish_seen_subcommand_from cache; and __fish_seen_subcommand_from list" -l helm-repo-stable -d 'Provide a custom Helm stable repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from cache; and __fish_seen_subcommand_from list" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from cache; and __fish_seen_subcommand_from list" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f -complete -c stackablectl -n "__fish_seen_subcommand_from cache; and __fish_seen_subcommand_from list" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from cache; and __fish_seen_subcommand_from list" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from cache; and __fish_seen_subcommand_from list" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from cache; and __fish_seen_subcommand_from list" -s h -l help -d 'Print help (see more with \'--help\')' @@ -463,7 +434,6 @@ complete -c stackablectl -n "__fish_seen_subcommand_from cache; and __fish_seen_ complete -c stackablectl -n "__fish_seen_subcommand_from cache; and __fish_seen_subcommand_from clean" -l helm-repo-test -d 'Provide a custom Helm test repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from cache; and __fish_seen_subcommand_from clean" -l helm-repo-dev -d 'Provide a custom Helm dev repository URL' -r -f complete -c stackablectl -n "__fish_seen_subcommand_from cache; and __fish_seen_subcommand_from clean" -l old -l outdated -d 'Only remove outdated files in the cache' -complete -c stackablectl -n "__fish_seen_subcommand_from cache; and __fish_seen_subcommand_from clean" -l no-color -d 'Disable colored output' complete -c stackablectl -n "__fish_seen_subcommand_from cache; and __fish_seen_subcommand_from clean" -l no-cache -d 'Do not cache the remote (default) demo, stack and release files' complete -c stackablectl -n "__fish_seen_subcommand_from cache; and __fish_seen_subcommand_from clean" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from cache; and __fish_seen_subcommand_from clean" -s h -l help -d 'Print help (see more with \'--help\')' diff --git a/extra/man/stackablectl.1 b/extra/man/stackablectl.1 index 139ed406..c251c5b8 100644 --- a/extra/man/stackablectl.1 +++ b/extra/man/stackablectl.1 @@ -4,7 +4,7 @@ .SH NAME stackablectl \- Command line tool to interact with the Stackable Data Platform .SH SYNOPSIS -\fBstackablectl\fR [\fB\-l\fR|\fB\-\-log\-level\fR] [\fB\-\-no\-color\fR] [\fB\-\-no\-cache\fR] [\fB\-\-offline\fR] [\fB\-d\fR|\fB\-\-demo\-file\fR] [\fB\-s\fR|\fB\-\-stack\-file\fR] [\fB\-r\fR|\fB\-\-release\-file\fR] [\fB\-\-helm\-repo\-stable\fR] [\fB\-\-helm\-repo\-test\fR] [\fB\-\-helm\-repo\-dev\fR] [\fB\-h\fR|\fB\-\-help\fR] [\fB\-V\fR|\fB\-\-version\fR] <\fIsubcommands\fR> +\fBstackablectl\fR [\fB\-l\fR|\fB\-\-log\-level\fR] [\fB\-\-no\-cache\fR] [\fB\-\-offline\fR] [\fB\-d\fR|\fB\-\-demo\-file\fR] [\fB\-s\fR|\fB\-\-stack\-file\fR] [\fB\-r\fR|\fB\-\-release\-file\fR] [\fB\-\-helm\-repo\-stable\fR] [\fB\-\-helm\-repo\-test\fR] [\fB\-\-helm\-repo\-dev\fR] [\fB\-h\fR|\fB\-\-help\fR] [\fB\-V\fR|\fB\-\-version\fR] <\fIsubcommands\fR> .SH DESCRIPTION Command line tool to interact with the Stackable Data Platform .SH OPTIONS @@ -12,9 +12,6 @@ Command line tool to interact with the Stackable Data Platform \fB\-l\fR, \fB\-\-log\-level\fR=\fILOG_LEVEL\fR Log level this application uses .TP -\fB\-\-no\-color\fR -Disable colored output -.TP \fB\-\-no\-cache\fR Do not cache the remote (default) demo, stack and release files diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 22048ac5..8142c301 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.70.0" +channel = "1.73.0" diff --git a/rust/stackable-cockpit/src/xfer/cache.rs b/rust/stackable-cockpit/src/xfer/cache.rs index fb6bee26..683b1f76 100644 --- a/rust/stackable-cockpit/src/xfer/cache.rs +++ b/rust/stackable-cockpit/src/xfer/cache.rs @@ -310,6 +310,8 @@ async fn write_cache_auto_purge_file(path: &Path) -> Result<()> { fn is_protected_file(filename: OsString) -> bool { // Non-UTF-8 filenames can't possibly be on the protected list - let Some(filename) = filename.to_str() else { return false; }; + let Some(filename) = filename.to_str() else { + return false; + }; CACHE_PROTECTED_FILES.contains(&filename) } diff --git a/rust/stackablectl/Cargo.toml b/rust/stackablectl/Cargo.toml index c2ce5337..90afa366 100644 --- a/rust/stackablectl/Cargo.toml +++ b/rust/stackablectl/Cargo.toml @@ -14,12 +14,12 @@ stackable-cockpit = { path = "../stackable-cockpit", features = ["openapi"] } clap_complete.workspace = true clap.workspace = true +color-print.workspace = true comfy-table.workspace = true directories.workspace = true dotenvy.workspace = true indexmap.workspace = true lazy_static.workspace = true -nu-ansi-term.workspace = true rand.workspace = true reqwest.workspace = true semver.workspace = true diff --git a/rust/stackablectl/README.md b/rust/stackablectl/README.md index 478eebe7..54e6de31 100644 --- a/rust/stackablectl/README.md +++ b/rust/stackablectl/README.md @@ -28,9 +28,6 @@ Options: -l, --log-level Log level this application uses - --no-color - Disable colored output - --no-cache Do not cache the remote (default) demo, stack and release files diff --git a/rust/stackablectl/src/cli/mod.rs b/rust/stackablectl/src/cli/mod.rs index 5dab91de..85041d54 100644 --- a/rust/stackablectl/src/cli/mod.rs +++ b/rust/stackablectl/src/cli/mod.rs @@ -60,10 +60,6 @@ pub struct Cli { #[arg(short, long, global = true)] pub log_level: Option, - /// Disable colored output. - #[arg(long, global = true)] - pub no_color: bool, - /// Do not cache the remote (default) demo, stack and release files #[arg( long, @@ -201,7 +197,7 @@ impl Cli { // Output utility functions pub fn result(&self) -> Output { // TODO (Techassi): Remove unwrap - Output::result(ResultContext::default(), self.no_color).unwrap() + Output::new(ResultContext::default(), false).unwrap() } } diff --git a/rust/stackablectl/src/cmds/stacklet.rs b/rust/stackablectl/src/cmds/stacklet.rs index 523f7b19..37fc0686 100644 --- a/rust/stackablectl/src/cmds/stacklet.rs +++ b/rust/stackablectl/src/cmds/stacklet.rs @@ -3,7 +3,6 @@ use comfy_table::{ presets::{NOTHING, UTF8_FULL}, ContentArrangement, Table, }; -use nu_ansi_term::Color::{Green, Red}; use snafu::{ResultExt, Snafu}; use tracing::{info, instrument}; @@ -16,7 +15,6 @@ use stackable_cockpit::{ use crate::{ args::CommonNamespaceArgs, cli::{Cli, OutputType}, - utils::use_colored_output, }; #[derive(Debug, Args)] @@ -106,10 +104,6 @@ async fn list_cmd(args: &StackletListArgs, cli: &Cli) -> Result { - // Determine if colored output will be enabled based on the provided - // flag and the terminal support. - let use_color = use_colored_output(!cli.no_color); - // The main table displays all installed (and discovered) stacklets // and their condition. let mut table = Table::new(); @@ -136,7 +130,7 @@ async fn list_cmd(args: &StackletListArgs, cli: &Cli) -> Result, error_index: &mut usize, - use_color: bool, ) -> ConditionOutput { let mut conditions = Vec::new(); let mut errors = Vec::new(); for cond in product_conditions { - conditions.push(color_condition( - &cond.condition, - cond.is_good, - *error_index, - use_color, - )); - - if let Some(error) = - render_condition_error(cond.message, cond.is_good, *error_index, use_color) - { + conditions.push(color_condition(&cond.condition, cond.is_good, *error_index)); + + if let Some(error) = render_condition_error(cond.message, cond.is_good, *error_index) { errors.push(error); *error_index += 1; }; @@ -261,16 +247,10 @@ fn render_condition_error( message: Option, is_good: Option, error_index: usize, - use_color: bool, ) -> Option { if !is_good.unwrap_or(true) { let message = message.unwrap_or("-".into()); - let mut error = format!("[{error_index}]: {message}"); - - if use_color { - error = Red.paint(error).to_string() - } - + let error = color_print::cformat!("[{}]: {}", error_index, message); return Some(error); } @@ -279,19 +259,16 @@ fn render_condition_error( /// Colors a single condition (green or red) and additionally adds an error /// index to the output. -fn color_condition( - condition: &str, - is_good: Option, - error_index: usize, - use_color: bool, -) -> String { - match (is_good, use_color) { - (Some(true), true) => Green.paint(condition).to_string(), - (Some(false), true) => Red - .paint(format!("{condition}: See [{error_index}]")) - .to_string(), - (Some(false), false) => format!("{condition}: See [{error_index}]"), - _ => condition.to_owned(), +fn color_condition(condition: &str, is_good: Option, error_index: usize) -> String { + match is_good { + Some(is_good) => { + if is_good { + color_print::cformat!("{}", condition) + } else { + color_print::cformat!("{}: See [{}]", condition, error_index) + } + } + None => condition.to_owned(), } } diff --git a/rust/stackablectl/src/output/error.rs b/rust/stackablectl/src/output/error.rs index e87400a1..5bf11b95 100644 --- a/rust/stackablectl/src/output/error.rs +++ b/rust/stackablectl/src/output/error.rs @@ -1,6 +1,6 @@ use stackable_cockpit::constants::{DEFAULT_OPERATOR_NAMESPACE, DEFAULT_PRODUCT_NAMESPACE}; -use crate::output::ContextExt; +use crate::output::{ContextExt, OutputKind}; #[derive(Debug, Default)] pub struct ErrorContext { @@ -8,6 +8,7 @@ pub struct ErrorContext { pub pre_hints: Vec, pub error_report: String, + pub no_color: bool, } impl ContextExt for ErrorContext { @@ -24,4 +25,12 @@ impl ContextExt for ErrorContext { ctx } + + fn output_kind(&self) -> OutputKind { + OutputKind::Error + } + + fn set_no_color(&mut self, no_color: bool) { + self.no_color = no_color + } } diff --git a/rust/stackablectl/src/output/mod.rs b/rust/stackablectl/src/output/mod.rs index ca9fab5d..f3355633 100644 --- a/rust/stackablectl/src/output/mod.rs +++ b/rust/stackablectl/src/output/mod.rs @@ -23,13 +23,15 @@ pub enum Error { } #[derive(Debug)] -pub enum OutputKind { - Result(C), - Error(C), +pub enum OutputKind { + Result, + Error, } pub trait ContextExt { + fn set_no_color(&mut self, no_color: bool); fn into_context(self) -> tera::Context; + fn output_kind(&self) -> OutputKind; } #[derive(Debug)] @@ -37,32 +39,20 @@ pub struct Output where C: ContextExt, { - kind: OutputKind, - no_color: bool, renderer: Tera, + context: C, } impl Output where C: ContextExt, { - pub fn new(kind: OutputKind, no_color: bool) -> Result { + pub fn new(mut context: C, no_color: bool) -> Result { let renderer = Self::create_renderer()?; let no_color = use_colored_output(!no_color); + context.set_no_color(no_color); - Ok(Self { - no_color, - renderer, - kind, - }) - } - - pub fn result(context: C, no_color: bool) -> Result { - Self::new(OutputKind::Result(context), no_color) - } - - pub fn error(context: C, no_color: bool) -> Result { - Self::new(OutputKind::Error(context), no_color) + Ok(Self { renderer, context }) } fn create_renderer() -> Result { @@ -79,14 +69,14 @@ where } pub fn render(self) -> Result { - match self.kind { - OutputKind::Result(ctx) => self + match self.context.output_kind() { + OutputKind::Result => self .renderer - .render("result", &ctx.into_context()) + .render("result", &self.context.into_context()) .context(RenderSnafu), - OutputKind::Error(ctx) => self + OutputKind::Error => self .renderer - .render("error", &ctx.into_context()) + .render("error", &self.context.into_context()) .context(RenderSnafu), } } @@ -99,10 +89,7 @@ where type Target = C; fn deref(&self) -> &Self::Target { - match &self.kind { - OutputKind::Result(c) => c, - OutputKind::Error(c) => c, - } + &self.context } } @@ -111,9 +98,6 @@ where C: ContextExt, { fn deref_mut(&mut self) -> &mut Self::Target { - match &mut self.kind { - OutputKind::Result(c) => c, - OutputKind::Error(c) => c, - } + &mut self.context } } diff --git a/rust/stackablectl/src/output/result.rs b/rust/stackablectl/src/output/result.rs index 47fe07f6..546fbd93 100644 --- a/rust/stackablectl/src/output/result.rs +++ b/rust/stackablectl/src/output/result.rs @@ -1,7 +1,6 @@ -use nu_ansi_term::Color::Green; use stackable_cockpit::constants::{DEFAULT_OPERATOR_NAMESPACE, DEFAULT_PRODUCT_NAMESPACE}; -use crate::output::ContextExt; +use crate::output::{ContextExt, OutputKind}; #[derive(Debug, Default)] pub struct ResultContext { @@ -13,6 +12,7 @@ pub struct ResultContext { pub pre_hints: Vec, pub output: String, + pub no_color: bool, } impl ContextExt for ResultContext { @@ -33,6 +33,14 @@ impl ContextExt for ResultContext { ctx } + + fn output_kind(&self) -> OutputKind { + OutputKind::Result + } + + fn set_no_color(&mut self, no_color: bool) { + self.no_color = no_color + } } impl ResultContext { @@ -46,9 +54,19 @@ impl ResultContext { command: impl Into, description: impl Into, ) -> &mut Self { - self.command_hints.push(format!( - "Use {} to {}.", - Green.bold().paint(format!("\"{}\"", command.into())), + // let hint = if self.no_color { + // format!("Use \"{}\" to {}.", command.into(), description.into()) + // } else { + // color_print::cformat!( + // "Use \"{}\" to {}.", + // command.into(), + // description.into() + // ) + // }; + + self.command_hints.push(color_print::cformat!( + "Use \"{}\" to {}.", + command.into(), description.into() )); self From dc15873936dac886a9d6b6b83b5865ba152515b3 Mon Sep 17 00:00:00 2001 From: Techassi Date: Tue, 17 Oct 2023 11:46:27 +0200 Subject: [PATCH 09/40] Bump Rust version in GitHub workflows --- .github/workflows/pr_cockpit.yml | 2 +- .github/workflows/pr_general.yml | 2 +- .github/workflows/pr_stackablectl.yml | 2 +- .github/workflows/release_stackablectl.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr_cockpit.yml b/.github/workflows/pr_cockpit.yml index 8a753f6b..7d5a0828 100644 --- a/.github/workflows/pr_cockpit.yml +++ b/.github/workflows/pr_cockpit.yml @@ -15,7 +15,7 @@ on: - "go.sum" env: - RUST_VERSION: 1.70.0 + RUST_VERSION: 1.73.0 CARGO_TERM_COLOR: always CARGO_INCREMENTAL: "0" CARGO_PROFILE_DEV_DEBUG: "0" diff --git a/.github/workflows/pr_general.yml b/.github/workflows/pr_general.yml index 0a214c93..4f772a25 100644 --- a/.github/workflows/pr_general.yml +++ b/.github/workflows/pr_general.yml @@ -4,7 +4,7 @@ name: Pull Request General on: workflow_call env: - RUST_VERSION: 1.70.0 + RUST_VERSION: 1.73.0 CARGO_TERM_COLOR: always CARGO_INCREMENTAL: "0" CARGO_PROFILE_DEV_DEBUG: "0" diff --git a/.github/workflows/pr_stackablectl.yml b/.github/workflows/pr_stackablectl.yml index e9f7e63b..fee41557 100644 --- a/.github/workflows/pr_stackablectl.yml +++ b/.github/workflows/pr_stackablectl.yml @@ -14,7 +14,7 @@ on: - "extra" env: - RUST_VERSION: 1.70.0 + RUST_VERSION: 1.73.0 CARGO_TERM_COLOR: always CARGO_INCREMENTAL: "0" CARGO_PROFILE_DEV_DEBUG: "0" diff --git a/.github/workflows/release_stackablectl.yml b/.github/workflows/release_stackablectl.yml index fbb8f98c..e0478be8 100644 --- a/.github/workflows/release_stackablectl.yml +++ b/.github/workflows/release_stackablectl.yml @@ -7,7 +7,7 @@ on: - "stackablectl-[0-9]+.[0-9]+.[0-9]+**" env: - RUST_VERSION: 1.70.0 + RUST_VERSION: 1.73.0 CARGO_TERM_COLOR: always CARGO_INCREMENTAL: "0" CARGO_PROFILE_DEV_DEBUG: "0" From d11b2fcdc154b18e207b6c234876419f4bc22c2d Mon Sep 17 00:00:00 2001 From: Techassi Date: Tue, 17 Oct 2023 14:46:53 +0200 Subject: [PATCH 10/40] Add error output and error report --- rust/stackablectl/src/cli/mod.rs | 15 ++++-- rust/stackablectl/src/main.rs | 14 ++++-- rust/stackablectl/src/output/error.rs | 23 +++++++-- rust/stackablectl/src/output/mod.rs | 49 ++++++++++++++++++- rust/stackablectl/src/output/result.rs | 14 +++--- .../src/output/templates/error.tpl | 4 +- 6 files changed, 95 insertions(+), 24 deletions(-) diff --git a/rust/stackablectl/src/cli/mod.rs b/rust/stackablectl/src/cli/mod.rs index 85041d54..bb4da609 100644 --- a/rust/stackablectl/src/cli/mod.rs +++ b/rust/stackablectl/src/cli/mod.rs @@ -23,21 +23,21 @@ use crate::{ REMOTE_RELEASE_FILE, REMOTE_STACK_FILE, USER_DIR_APPLICATION_NAME, USER_DIR_ORGANIZATION_NAME, USER_DIR_QUALIFIER, }, - output::{Output, ResultContext}, + output::{ErrorContext, Output, ResultContext}, }; #[derive(Debug, Snafu)] pub enum Error { - #[snafu(display("operator command error"))] + #[snafu(display("failed to execute operator (sub)command"))] Operator { source: operator::CmdError }, - #[snafu(display("release command error"))] + #[snafu(display("failed to execute release (sub)command"))] Release { source: release::CmdError }, - #[snafu(display("stack command error"))] + #[snafu(display("failed to execute stack (sub)command"))] Stack { source: stack::CmdError }, - #[snafu(display("stacklets command error"))] + #[snafu(display("failed to execute stacklet (sub)command"))] Stacklet { source: stacklet::CmdError }, #[snafu(display("demo command error"))] @@ -199,6 +199,11 @@ impl Cli { // TODO (Techassi): Remove unwrap Output::new(ResultContext::default(), false).unwrap() } + + pub fn error(&self) -> Output { + // TODO (Techassi): Remove unwrap + Output::new(ErrorContext::default(), false).unwrap() + } } #[derive(Debug, Subcommand)] diff --git a/rust/stackablectl/src/main.rs b/rust/stackablectl/src/main.rs index 54db4ad9..ac3dc64f 100644 --- a/rust/stackablectl/src/main.rs +++ b/rust/stackablectl/src/main.rs @@ -33,7 +33,7 @@ async fn main() -> Result<(), Error> { // Load env vars from optional .env file match dotenv() { - Ok(_) => {} + Ok(_) => (), Err(err) => { if !err.not_found() { println!("{err}") @@ -41,7 +41,15 @@ async fn main() -> Result<(), Error> { } } - let output = app.run().await?; - print!("{output}"); + match app.run().await { + Ok(result) => print!("{result}"), + Err(err) => { + let mut output = app.error(); + output.with_error_report(err); + + eprint!("{}", output.render().unwrap()) + } + } + Ok(()) } diff --git a/rust/stackablectl/src/output/error.rs b/rust/stackablectl/src/output/error.rs index 5bf11b95..a70d3b35 100644 --- a/rust/stackablectl/src/output/error.rs +++ b/rust/stackablectl/src/output/error.rs @@ -1,14 +1,14 @@ use stackable_cockpit::constants::{DEFAULT_OPERATOR_NAMESPACE, DEFAULT_PRODUCT_NAMESPACE}; -use crate::output::{ContextExt, OutputKind}; +use crate::output::{ContextExt, ErrorReport, OutputKind}; #[derive(Debug, Default)] pub struct ErrorContext { - pub post_hints: Vec, - pub pre_hints: Vec, + post_hints: Vec, + pre_hints: Vec, - pub error_report: String, - pub no_color: bool, + error_report: String, + no_color: bool, } impl ContextExt for ErrorContext { @@ -34,3 +34,16 @@ impl ContextExt for ErrorContext { self.no_color = no_color } } + +impl ErrorContext { + pub fn with_error_report(&mut self, error: impl ErrorReport) -> &mut Self { + // TODO (Techassi): Remove unwrap + self.error_report = error.into_error_report().unwrap(); + self + } + + pub fn with_post_hint(&mut self, post_hint: impl Into) -> &mut Self { + self.post_hints.push(post_hint.into()); + self + } +} diff --git a/rust/stackablectl/src/output/mod.rs b/rust/stackablectl/src/output/mod.rs index f3355633..efb561ed 100644 --- a/rust/stackablectl/src/output/mod.rs +++ b/rust/stackablectl/src/output/mod.rs @@ -1,4 +1,7 @@ -use std::ops::{Deref, DerefMut}; +use std::{ + fmt::Write, + ops::{Deref, DerefMut}, +}; use snafu::{ResultExt, Snafu}; use tera::Tera; @@ -34,6 +37,50 @@ pub trait ContextExt { fn output_kind(&self) -> OutputKind; } +pub trait ErrorReport +where + Self: std::error::Error, +{ + fn into_error_report(self) -> std::result::Result; +} + +impl ErrorReport for T +where + T: std::error::Error, +{ + fn into_error_report(self) -> std::result::Result { + let mut report = String::new(); + + // Print top most error + write!( + report, + "{}", + color_print::cformat!("An unrecoverable error occured: {}\n\n", self) + )?; + write!( + report, + "Caused by these errors (recent errors listed first):\n\n" + )?; + + let mut error: &dyn std::error::Error = &self; + + while let Some(source) = error.source() { + let source_string = source.to_string(); + + let cleaned = if let Some((cleaned, _)) = source_string.split_once(':') { + cleaned + } else { + &source_string + }; + + writeln!(report, " - {}", cleaned)?; + error = source + } + + Ok(report) + } +} + #[derive(Debug)] pub struct Output where diff --git a/rust/stackablectl/src/output/result.rs b/rust/stackablectl/src/output/result.rs index 546fbd93..b5654219 100644 --- a/rust/stackablectl/src/output/result.rs +++ b/rust/stackablectl/src/output/result.rs @@ -4,15 +4,15 @@ use crate::output::{ContextExt, OutputKind}; #[derive(Debug, Default)] pub struct ResultContext { - pub used_operator_namespace: String, - pub used_product_namespace: String, + used_operator_namespace: String, + used_product_namespace: String, - pub command_hints: Vec, - pub post_hints: Vec, - pub pre_hints: Vec, + command_hints: Vec, + post_hints: Vec, + pre_hints: Vec, - pub output: String, - pub no_color: bool, + output: String, + no_color: bool, } impl ContextExt for ResultContext { diff --git a/rust/stackablectl/src/output/templates/error.tpl b/rust/stackablectl/src/output/templates/error.tpl index d73a4022..dd3cd03e 100644 --- a/rust/stackablectl/src/output/templates/error.tpl +++ b/rust/stackablectl/src/output/templates/error.tpl @@ -1,12 +1,10 @@ -An unrecoverable error occured. - {% if pre_hints | length != 0 -%} {% for pre_hint in pre_hints -%} {{ pre_hint }} {% endfor %} {% endif -%} -{{ error_report }} +{{ error_report -}} {% if post_hints | length != 0 -%} {% for post_hint in post_hints -%} From 5b1afc7098b547a477e2c14effe9a0a1acd8dcb8 Mon Sep 17 00:00:00 2001 From: Techassi Date: Tue, 17 Oct 2023 15:13:25 +0200 Subject: [PATCH 11/40] Print error chain in red --- rust/stackablectl/src/output/mod.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/rust/stackablectl/src/output/mod.rs b/rust/stackablectl/src/output/mod.rs index efb561ed..e4cb7d81 100644 --- a/rust/stackablectl/src/output/mod.rs +++ b/rust/stackablectl/src/output/mod.rs @@ -59,10 +59,11 @@ where )?; write!( report, - "Caused by these errors (recent errors listed first):\n\n" + "Caused by these errors (recent errors listed first):\n" )?; let mut error: &dyn std::error::Error = &self; + let mut index = 1; while let Some(source) = error.source() { let source_string = source.to_string(); @@ -73,8 +74,14 @@ where &source_string }; - writeln!(report, " - {}", cleaned)?; - error = source + writeln!( + report, + "{}", + color_print::cformat!(" {}: {}", index, cleaned) + )?; + + error = source; + index += 1; } Ok(report) From e45cb0cd6d25cf56a5e2b7995cf4deba061b146d Mon Sep 17 00:00:00 2001 From: Techassi Date: Tue, 17 Oct 2023 15:14:30 +0200 Subject: [PATCH 12/40] Add command suggestion when there are no stacklets --- rust/stackablectl/src/cmds/stacklet.rs | 16 +++++++++++++++- rust/stackablectl/src/output/mod.rs | 4 ++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/rust/stackablectl/src/cmds/stacklet.rs b/rust/stackablectl/src/cmds/stacklet.rs index 37fc0686..6de3de95 100644 --- a/rust/stackablectl/src/cmds/stacklet.rs +++ b/rust/stackablectl/src/cmds/stacklet.rs @@ -99,7 +99,21 @@ async fn list_cmd(args: &StackletListArgs, cli: &Cli) -> Result", + "install a complete stack", + ) + .with_command_hint( + "stackablectl demo install ", + "install an end-to-end demo", + ) + .with_output("No stacklets found"); + + // TODO (Techassi): Remove unwrap + return Ok(result.render().unwrap()); } match args.output_type { diff --git a/rust/stackablectl/src/output/mod.rs b/rust/stackablectl/src/output/mod.rs index e4cb7d81..a0325601 100644 --- a/rust/stackablectl/src/output/mod.rs +++ b/rust/stackablectl/src/output/mod.rs @@ -57,9 +57,9 @@ where "{}", color_print::cformat!("An unrecoverable error occured: {}\n\n", self) )?; - write!( + writeln!( report, - "Caused by these errors (recent errors listed first):\n" + "Caused by these errors (recent errors listed first):" )?; let mut error: &dyn std::error::Error = &self; From 1aff8ba8bfcab225dd27c1208b29defa030e89f1 Mon Sep 17 00:00:00 2001 From: Techassi Date: Tue, 17 Oct 2023 16:43:54 +0200 Subject: [PATCH 13/40] Add basic spinner support --- Cargo.lock | 29 +++++++++++++++++++++ Cargo.toml | 1 + rust/stackablectl/Cargo.toml | 1 + rust/stackablectl/src/output/mod.rs | 40 ++++++++++++++++++++--------- 4 files changed, 59 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 614d291e..969a60d8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -454,6 +454,17 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +[[package]] +name = "colored" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2674ec482fbc38012cf31e6c42ba0177b431a0cb6f15fe40efa5aab1bda516f6" +dependencies = [ + "is-terminal", + "lazy_static", + "windows-sys 0.48.0", +] + [[package]] name = "comfy-table" version = "7.0.1" @@ -1751,6 +1762,12 @@ dependencies = [ "regex", ] +[[package]] +name = "paste" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" + [[package]] name = "pem" version = "1.1.1" @@ -2589,6 +2606,17 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +[[package]] +name = "spinoff" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20aa2ed67fbb202e7b716ff8bfc6571dd9301617767380197d701c31124e88f6" +dependencies = [ + "colored", + "once_cell", + "paste", +] + [[package]] name = "stackable-cockpit" version = "0.0.0-dev" @@ -2708,6 +2736,7 @@ dependencies = [ "serde_json", "serde_yaml", "snafu", + "spinoff", "stackable-cockpit", "tera", "tokio", diff --git a/Cargo.toml b/Cargo.toml index 2e9f8069..02cc4633 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,6 +42,7 @@ serde_json = "1.0" serde_yaml = "0.9" sha2 = "0.10" snafu = "0.7" +spinoff = "0.8.0" stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "0.47.0" } tera = "1.18" tokio = { version = "1.29.0", features = ["rt-multi-thread", "macros", "fs", "process"] } diff --git a/rust/stackablectl/Cargo.toml b/rust/stackablectl/Cargo.toml index 90afa366..0612223c 100644 --- a/rust/stackablectl/Cargo.toml +++ b/rust/stackablectl/Cargo.toml @@ -27,6 +27,7 @@ serde_json.workspace = true serde_yaml.workspace = true serde.workspace = true snafu.workspace = true +spinoff.workspace = true tera.workspace = true tokio.workspace = true tracing-subscriber.workspace = true diff --git a/rust/stackablectl/src/output/mod.rs b/rust/stackablectl/src/output/mod.rs index a0325601..a5b77f76 100644 --- a/rust/stackablectl/src/output/mod.rs +++ b/rust/stackablectl/src/output/mod.rs @@ -4,6 +4,7 @@ use std::{ }; use snafu::{ResultExt, Snafu}; +use spinoff::{spinners, Color, Spinner}; use tera::Tera; mod error; @@ -88,11 +89,11 @@ where } } -#[derive(Debug)] pub struct Output where C: ContextExt, { + progress: Option, renderer: Tera, context: C, } @@ -106,20 +107,22 @@ where let no_color = use_colored_output(!no_color); context.set_no_color(no_color); - Ok(Self { renderer, context }) + Ok(Self { + progress: None, + renderer, + context, + }) } - fn create_renderer() -> Result { - let mut renderer = Tera::default(); - - renderer - .add_raw_templates(vec![ - ("result", include_str!("templates/result.tpl")), - ("error", include_str!("templates/error.tpl")), - ]) - .context(CreationSnafu)?; + pub fn enable_progress(&mut self, initial_message: String) { + self.progress + .get_or_insert(Spinner::new(spinners::Dots, initial_message, Color::Green)); + } - Ok(renderer) + pub fn set_progress_message(&mut self, message: String) { + if let Some(progress) = self.progress.as_mut() { + progress.update_text(message) + } } pub fn render(self) -> Result { @@ -134,6 +137,19 @@ where .context(RenderSnafu), } } + + fn create_renderer() -> Result { + let mut renderer = Tera::default(); + + renderer + .add_raw_templates(vec![ + ("result", include_str!("templates/result.tpl")), + ("error", include_str!("templates/error.tpl")), + ]) + .context(CreationSnafu)?; + + Ok(renderer) + } } impl Deref for Output From 26a8602fc29298b03d01f9df6a33e966d386b460 Mon Sep 17 00:00:00 2001 From: Techassi Date: Thu, 19 Oct 2023 12:36:32 +0200 Subject: [PATCH 14/40] Start to improve error variants --- Cargo.lock | 4 ++ Cargo.toml | 2 +- rust/stackable-cockpit/Cargo.toml | 1 + rust/stackable-cockpit/src/common/list.rs | 14 +---- .../src/engine/docker/mod.rs | 2 +- rust/stackable-cockpit/src/engine/kind/mod.rs | 14 ++--- .../src/engine/minikube/mod.rs | 31 ++++++---- .../src/platform/cluster/mod.rs | 12 ++-- .../src/platform/cluster/resource_request.rs | 29 +++++---- .../src/platform/demo/spec.rs | 4 +- .../src/platform/operator/spec.rs | 59 +++++++++++-------- .../stackable-cockpit/src/platform/product.rs | 3 +- .../src/platform/release/spec.rs | 11 ++-- rust/stackable-cockpit/src/xfer/mod.rs | 33 +++++++---- rust/stackable-cockpit/src/xfer/processor.rs | 20 +++++-- rust/stackablectl/src/cmds/release.rs | 2 +- 16 files changed, 137 insertions(+), 104 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 969a60d8..cab4aa60 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2369,6 +2369,9 @@ name = "semver" version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" +dependencies = [ + "serde", +] [[package]] name = "serde" @@ -2628,6 +2631,7 @@ dependencies = [ "kube", "rand", "reqwest", + "semver", "serde", "serde_json", "serde_yaml", diff --git a/Cargo.toml b/Cargo.toml index 02cc4633..11dc3f53 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,7 +36,7 @@ phf_codegen = "0.11" rand = "0.8" regex = "1.9" reqwest = { version = "0.11", default-features = false, features = ["rustls-tls"] } -semver = "1.0" +semver = { version = "1.0", features = ["serde"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" serde_yaml = "0.9" diff --git a/rust/stackable-cockpit/Cargo.toml b/rust/stackable-cockpit/Cargo.toml index 52fc810f..ae7a3a5f 100644 --- a/rust/stackable-cockpit/Cargo.toml +++ b/rust/stackable-cockpit/Cargo.toml @@ -21,6 +21,7 @@ k8s-openapi.workspace = true kube.workspace = true rand.workspace = true reqwest.workspace = true +semver.workspace = true serde_json.workspace = true serde_yaml.workspace = true serde.workspace = true diff --git a/rust/stackable-cockpit/src/common/list.rs b/rust/stackable-cockpit/src/common/list.rs index 08d6a7df..9f06be28 100644 --- a/rust/stackable-cockpit/src/common/list.rs +++ b/rust/stackable-cockpit/src/common/list.rs @@ -15,19 +15,7 @@ pub trait SpecIter { #[derive(Debug, Snafu)] pub enum ListError { - #[snafu(display("io error"))] - IoError { source: std::io::Error }, - - #[snafu(display("url parse error"))] - ParseUrlError { source: url::ParseError }, - - #[snafu(display("yaml error"))] - YamlError { source: serde_yaml::Error }, - - #[snafu(display("invalid file url"))] - InvalidFileUrl, - - #[snafu(display("transfer error"))] + #[snafu(display("failed to transfer the list file"))] TransferError { source: FileTransferError }, } diff --git a/rust/stackable-cockpit/src/engine/docker/mod.rs b/rust/stackable-cockpit/src/engine/docker/mod.rs index 96a38906..e36abf75 100644 --- a/rust/stackable-cockpit/src/engine/docker/mod.rs +++ b/rust/stackable-cockpit/src/engine/docker/mod.rs @@ -6,7 +6,7 @@ use tracing::{debug, instrument}; #[derive(Debug, Snafu)] pub enum DockerError { - #[snafu(display("io error: {source}"))] + #[snafu(display("failed to read stdout"))] IoError { source: std::io::Error }, #[snafu(display("It seems like Docker is not running on this system"))] diff --git a/rust/stackable-cockpit/src/engine/kind/mod.rs b/rust/stackable-cockpit/src/engine/kind/mod.rs index c8d6be0b..87172270 100644 --- a/rust/stackable-cockpit/src/engine/kind/mod.rs +++ b/rust/stackable-cockpit/src/engine/kind/mod.rs @@ -14,19 +14,19 @@ mod config; #[derive(Debug, Snafu)] pub enum KindClusterError { - #[snafu(display("io error"))] + #[snafu(display("failed to pipe kind config using stdin"))] IoError { source: std::io::Error }, - #[snafu(display("no stdin error"))] + #[snafu(display("failed to obtain stdin handle"))] StdinError, - #[snafu(display("kind command error: {error}"))] - KindCommandError { error: String }, + #[snafu(display("failed to execute kind command: {error}"))] + CommandError { error: String }, #[snafu(display("missing required binary: {binary}"))] MissingBinaryError { binary: String }, - #[snafu(display("docker error"))] + #[snafu(display("failed to determine if Docker is running"))] DockerError { source: DockerError }, #[snafu(display("failed to covert kind config to yaml"))] @@ -91,7 +91,7 @@ impl KindCluster { drop(stdin); if let Err(err) = kind_cmd.wait().await { - return Err(KindClusterError::KindCommandError { + return Err(KindClusterError::CommandError { error: err.to_string(), }); } @@ -134,7 +134,7 @@ impl KindCluster { ensure!( output.status.success(), - KindCommandSnafu { + CommandSnafu { error: String::from_utf8_lossy(&output.stderr) } ); diff --git a/rust/stackable-cockpit/src/engine/minikube/mod.rs b/rust/stackable-cockpit/src/engine/minikube/mod.rs index daefbb88..53968de5 100644 --- a/rust/stackable-cockpit/src/engine/minikube/mod.rs +++ b/rust/stackable-cockpit/src/engine/minikube/mod.rs @@ -5,22 +5,27 @@ use tracing::{debug, info, instrument}; use crate::{ constants::DEFAULT_LOCAL_CLUSTER_NAME, engine::{check_if_docker_is_running, DockerError}, - utils::check::binaries_present, + utils::check::binaries_present_with_name, }; #[derive(Debug, Snafu)] pub enum MinikubeClusterError { - #[snafu(display("missing dependencies"))] - MissingDepsError, + #[snafu(display( + "failed to determine if a minikube cluster named {cluster_name} already exists" + ))] + CheckClusterError { + source: std::io::Error, + cluster_name: String, + }, - #[snafu(display("command error: {error}"))] - CmdError { error: String }, + #[snafu(display("missing required binary: {binary}"))] + MissingBinaryError { binary: String }, - #[snafu(display("Docker error"))] - DockerError { source: DockerError }, + #[snafu(display("failed to execute minikube command: {error}"))] + CommandError { error: String }, - #[snafu(display("io error"))] - IoError { source: std::io::Error }, + #[snafu(display("failed to determine if Docker is running"))] + DockerError { source: DockerError }, } #[derive(Debug)] @@ -45,8 +50,8 @@ impl MinikubeCluster { info!("Creating local cluster using minikube"); // Check if required binaries are present - if !binaries_present(&["docker", "minikube"]) { - return Err(MinikubeClusterError::MissingDepsError); + if let Some(binary) = binaries_present_with_name(&["docker", "minikube"]) { + return Err(MinikubeClusterError::MissingBinaryError { binary }); } // Check if Docker is running @@ -63,7 +68,7 @@ impl MinikubeCluster { .await; if let Err(err) = minikube_cmd { - return Err(MinikubeClusterError::CmdError { + return Err(MinikubeClusterError::CommandError { error: err.to_string(), }); } @@ -104,7 +109,7 @@ impl MinikubeCluster { .args(["-o", "json"]) .output() .await - .context(IoSnafu)?; + .context(CheckClusterSnafu { cluster_name })?; if !output.status.success() { return Ok(false); diff --git a/rust/stackable-cockpit/src/platform/cluster/mod.rs b/rust/stackable-cockpit/src/platform/cluster/mod.rs index cd09bed2..ed98eca3 100644 --- a/rust/stackable-cockpit/src/platform/cluster/mod.rs +++ b/rust/stackable-cockpit/src/platform/cluster/mod.rs @@ -9,13 +9,13 @@ pub use resource_request::*; #[derive(Debug, Snafu)] pub enum ClusterError { - #[snafu(display("failed to parse node cpu"))] - ParseNodeCpu { + #[snafu(display("failed to parse node cpu quantity"))] + ParseCpuQuantityError { source: stackable_operator::error::Error, }, - #[snafu(display("failed to parse node memory"))] - ParseNodeMemory { + #[snafu(display("failed to parse node memory quantity"))] + ParseMemoryQuantityError { source: stackable_operator::error::Error, }, } @@ -66,12 +66,12 @@ impl ClusterInfo { for mut node in untainted_allocatable { if let Some(q) = node.remove("cpu") { - let cpu = CpuQuantity::try_from(q).context(ParseNodeCpuSnafu)?; + let cpu = CpuQuantity::try_from(q).context(ParseCpuQuantitySnafu)?; untainted_allocatable_cpu += cpu; } if let Some(q) = node.remove("memory") { - let memory = MemoryQuantity::try_from(q).context(ParseNodeMemorySnafu)?; + let memory = MemoryQuantity::try_from(q).context(ParseMemoryQuantitySnafu)?; untainted_allocatable_memory += memory; } } diff --git a/rust/stackable-cockpit/src/platform/cluster/resource_request.rs b/rust/stackable-cockpit/src/platform/cluster/resource_request.rs index 489f8c58..827b4d0e 100644 --- a/rust/stackable-cockpit/src/platform/cluster/resource_request.rs +++ b/rust/stackable-cockpit/src/platform/cluster/resource_request.rs @@ -11,6 +11,8 @@ use stackable_operator::{cpu::CpuQuantity, memory::MemoryQuantity}; use crate::utils::k8s::{KubeClient, KubeClientError}; +const HELP_MESSAGE: &str = ". Have a look at https://github.com/torvalds/linux/blob/f7757129e3dea336c407551c98f50057c22bb266/include/math-emu/double.h#L29 for a possible solution"; + /// Demos and stacks can define how much cluster resources they need to run /// via their definition. The struct [`ResourceRequests`] contains information /// how many CPU cores and how much memory and disk space are required to run @@ -42,8 +44,11 @@ impl Display for ResourceRequests { /// can not be parsed or validation of those requests failed. #[derive(Debug, Snafu)] pub enum ResourceRequestsError { - #[snafu(display("kube error: {source}"), context(false))] - KubeError { source: KubeClientError }, + #[snafu(display("failed to create kube client"))] + KubeClientError { source: KubeClientError }, + + #[snafu(display("failed to retrieve cluster info"))] + ClusterInfoError { source: KubeClientError }, #[snafu(display("failed to parse cpu resource requirements"))] ParseCpuResourceRequirements { @@ -64,13 +69,14 @@ pub enum ResourceRequestsError { #[derive(Debug, Snafu)] pub enum ResourceRequestsValidationError { #[snafu(display( - "The {object_name} requires {} CPU cores, but there are only {} CPU cores available in the cluster{}", required.as_cpu_count(), available.as_cpu_count(), help_message.clone().unwrap_or_default() + "The {object_name} requires {} CPU cores, but there are only {} CPU cores available in the cluster{}", + required.as_cpu_count(), available.as_cpu_count(), help_message.clone().unwrap_or_default() ))] InsufficientCpu { + help_message: Option, available: CpuQuantity, required: CpuQuantity, object_name: String, - help_message: Option, }, #[snafu(display( @@ -91,8 +97,11 @@ impl ResourceRequests { &self, object_name: &str, ) -> Result<(), ResourceRequestsError> { - let kube_client = KubeClient::new().await?; - let cluster_info = kube_client.get_cluster_info().await?; + let kube_client = KubeClient::new().await.context(KubeClientSnafu)?; + let cluster_info = kube_client + .get_cluster_info() + .await + .context(ClusterInfoSnafu)?; let stack_cpu = CpuQuantity::try_from(&self.cpu).context(ParseCpuResourceRequirementsSnafu)?; @@ -111,7 +120,7 @@ impl ResourceRequests { available: cluster_info.untainted_allocatable_cpu, object_name: object_name.to_string(), required: stack_cpu, - help_message: (rng.gen::() < 0.005).then_some(". Have a look at https://github.com/torvalds/linux/blob/f7757129e3dea336c407551c98f50057c22bb266/include/math-emu/double.h#L29 for a possible solution".to_string()), + help_message: (rng.gen::() < 0.005).then_some(HELP_MESSAGE.to_string()), }); } @@ -124,9 +133,9 @@ impl ResourceRequests { } if !errors.is_empty() { - Err(ResourceRequestsError::ValidationErrors { errors }) - } else { - Ok(()) + return Err(ResourceRequestsError::ValidationErrors { errors }); } + + Ok(()) } } diff --git a/rust/stackable-cockpit/src/platform/demo/spec.rs b/rust/stackable-cockpit/src/platform/demo/spec.rs index 8b7992a0..90811fe2 100644 --- a/rust/stackable-cockpit/src/platform/demo/spec.rs +++ b/rust/stackable-cockpit/src/platform/demo/spec.rs @@ -59,10 +59,10 @@ pub struct DemoSpecV2 { #[derive(Debug, Snafu)] pub enum DemoError { - #[snafu(display("no stack with name '{name}'"))] + #[snafu(display("no stack named {name}"))] NoSuchStack { name: String }, - #[snafu(display("stack error"))] + #[snafu(display("failed to install stack"))] StackError { source: StackError }, #[snafu(display("demo resource requests error"), context(false))] diff --git a/rust/stackable-cockpit/src/platform/operator/spec.rs b/rust/stackable-cockpit/src/platform/operator/spec.rs index fcd90062..d3e9b9e8 100644 --- a/rust/stackable-cockpit/src/platform/operator/spec.rs +++ b/rust/stackable-cockpit/src/platform/operator/spec.rs @@ -1,6 +1,7 @@ use std::{fmt::Display, str::FromStr}; -use snafu::Snafu; +use semver::Version; +use snafu::{ResultExt, Snafu}; use tracing::{info, instrument}; use crate::{ @@ -27,26 +28,30 @@ pub const VALID_OPERATORS: &[&str] = &[ "zookeeper", ]; -#[derive(Debug, Snafu, PartialEq)] +#[derive(Debug, Snafu)] pub enum OperatorSpecParseError { #[snafu(display("invalid equal sign count in operator spec, expected one"))] InvalidEqualSignCount, - #[snafu(display("invalid spec version"))] - InvalidSpecVersion, + #[snafu(display("failed to parse SemVer version"))] + ParseVersionError { source: semver::Error }, - #[snafu(display("invalid (empty) operator spec input"))] - InvalidSpecInput, + #[snafu(display("the operator spec includes '=' but no version was specified"))] + MissingVersion, + + #[snafu(display("empty operator spec input"))] + EmptyInput, #[snafu(display("invalid operator name: '{name}'"))] InvalidName { name: String }, } -/// OperatorSpec describes the format of an operator name with optional version number. The string format is -/// `(=)`. Valid values values are: `operator`, `operator=1.2.3` or `operator=1.2.3-rc1`. +/// OperatorSpec describes the format of an operator name with optional version +/// number. The string format is `(=)`. Valid values +/// are: `operator`, `operator=1.2.3` or `operator=1.2.3-rc1`. #[derive(Clone, Debug)] pub struct OperatorSpec { - pub version: Option, + pub version: Option, pub name: String, } @@ -72,7 +77,7 @@ impl FromStr for OperatorSpec { // Empty input is not allowed if input.is_empty() { - return Err(OperatorSpecParseError::InvalidSpecInput); + return Err(OperatorSpecParseError::EmptyInput); } // Split at each equal sign @@ -96,7 +101,7 @@ impl FromStr for OperatorSpec { // If there is an equal sign, but no version after if parts[1].is_empty() { - return Err(OperatorSpecParseError::InvalidSpecVersion); + return Err(OperatorSpecParseError::MissingVersion); } if !VALID_OPERATORS.contains(&parts[0]) { @@ -106,9 +111,11 @@ impl FromStr for OperatorSpec { } // There are two parts, so an operator name and version + let version: Version = parts[1].parse().context(ParseVersionSnafu)?; + Ok(Self { name: parts[0].into(), - version: Some(parts[1].into()), + version: Some(version), }) } } @@ -130,7 +137,7 @@ impl TryFrom<&str> for OperatorSpec { } impl OperatorSpec { - pub fn new(name: T, version: Option) -> Result + pub fn new(name: T, version: Option) -> Result where T: AsRef, { @@ -143,8 +150,8 @@ impl OperatorSpec { } Ok(Self { - version, name: name.to_string(), + version, }) } @@ -156,9 +163,9 @@ impl OperatorSpec { /// Returns the repo used by Helm based on the specified version pub fn helm_repo_name(&self) -> String { match &self.version { - Some(version) if version.ends_with("-nightly") => HELM_REPO_NAME_DEV, - Some(version) if version.ends_with("-dev") => HELM_REPO_NAME_DEV, - Some(version) if version.contains("-pr") => HELM_REPO_NAME_TEST, + Some(version) if version.pre.as_str() == "-nightly" => HELM_REPO_NAME_DEV, + Some(version) if version.pre.as_str() == "-dev" => HELM_REPO_NAME_DEV, + Some(version) if version.pre.as_str() == "-pr" => HELM_REPO_NAME_TEST, Some(_) => HELM_REPO_NAME_STABLE, None => HELM_REPO_NAME_DEV, } @@ -170,18 +177,18 @@ impl OperatorSpec { pub fn install(&self, namespace: &str) -> Result<(), helm::HelmError> { info!("Installing operator {}", self); - let helm_name = self.helm_name(); + let version = self.version.as_ref().map(|v| v.to_string()); let helm_repo = self.helm_repo_name(); - let version = self.version.as_deref(); + let helm_name = self.helm_name(); // Install using Helm helm::install_release_from_repo( &self.name, &helm_name, helm::ChartVersion { - repo_name: &helm_repo, + chart_version: version.as_deref(), chart_name: &helm_name, - chart_version: version, + repo_name: &helm_repo, }, None, namespace, @@ -209,6 +216,8 @@ impl OperatorSpec { #[cfg(test)] mod test { + use semver::Version; + use crate::platform::operator::{OperatorSpec, OperatorSpecParseError}; #[test] @@ -227,7 +236,7 @@ mod test { match OperatorSpec::try_from("zookeeper=1.2.3") { Ok(spec) => { assert_eq!(spec.name, String::from("zookeeper")); - assert_eq!(spec.version, Some(String::from("1.2.3"))); + assert_eq!(spec.version, Some(Version::new(1, 2, 3))); } Err(err) => panic!("{err}"), } @@ -237,7 +246,7 @@ mod test { fn empty_operator_spec() { match OperatorSpec::try_from("") { Ok(spec) => panic!("SHOULD FAIL: {spec}"), - Err(err) => assert_eq!(err, OperatorSpecParseError::InvalidSpecInput), + Err(err) => assert!(matches!(err, OperatorSpecParseError::EmptyInput)), } } @@ -245,7 +254,7 @@ mod test { fn empty_version_operator_spec() { match OperatorSpec::try_from("operator=") { Ok(spec) => panic!("SHOULD FAIL: {spec}"), - Err(err) => assert_eq!(err, OperatorSpecParseError::InvalidSpecVersion), + Err(err) => assert!(matches!(err, OperatorSpecParseError::MissingVersion)), } } @@ -253,7 +262,7 @@ mod test { fn invalid_version_operator_spec() { match OperatorSpec::try_from("operator=1.2.3=") { Ok(spec) => panic!("SHOULD FAIL: {spec}"), - Err(err) => assert_eq!(err, OperatorSpecParseError::InvalidEqualSignCount), + Err(err) => assert!(matches!(err, OperatorSpecParseError::InvalidEqualSignCount)), } } } diff --git a/rust/stackable-cockpit/src/platform/product.rs b/rust/stackable-cockpit/src/platform/product.rs index d3b6e718..b7441115 100644 --- a/rust/stackable-cockpit/src/platform/product.rs +++ b/rust/stackable-cockpit/src/platform/product.rs @@ -1,8 +1,9 @@ +use semver::Version; use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct ProductSpec { #[serde(rename = "operatorVersion")] - pub version: String, + pub version: Version, } diff --git a/rust/stackable-cockpit/src/platform/release/spec.rs b/rust/stackable-cockpit/src/platform/release/spec.rs index 25260d3e..01aee2d8 100644 --- a/rust/stackable-cockpit/src/platform/release/spec.rs +++ b/rust/stackable-cockpit/src/platform/release/spec.rs @@ -16,16 +16,16 @@ use crate::{ #[derive(Debug, Snafu)] pub enum ReleaseInstallError { - #[snafu(display("failed to parse operator spec: {source}"))] + #[snafu(display("failed to parse operator spec"))] OperatorSpecParseError { source: OperatorSpecParseError }, - #[snafu(display("failed with Helm error: {source}"))] - HelmError { source: HelmError }, + #[snafu(display("failed to install release using Helm"))] + HelmInstallError { source: HelmError }, } #[derive(Debug, Snafu)] pub enum ReleaseUninstallError { - #[snafu(display("failed with Helm error"))] + #[snafu(display("failed to uninstall release using Helm"))] HelmUninstallError { source: HelmError }, } @@ -63,8 +63,9 @@ impl ReleaseSpec { .context(OperatorSpecParseSnafu)?; // Install operator - operator.install(namespace).context(HelmSnafu)? + operator.install(namespace).context(HelmInstallSnafu)? } + Ok(()) } diff --git a/rust/stackable-cockpit/src/xfer/mod.rs b/rust/stackable-cockpit/src/xfer/mod.rs index bb5662bc..b9b8d973 100644 --- a/rust/stackable-cockpit/src/xfer/mod.rs +++ b/rust/stackable-cockpit/src/xfer/mod.rs @@ -11,31 +11,31 @@ use crate::{ utils::path::PathOrUrl, xfer::{ cache::{Cache, CacheSettings, CacheStatus, Error}, - processor::Processor, + processor::{Processor, ProcessorError}, }, }; -type Result = core::result::Result; +type Result = core::result::Result; #[derive(Debug, Snafu)] pub enum FileTransferError { - #[snafu(display("io error"))] + #[snafu(display("failed to read local file"))] IoError { source: std::io::Error }, #[snafu(display("failed to extract file name from URL"))] FileNameError, - #[snafu(display("cache error"))] + #[snafu(display("failed to create cache from provided settings"))] + CacheSettingsError { source: Error }, + + #[snafu(display("failed to read/write cache from/to cache"))] CacheError { source: Error }, - #[snafu(display("request error"))] + #[snafu(display("failed to retrieve remote file"))] RequestError { source: reqwest::Error }, - #[snafu(display("failed to deserialize content into YAML"))] - YamlError { source: serde_yaml::Error }, - - #[snafu(display("templating error"))] - TemplatingError { source: tera::Error }, + #[snafu(display("failed to process file contents"))] + ProcessingError { source: ProcessorError }, } #[derive(Debug)] @@ -47,7 +47,10 @@ pub struct FileTransferClient { impl FileTransferClient { /// Creates a new [`FileTransferClient`] with caching capabilities. pub async fn new(cache_settings: CacheSettings) -> Result { - let cache = cache_settings.try_into_cache().await.context(CacheSnafu)?; + let cache = cache_settings + .try_into_cache() + .await + .context(CacheSettingsSnafu)?; let client = reqwest::Client::new(); Ok(Self { client, cache }) @@ -66,8 +69,12 @@ impl FileTransferClient { P: Processor, { match path_or_url { - PathOrUrl::Path(path) => processor.process(self.get_from_local_file(path).await?), - PathOrUrl::Url(url) => processor.process(self.get_from_cache_or_remote(url).await?), + PathOrUrl::Path(path) => processor + .process(self.get_from_local_file(path).await?) + .context(ProcessingSnafu), + PathOrUrl::Url(url) => processor + .process(self.get_from_cache_or_remote(url).await?) + .context(ProcessingSnafu), } } diff --git a/rust/stackable-cockpit/src/xfer/processor.rs b/rust/stackable-cockpit/src/xfer/processor.rs index 5bfddafa..02e68ff0 100644 --- a/rust/stackable-cockpit/src/xfer/processor.rs +++ b/rust/stackable-cockpit/src/xfer/processor.rs @@ -1,12 +1,20 @@ use std::{collections::HashMap, marker::PhantomData}; use serde::de::DeserializeOwned; -use snafu::ResultExt; +use snafu::{ResultExt, Snafu}; -use crate::{ - utils::templating, - xfer::{Result, TemplatingSnafu, YamlSnafu}, -}; +use crate::utils::templating; + +pub type Result = std::result::Result; + +#[derive(Debug, Snafu)] +pub enum ProcessorError { + #[snafu(display("failed to deserialize YAML content"))] + DeserializeYamlError { source: serde_yaml::Error }, + + #[snafu(display("failed to render templated content"))] + TemplatingError { source: tera::Error }, +} pub trait Processor: Sized { type Input; @@ -63,7 +71,7 @@ where type Output = T; fn process(&self, input: Self::Input) -> Result { - serde_yaml::from_str(&input).context(YamlSnafu) + serde_yaml::from_str(&input).context(DeserializeYamlSnafu) } } diff --git a/rust/stackablectl/src/cmds/release.rs b/rust/stackablectl/src/cmds/release.rs index f06b7493..38f2bfb4 100644 --- a/rust/stackablectl/src/cmds/release.rs +++ b/rust/stackablectl/src/cmds/release.rs @@ -225,7 +225,7 @@ async fn describe_cmd( .set_header(vec!["PRODUCT", "OPERATOR VERSION"]); for (product_name, product) in &release.products { - product_table.add_row(vec![product_name, &product.version]); + product_table.add_row(vec![product_name, &product.version.to_string()]); } let mut table = Table::new(); From 37751bb5643d1de3fbd1073d1a878f0b8afc0ae8 Mon Sep 17 00:00:00 2001 From: Techassi Date: Thu, 19 Oct 2023 16:37:22 +0200 Subject: [PATCH 15/40] More error adjustments --- .../src/platform/credentials.rs | 8 +- .../src/platform/demo/spec.rs | 4 +- .../src/platform/stack/spec.rs | 105 ++++++++++++------ .../src/platform/stacklet/grafana.rs | 10 +- .../src/platform/stacklet/minio.rs | 11 +- .../src/platform/stacklet/mod.rs | 33 ++++-- .../src/platform/stacklet/opensearch.rs | 10 +- .../src/platform/stacklet/prometheus.rs | 10 +- 8 files changed, 127 insertions(+), 64 deletions(-) diff --git a/rust/stackable-cockpit/src/platform/credentials.rs b/rust/stackable-cockpit/src/platform/credentials.rs index df95e46f..aea1093e 100644 --- a/rust/stackable-cockpit/src/platform/credentials.rs +++ b/rust/stackable-cockpit/src/platform/credentials.rs @@ -10,8 +10,8 @@ pub type Result = std::result::Result; #[derive(Debug, Snafu)] pub enum CredentialsError { - #[snafu(display("kubernetes error"))] - KubeError { source: KubeClientError }, + #[snafu(display("failed to fetch data from kubernetes api"))] + KubeClientFetchError { source: KubeClientError }, #[snafu(display("no credentials secret found"))] NoSecret, @@ -64,7 +64,7 @@ pub async fn get_credentials( "adminUser.password", ) .await - .context(KubeSnafu)? + .context(KubeClientFetchSnafu)? } "nifi" => { let secret_name = stacklet.data["spec"]["clusterConfig"]["credentialsSecret"] @@ -79,7 +79,7 @@ pub async fn get_credentials( "password", ) .await - .context(KubeSnafu)? + .context(KubeClientFetchSnafu)? } _ => return Ok(None), }; diff --git a/rust/stackable-cockpit/src/platform/demo/spec.rs b/rust/stackable-cockpit/src/platform/demo/spec.rs index 90811fe2..10465c0d 100644 --- a/rust/stackable-cockpit/src/platform/demo/spec.rs +++ b/rust/stackable-cockpit/src/platform/demo/spec.rs @@ -1,5 +1,5 @@ use serde::{Deserialize, Serialize}; -use snafu::{ResultExt, Snafu}; +use snafu::{OptionExt, ResultExt, Snafu}; use tracing::{debug, instrument, warn}; #[cfg(feature = "openapi")] @@ -125,7 +125,7 @@ impl DemoSpecV2 { skip_release: bool, ) -> Result<(), DemoError> { // Get the stack spec based on the name defined in the demo spec - let stack_spec = stack_list.get(&self.stack).ok_or(DemoError::NoSuchStack { + let stack_spec = stack_list.get(&self.stack).context(NoSuchStackSnafu { name: self.stack.clone(), })?; diff --git a/rust/stackable-cockpit/src/platform/stack/spec.rs b/rust/stackable-cockpit/src/platform/stack/spec.rs index 534b3c50..a159d46d 100644 --- a/rust/stackable-cockpit/src/platform/stack/spec.rs +++ b/rust/stackable-cockpit/src/platform/stack/spec.rs @@ -1,7 +1,7 @@ use std::collections::HashMap; use serde::{Deserialize, Serialize}; -use snafu::{ResultExt, Snafu}; +use snafu::{OptionExt, ResultExt, Snafu}; use tracing::{debug, info, instrument, log::warn}; #[cfg(feature = "openapi")] @@ -32,44 +32,67 @@ pub type RawStackParameterParseError = RawParameterParseError; pub type RawStackParameter = RawParameter; pub type StackParameter = Parameter; -/// This error indicates that the stack, the stack manifests or the demo -/// manifests failed to install. #[derive(Debug, Snafu)] pub enum StackError { /// This error indicates that parsing a string into stack / demo parameters /// failed. - #[snafu(display("parameter parse error: {source}"))] + #[snafu(display("failed to parse demo / stack parameters"))] ParameterError { source: IntoParametersError }, - /// This error indicates that the requested stack doesn't exist in the - /// loaded list of stacks. - #[snafu(display("no such stack"))] - NoSuchStack, + /// This error indicates that the requested release doesn't exist in the + /// loaded list of releases. + #[snafu(display("no release named {name}"))] + NoSuchRelease { name: String }, /// This error indicates that the release failed to install. - #[snafu(display("release install error: {source}"))] + #[snafu(display("failed to install release"))] ReleaseInstallError { source: ReleaseInstallError }, - /// This error indicates the Helm wrapper encountered an error. - #[snafu(display("Helm error: {source}"))] - HelmError { source: HelmError }, + /// This error indicates that the Helm wrapper failed to add the Helm + /// repository. + #[snafu(display("failed to add Helm repository {repo_name}"))] + HelmAddRepositoryError { + source: HelmError, + repo_name: String, + }, + + /// This error indicates that the Hlm wrapper failed to install the Helm + /// release. + #[snafu(display("failed to install Helm release {release_name}"))] + HelmInstallReleaseError { + release_name: String, + source: HelmError, + }, + + /// This error indicates that the creation of a kube client failed. + #[snafu(display("failed to create kubernetes client"))] + KubeClientCreateError { source: KubeClientError }, - #[snafu(display("kube error: {source}"))] - KubeError { source: KubeClientError }, + /// This error indicates that the kube client failed to deloy manifests. + #[snafu(display("failed to deploy manifests using the kube client"))] + ManifestDeployError { source: KubeClientError }, - /// This error indicates a YAML error occurred. - #[snafu(display("yaml error: {source}"))] - YamlError { source: serde_yaml::Error }, + /// This error indicates that Helm chart options could not be serialized + /// into YAML. + #[snafu(display("failed to serialize Helm chart options"))] + SerializeOptionsError { source: serde_yaml::Error }, #[snafu(display("stack resource requests error"), context(false))] StackResourceRequestsError { source: ResourceRequestsError }, - #[snafu(display("path or url parse error"))] - PathOrUrlParseError { source: PathOrUrlParseError }, + /// This error indicates that parsing a string into a path or URL failed. + #[snafu(display("failed to parse '{path_or_url}' as path/url"))] + PathOrUrlParseError { + source: PathOrUrlParseError, + path_or_url: String, + }, - #[snafu(display("transfer error"))] + /// This error indicates that receiving remote content failed. + #[snafu(display("failed to receive remote content"))] TransferError { source: FileTransferError }, + /// This error indicates that the stack doesn't support being installed in + /// the provided namespace. #[snafu(display("cannot install stack in namespace '{requested}', only '{}' supported", supported.join(", ")))] UnsupportedNamespace { requested: String, @@ -165,7 +188,9 @@ impl StackSpecV2 { // Get the release by name let release = release_list .get(&self.release) - .ok_or(StackError::NoSuchStack)?; + .context(NoSuchReleaseSnafu { + name: self.release.clone(), + })?; // Install the release release @@ -235,7 +260,10 @@ impl StackSpecV2 { debug!("Installing manifest from Helm chart {}", helm_file); // Read Helm chart YAML and apply templating - let helm_file = helm_file.into_path_or_url().context(PathOrUrlParseSnafu)?; + let helm_file = helm_file.into_path_or_url().context(PathOrUrlParseSnafu { + path_or_url: helm_file.clone(), + })?; + let helm_chart: HelmChart = transfer_client .get(&helm_file, &Template::new(parameters).then(Yaml::new())) .await @@ -246,12 +274,15 @@ impl StackSpecV2 { helm_chart.name, helm_chart.version ); - helm::add_repo(&helm_chart.repo.name, &helm_chart.repo.url) - .context(HelmSnafu)?; + helm::add_repo(&helm_chart.repo.name, &helm_chart.repo.url).context( + HelmAddRepositorySnafu { + repo_name: helm_chart.repo.name.clone(), + }, + )?; // Serialize chart options to string - let values_yaml = - serde_yaml::to_string(&helm_chart.options).context(YamlSnafu)?; + let values_yaml = serde_yaml::to_string(&helm_chart.options) + .context(SerializeOptionsSnafu)?; // Install the Helm chart using the Helm wrapper helm::install_release_from_repo( @@ -266,26 +297,32 @@ impl StackSpecV2 { product_namespace, false, ) - .context(HelmSnafu)?; + .context(HelmInstallReleaseSnafu { + release_name: helm_chart.release_name, + })?; } - ManifestSpec::PlainYaml(path_or_url) => { - debug!("Installing YAML manifest from {}", path_or_url); + ManifestSpec::PlainYaml(manifest_file) => { + debug!("Installing YAML manifest from {}", manifest_file); // Read YAML manifest and apply templating - let path_or_url = path_or_url - .into_path_or_url() - .context(PathOrUrlParseSnafu)?; + let path_or_url = + manifest_file + .into_path_or_url() + .context(PathOrUrlParseSnafu { + path_or_url: manifest_file.clone(), + })?; let manifests = transfer_client .get(&path_or_url, &Template::new(parameters)) .await .context(TransferSnafu)?; - let kube_client = KubeClient::new().await.context(KubeSnafu)?; + let kube_client = KubeClient::new().await.context(KubeClientCreateSnafu)?; + kube_client .deploy_manifests(&manifests, product_namespace) .await - .context(KubeSnafu)? + .context(ManifestDeploySnafu)? } } } diff --git a/rust/stackable-cockpit/src/platform/stacklet/grafana.rs b/rust/stackable-cockpit/src/platform/stacklet/grafana.rs index 27f07421..fc4f21fc 100644 --- a/rust/stackable-cockpit/src/platform/stacklet/grafana.rs +++ b/rust/stackable-cockpit/src/platform/stacklet/grafana.rs @@ -1,9 +1,10 @@ use kube::{api::ListParams, ResourceExt}; +use snafu::ResultExt; use crate::{ platform::{ service::get_service_endpoint_urls, - stacklet::{Stacklet, StackletError}, + stacklet::{KubeClientFetchSnafu, ServiceSnafu, Stacklet, StackletError}, }, utils::k8s::{KubeClient, ListParamsExt, ProductLabel}, }; @@ -15,13 +16,16 @@ pub(super) async fn list( let mut stacklets = Vec::new(); let params = ListParams::from_product("grafana", None, ProductLabel::Name); - let services = kube_client.list_services(namespace, ¶ms).await?; + let services = kube_client + .list_services(namespace, ¶ms) + .await + .context(KubeClientFetchSnafu)?; for service in services { let service_name = service.name_any(); let endpoints = get_service_endpoint_urls(kube_client, &service, &service_name) .await - .map_err(|err| StackletError::ServiceError { source: err })?; + .context(ServiceSnafu)?; stacklets.push(Stacklet { conditions: Vec::new(), diff --git a/rust/stackable-cockpit/src/platform/stacklet/minio.rs b/rust/stackable-cockpit/src/platform/stacklet/minio.rs index 344f0e7a..2c204c60 100644 --- a/rust/stackable-cockpit/src/platform/stacklet/minio.rs +++ b/rust/stackable-cockpit/src/platform/stacklet/minio.rs @@ -1,9 +1,10 @@ use kube::{api::ListParams, ResourceExt}; +use snafu::ResultExt; use crate::{ platform::{ service::get_service_endpoint_urls, - stacklet::{Stacklet, StackletError}, + stacklet::{KubeClientFetchSnafu, ServiceSnafu, Stacklet, StackletError}, }, utils::k8s::KubeClient, }; @@ -16,7 +17,11 @@ pub(super) async fn list( // The helm-chart uses `app` instead of `app.kubernetes.io/app`, so we can't use `ListParams::from_product` here let params = ListParams::default().labels("app=minio,app.kubernetes.io/managed-by=Helm"); - let services = kube_client.list_services(namespace, ¶ms).await?; + let services = kube_client + .list_services(namespace, ¶ms) + .await + .context(KubeClientFetchSnafu)?; + let console_services = services .iter() .filter(|s| s.name_unchecked().ends_with("-console")); @@ -25,7 +30,7 @@ pub(super) async fn list( let service_name = service.name_any(); let endpoints = get_service_endpoint_urls(kube_client, service, &service_name) .await - .map_err(|err| StackletError::ServiceError { source: err })?; + .context(ServiceSnafu)?; stacklets.push(Stacklet { product: "minio".to_string(), diff --git a/rust/stackable-cockpit/src/platform/stacklet/mod.rs b/rust/stackable-cockpit/src/platform/stacklet/mod.rs index 308bcc95..75bcde07 100644 --- a/rust/stackable-cockpit/src/platform/stacklet/mod.rs +++ b/rust/stackable-cockpit/src/platform/stacklet/mod.rs @@ -48,14 +48,17 @@ pub struct Stacklet { #[derive(Debug, Snafu)] pub enum StackletError { - #[snafu(display("kubernetes error"), context(false))] - KubeError { source: KubeClientError }, + #[snafu(display("failed to create kubernetes client"))] + KubeClientCreateError { source: KubeClientError }, + + #[snafu(display("failed to fetch data from the kubernetes api"))] + KubeClientFetchError { source: KubeClientError }, #[snafu(display("no namespace set for custom resource '{crd_name}'"))] CustomCrdNamespaceError { crd_name: String }, - #[snafu(display("JSON error"))] - JsonError { source: serde_json::Error }, + #[snafu(display("failed to deserialize cluster conditions from json"))] + DeserializeConditionsError { source: serde_json::Error }, #[snafu(display("service error"))] ServiceError { source: ServiceError }, @@ -66,7 +69,7 @@ pub enum StackletError { /// in the specified namespace are returned. The `options` allow further /// customization of the returned information. pub async fn list_stacklets(namespace: Option<&str>) -> Result, StackletError> { - let kube_client = KubeClient::new().await?; + let kube_client = KubeClient::new().await.context(KubeClientCreateSnafu)?; let mut stacklets = list_stackable_stacklets(&kube_client, namespace).await?; stacklets.extend(grafana::list(&kube_client, namespace).await?); @@ -82,12 +85,13 @@ pub async fn get_credentials_for_product( object_name: &str, product_name: &str, ) -> Result, StackletError> { - let kube_client = KubeClient::new().await?; + let kube_client = KubeClient::new().await.context(KubeClientCreateSnafu)?; let product_gvk = gvk_from_product_name(product_name); let product_cluster = match kube_client .get_namespaced_object(namespace, object_name, &product_gvk) - .await? + .await + .context(KubeClientFetchSnafu)? { Some(obj) => obj, None => { @@ -101,7 +105,9 @@ pub async fn get_credentials_for_product( let credentials = match get_credentials(&kube_client, product_name, &product_cluster).await { Ok(credentials) => credentials, Err(CredentialsError::NoSecret) => None, - Err(CredentialsError::KubeError { source }) => return Err(source.into()), + Err(CredentialsError::KubeClientFetchError { source }) => { + return Err(StackletError::KubeClientFetchError { source }) + } }; Ok(credentials) @@ -115,7 +121,11 @@ async fn list_stackable_stacklets( let mut stacklets = Vec::new(); for (product_name, product_gvk) in product_list { - let objects = match kube_client.list_objects(&product_gvk, namespace).await? { + let objects = match kube_client + .list_objects(&product_gvk, namespace) + .await + .context(KubeClientFetchSnafu)? + { Some(obj) => obj, None => { info!( @@ -128,9 +138,8 @@ async fn list_stackable_stacklets( for object in objects { let conditions: Vec = match object.data.pointer("/status/conditions") { - Some(conditions) => { - serde_json::from_value(conditions.clone()).context(JsonSnafu)? - } + Some(conditions) => serde_json::from_value(conditions.clone()) + .context(DeserializeConditionsSnafu)?, None => vec![], }; diff --git a/rust/stackable-cockpit/src/platform/stacklet/opensearch.rs b/rust/stackable-cockpit/src/platform/stacklet/opensearch.rs index 24c56697..d5497f2b 100644 --- a/rust/stackable-cockpit/src/platform/stacklet/opensearch.rs +++ b/rust/stackable-cockpit/src/platform/stacklet/opensearch.rs @@ -1,9 +1,10 @@ use kube::{api::ListParams, ResourceExt}; +use snafu::ResultExt; use crate::{ platform::{ service::get_service_endpoint_urls, - stacklet::{Stacklet, StackletError}, + stacklet::{KubeClientFetchSnafu, ServiceSnafu, Stacklet, StackletError}, }, utils::k8s::{KubeClient, ListParamsExt, ProductLabel}, }; @@ -15,13 +16,16 @@ pub(super) async fn list( let mut stacklets = Vec::new(); let params = ListParams::from_product("opensearch-dashboards", None, ProductLabel::Name); - let services = kube_client.list_services(namespace, ¶ms).await?; + let services = kube_client + .list_services(namespace, ¶ms) + .await + .context(KubeClientFetchSnafu)?; for service in services { let service_name = service.name_any(); let endpoints = get_service_endpoint_urls(kube_client, &service, &service_name) .await - .map_err(|err| StackletError::ServiceError { source: err })?; + .context(ServiceSnafu)?; // TODO: Add "Logs view" extra info from old stackablectl once "Extra info" field is supported. // see https://github.com/stackabletech/stackablectl/blob/eda45945cfcf5c6581cf1b88c782d98fada8065f/src/services/opensearch.rs#L41 diff --git a/rust/stackable-cockpit/src/platform/stacklet/prometheus.rs b/rust/stackable-cockpit/src/platform/stacklet/prometheus.rs index 3c09f812..3d46baf2 100644 --- a/rust/stackable-cockpit/src/platform/stacklet/prometheus.rs +++ b/rust/stackable-cockpit/src/platform/stacklet/prometheus.rs @@ -1,9 +1,10 @@ use kube::{api::ListParams, ResourceExt}; +use snafu::ResultExt; use crate::{ platform::{ service::get_service_endpoint_urls, - stacklet::{Stacklet, StackletError}, + stacklet::{KubeClientFetchSnafu, ServiceSnafu, Stacklet, StackletError}, }, utils::k8s::KubeClient, }; @@ -16,13 +17,16 @@ pub(super) async fn list( // The helm-chart uses `app` instead of `app.kubernetes.io/app`, so we can't use `ListParams::from_product` here let params = ListParams::default().labels("app=kube-prometheus-stack-prometheus"); - let services = kube_client.list_services(namespace, ¶ms).await?; + let services = kube_client + .list_services(namespace, ¶ms) + .await + .context(KubeClientFetchSnafu)?; for service in services { let service_name = service.name_any(); let endpoints = get_service_endpoint_urls(kube_client, &service, &service_name) .await - .map_err(|err| StackletError::ServiceError { source: err })?; + .context(ServiceSnafu)?; stacklets.push(Stacklet { product: "prometheus".to_string(), From e614ab3989f7e5336fd7eb2bcd202d94f59bd5a2 Mon Sep 17 00:00:00 2001 From: Techassi Date: Fri, 20 Oct 2023 10:52:56 +0200 Subject: [PATCH 16/40] Even more error adjustments --- .../src/platform/namespace.rs | 11 ++-- .../stackable-cockpit/src/platform/service.rs | 23 +++++--- .../stackable-cockpit/src/utils/k8s/client.rs | 33 ++++++----- rust/stackable-cockpit/src/utils/params.rs | 57 +++++++------------ rust/stackable-cockpit/src/utils/path.rs | 2 +- 5 files changed, 63 insertions(+), 63 deletions(-) diff --git a/rust/stackable-cockpit/src/platform/namespace.rs b/rust/stackable-cockpit/src/platform/namespace.rs index d423901f..61f17cd9 100644 --- a/rust/stackable-cockpit/src/platform/namespace.rs +++ b/rust/stackable-cockpit/src/platform/namespace.rs @@ -4,8 +4,8 @@ use crate::utils::k8s::{KubeClient, KubeClientError}; #[derive(Debug, Snafu)] pub enum NamespaceError { - #[snafu(display("kubernetes client error"))] - KubeClientError { source: KubeClientError }, + #[snafu(display("failed to create kubernetes client"))] + KubeClientCreateError { source: KubeClientError }, #[snafu(display("permission denied - try to create the namespace manually or choose an already existing one to which you have access to"))] PermissionDenied, @@ -14,17 +14,18 @@ pub enum NamespaceError { /// Creates a namespace with `name` if needed (not already present in the /// cluster). pub async fn create_if_needed(name: String) -> Result<(), NamespaceError> { - let client = KubeClient::new().await.context(KubeClientSnafu)?; + let client = KubeClient::new().await.context(KubeClientCreateSnafu)?; + client .create_namespace_if_needed(name) .await .map_err(|err| match err { KubeClientError::KubeError { source } => match source { kube::Error::Api(err) if err.code == 401 => NamespaceError::PermissionDenied, - _ => NamespaceError::KubeClientError { + _ => NamespaceError::KubeClientCreateError { source: KubeClientError::KubeError { source }, }, }, - _ => NamespaceError::KubeClientError { source: err }, + _ => NamespaceError::KubeClientCreateError { source: err }, }) } diff --git a/rust/stackable-cockpit/src/platform/service.rs b/rust/stackable-cockpit/src/platform/service.rs index 27ee3eae..4f767a12 100644 --- a/rust/stackable-cockpit/src/platform/service.rs +++ b/rust/stackable-cockpit/src/platform/service.rs @@ -17,8 +17,8 @@ use crate::utils::k8s::{KubeClient, KubeClientError, ListParamsExt, ProductLabel #[derive(Debug, Snafu)] pub enum ServiceError { - #[snafu(display("kube error: {source}"))] - KubeClientError { source: KubeClientError }, + #[snafu(display("failed to fetch data from kubernetes api"))] + KubeClientFetchError { source: KubeClientError }, #[snafu(display("missing namespace for service '{service}'"))] MissingServiceNamespace { service: String }, @@ -26,16 +26,16 @@ pub enum ServiceError { #[snafu(display("missing spec for service '{service}'"))] MissingServiceSpec { service: String }, - #[snafu(display("failed to get status of node {node_name}"))] + #[snafu(display("failed to get status of node '{node_name}'"))] GetNodeStatus { node_name: String }, - #[snafu(display("failed to get address of node {node_name}"))] + #[snafu(display("failed to get address of node '{node_name}'"))] GetNodeAddress { node_name: String }, - #[snafu(display("Could not find an ExternalIP or InternalIP for node {node_name}"))] + #[snafu(display("failed to find an ExternalIP or InternalIP for node '{node_name}'"))] NoIpForNode { node_name: String }, - #[snafu(display("failed to find node {node_name} in node_name_ip_mapping"))] + #[snafu(display("failed to find node '{node_name}' in node_name_ip_mapping"))] NodeMissingInIpMapping { node_name: String }, } @@ -51,7 +51,7 @@ pub async fn get_service_endpoints( let services = kube_client .list_services(Some(object_namespace), &service_list_params) .await - .context(KubeClientSnafu)?; + .context(KubeClientFetchSnafu)?; let mut endpoints = IndexMap::new(); @@ -74,9 +74,11 @@ pub async fn get_service_endpoint_urls( referenced_object_name: &str, ) -> Result, ServiceError> { let service_name = service.name_unchecked(); + let service_namespace = service.namespace().context(MissingServiceNamespaceSnafu { service: service_name.clone(), })?; + let service_spec = service.spec.as_ref().context(MissingServiceSpecSnafu { service: service_name.clone(), })?; @@ -117,7 +119,7 @@ pub async fn get_service_endpoint_urls_for_nodeport( let endpoints = kube_client .get_endpoints(service_namespace, service_name) .await - .context(KubeClientSnafu)?; + .context(KubeClientFetchSnafu)?; let node_name = match &endpoints.subsets { Some(subsets) if subsets.len() == 1 => match &subsets[0].addresses { @@ -235,7 +237,10 @@ async fn get_node_ip(kube_client: &KubeClient, node_name: &str) -> Result Result, ServiceError> { - let nodes = kube_client.list_nodes().await.context(KubeClientSnafu)?; + let nodes = kube_client + .list_nodes() + .await + .context(KubeClientFetchSnafu)?; let mut result = HashMap::new(); for node in nodes { diff --git a/rust/stackable-cockpit/src/utils/k8s/client.rs b/rust/stackable-cockpit/src/utils/k8s/client.rs index 8ba83ab7..89ebc457 100644 --- a/rust/stackable-cockpit/src/utils/k8s/client.rs +++ b/rust/stackable-cockpit/src/utils/k8s/client.rs @@ -29,11 +29,11 @@ pub type Result = std::result::Result; #[derive(Debug, Snafu)] pub enum KubeClientError { - #[snafu(display("kube error: {source}"))] + #[snafu(display("kubernetes error"))] KubeError { source: kube::error::Error }, - #[snafu(display("yaml error: {source}"))] - YamlError { source: serde_yaml::Error }, + #[snafu(display("failed to deserialize yaml data"))] + DeserializeYamlError { source: serde_yaml::Error }, #[snafu(display("failed to deploy manifest because type of object {object:?} is not set"))] ObjectTypeError { object: DynamicObject }, @@ -50,14 +50,14 @@ pub enum KubeClientError { #[snafu(display("failed to retrieve cluster information"))] ClusterError { source: ClusterError }, - #[snafu(display("invalid secret data (empty)"))] - InvalidSecretData, + #[snafu(display("invalid or empty secret data in '{secret_name}'"))] + InvalidSecretData { secret_name: String }, - #[snafu(display("no username key in credentials secret"))] - NoUsernameKey, + #[snafu(display("no username key in credentials secret '{secret_name}'"))] + NoUsernameKey { secret_name: String }, - #[snafu(display("no password key in credentials secret"))] - NoPasswordKey, + #[snafu(display("no password key in credentials secret '{secret_name}'"))] + NoPasswordKey { secret_name: String }, } pub struct KubeClient { @@ -83,7 +83,8 @@ impl KubeClient { /// resolve GVKs or unable to patch the dynamic objects. pub async fn deploy_manifests(&self, manifests: &str, namespace: &str) -> Result<()> { for manifest in serde_yaml::Deserializer::from_str(manifests) { - let mut object = DynamicObject::deserialize(manifest).context(YamlSnafu)?; + let mut object = DynamicObject::deserialize(manifest).context(DeserializeYamlSnafu)?; + let object_type = object.types.as_ref().ok_or( ObjectTypeSnafu { object: object.clone(), @@ -199,17 +200,23 @@ impl KubeClient { let secret_api: Api = Api::namespaced(self.client.clone(), secret_namespace); let secret = secret_api.get(secret_name).await.context(KubeSnafu)?; - let secret_data = secret.data.context(InvalidSecretDataSnafu)?; + let secret_name = secret.name_any(); + + let secret_data = secret.data.context(InvalidSecretDataSnafu { + secret_name: secret_name.clone(), + })?; let username = secret_data .get(username_key) - .context(NoUsernameKeySnafu)? + .context(NoUsernameKeySnafu { + secret_name: secret_name.clone(), + })? .try_to_string() .context(ByteStringConvertSnafu)?; let password = secret_data .get(password_key) - .context(NoPasswordKeySnafu)? + .context(NoPasswordKeySnafu { secret_name })? .try_to_string() .context(ByteStringConvertSnafu)?; diff --git a/rust/stackable-cockpit/src/utils/params.rs b/rust/stackable-cockpit/src/utils/params.rs index daaf3399..56e2f6e4 100644 --- a/rust/stackable-cockpit/src/utils/params.rs +++ b/rust/stackable-cockpit/src/utils/params.rs @@ -5,7 +5,7 @@ use std::{ }; use serde::{Deserialize, Serialize}; -use snafu::{ResultExt, Snafu}; +use snafu::{ensure, ResultExt, Snafu}; #[cfg(feature = "openapi")] use utoipa::ToSchema; @@ -31,7 +31,7 @@ pub struct Parameter { #[derive(Debug, Snafu, PartialEq)] pub enum IntoParametersError { - #[snafu(display("raw parameter parse error"))] + #[snafu(display("failed to parse raw parameter"))] ParseError { source: RawParameterParseError }, #[snafu(display("invalid parameter '{parameter}', expected one of {expected}"))] @@ -56,15 +56,15 @@ pub trait IntoParameters: Sized + IntoRawParameters { for raw_paramater in raw_parameters { if !parameters.contains_key(&raw_paramater.name) { - return Err(IntoParametersError::InvalidParameter { + return InvalidParameterSnafu { parameter: raw_paramater.name, - expected: valid_parameters - .as_ref() - .iter() - .map(|p| p.name.clone()) + expected: parameters + .keys() + .cloned() .collect::>() .join(", "), - }); + } + .fail(); } parameters.insert(raw_paramater.name, raw_paramater.value); } @@ -95,13 +95,13 @@ pub enum RawParameterParseError { InvalidEqualSignCount, #[snafu(display("invalid parameter value, cannot be empty"))] - InvalidParameterValue, + EmptyValue, #[snafu(display("invalid parameter name, cannot be empty"))] - InvalidParameterName, + EmptyName, #[snafu(display("invalid (empty) parameter input"))] - InvalidParameterInput, + EmptyInput, } impl Display for RawParameter { @@ -117,33 +117,23 @@ impl FromStr for RawParameter { let input = s.trim(); // Empty input is not allowed - if input.is_empty() { - return Err(RawParameterParseError::InvalidParameterInput); - } + ensure!(!input.is_empty(), EmptyInputSnafu); // Split at each equal sign let parts: Vec<&str> = input.split('=').collect(); let len = parts.len(); - // If there are more than 2 equal signs, return error - // because of invalid spec format - if len > 2 { - return Err(RawParameterParseError::InvalidEqualSignCount); - } - - // Only specifying a key is not valid - if len == 1 { - return Err(RawParameterParseError::InvalidParameterValue); - } + // Input without any or more than one sign character is invalid + ensure!(len == 2, InvalidEqualSignCountSnafu); // If there is an equal sign, but no key before if parts[0].is_empty() { - return Err(RawParameterParseError::InvalidParameterName); + return Err(RawParameterParseError::EmptyName); } // If there is an equal sign, but no value after if parts[1].is_empty() { - return Err(RawParameterParseError::InvalidParameterValue); + return Err(RawParameterParseError::EmptyValue); } Ok(Self { @@ -190,7 +180,7 @@ impl IntoRawParameters for &str { let input = self.trim(); if input.is_empty() { - return Err(RawParameterParseError::InvalidParameterInput); + return Err(RawParameterParseError::EmptyInput); } let mut params = Vec::new(); @@ -218,10 +208,7 @@ impl IntoRawParameters for Vec { #[cfg(test)] mod test { - use crate::utils::params::{ - IntoParameters, IntoParametersError, IntoRawParameters, Parameter, RawParameter, - RawParameterParseError, - }; + use super::*; #[test] fn single_parameter_str() { @@ -246,10 +233,10 @@ mod test { } #[test] - fn single_parameter_no_value() { + fn single_parameter_no_equal_sign() { match RawParameter::try_from("param") { Ok(param) => panic!("SHOULD FAIL: {param}"), - Err(err) => assert_eq!(err, RawParameterParseError::InvalidParameterValue), + Err(err) => assert_eq!(err, RawParameterParseError::InvalidEqualSignCount), } } @@ -257,7 +244,7 @@ mod test { fn single_parameter_equal_sign_no_value() { match RawParameter::try_from("param=") { Ok(param) => panic!("SHOULD FAIL: {param}"), - Err(err) => assert_eq!(err, RawParameterParseError::InvalidParameterValue), + Err(err) => assert_eq!(err, RawParameterParseError::EmptyValue), } } @@ -265,7 +252,7 @@ mod test { fn single_parameter_only_equal_sign() { match RawParameter::try_from("=") { Ok(param) => panic!("SHOULD FAIL: {param}"), - Err(err) => assert_eq!(err, RawParameterParseError::InvalidParameterName), + Err(err) => assert_eq!(err, RawParameterParseError::EmptyName), } } diff --git a/rust/stackable-cockpit/src/utils/path.rs b/rust/stackable-cockpit/src/utils/path.rs index da05ac3b..d3654f61 100644 --- a/rust/stackable-cockpit/src/utils/path.rs +++ b/rust/stackable-cockpit/src/utils/path.rs @@ -11,7 +11,7 @@ pub enum PathOrUrl { #[derive(Debug, Snafu)] pub enum PathOrUrlParseError { - #[snafu(display("url parse error"))] + #[snafu(display("failed to parse url"))] UrlParseError { source: ParseError }, } From ce5457b0ef52832b313426452f364658d176507b Mon Sep 17 00:00:00 2001 From: Techassi Date: Fri, 20 Oct 2023 11:14:48 +0200 Subject: [PATCH 17/40] Final error adjustments --- rust/stackable-cockpit/src/engine/kind/mod.rs | 2 +- rust/stackable-cockpit/src/helm.rs | 21 ++++++++++--------- .../src/platform/stacklet/mod.rs | 2 +- .../stackable-cockpit/src/utils/k8s/client.rs | 2 +- rust/stackable-cockpit/src/utils/path.rs | 2 +- rust/stackablectl/src/cmds/demo.rs | 4 ++-- rust/stackablectl/src/cmds/operator.rs | 4 ++-- rust/stackablectl/src/cmds/release.rs | 4 ++-- rust/stackablectl/src/cmds/stack.rs | 4 ++-- rust/stackablectl/src/cmds/stacklet.rs | 4 ++-- 10 files changed, 25 insertions(+), 24 deletions(-) diff --git a/rust/stackable-cockpit/src/engine/kind/mod.rs b/rust/stackable-cockpit/src/engine/kind/mod.rs index 87172270..2101e3da 100644 --- a/rust/stackable-cockpit/src/engine/kind/mod.rs +++ b/rust/stackable-cockpit/src/engine/kind/mod.rs @@ -29,7 +29,7 @@ pub enum KindClusterError { #[snafu(display("failed to determine if Docker is running"))] DockerError { source: DockerError }, - #[snafu(display("failed to covert kind config to yaml"))] + #[snafu(display("failed to covert kind config to YAML"))] YamlError { source: serde_yaml::Error }, } diff --git a/rust/stackable-cockpit/src/helm.rs b/rust/stackable-cockpit/src/helm.rs index d6ed4688..3190066c 100644 --- a/rust/stackable-cockpit/src/helm.rs +++ b/rust/stackable-cockpit/src/helm.rs @@ -52,19 +52,19 @@ pub struct HelmRepoEntry { #[derive(Debug, Snafu)] pub enum HelmError { - #[snafu(display("str utf-8 error: {source}"))] + #[snafu(display("failed to convert raw C string pointer to UTF-8 string"))] StrUtf8Error { source: Utf8Error }, - #[snafu(display("url parse error: {source}"))] + #[snafu(display("failed to parse URL"))] UrlParseError { source: url::ParseError }, - #[snafu(display("json error: {source}"))] - JsonError { source: serde_json::Error }, + #[snafu(display("failed to deserialize JSON data"))] + DeserializeJsonError { source: serde_json::Error }, - #[snafu(display("yaml error: {source}"))] - YamlError { source: serde_yaml::Error }, + #[snafu(display("failed to deserialize YAML data"))] + DeserializeYamlError { source: serde_yaml::Error }, - #[snafu(display("request error: {source}"))] + #[snafu(display("failed to retrieve remote content"))] RequestError { source: reqwest::Error }, #[snafu(display("failed to add Helm repo: {error}"))] @@ -73,7 +73,7 @@ pub enum HelmError { #[snafu(display("failed to list Helm releases: {error}"))] ListReleasesError { error: String }, - #[snafu(display("failed to install Helm release: {source}"))] + #[snafu(display("failed to install Helm release"))] InstallReleaseError { source: HelmInstallReleaseError }, #[snafu(display("failed to uninstall Helm release: {error}"))] @@ -375,7 +375,7 @@ pub fn list_releases(namespace: &str) -> Result, HelmError> { return Err(HelmError::ListReleasesError { error: err }); } - serde_json::from_str(result).context(JsonSnafu) + serde_json::from_str(result).context(DeserializeJsonSnafu) } /// Returns a single Helm release by `release_name`. @@ -421,6 +421,7 @@ where debug!("Using {} to retrieve Helm index file", url); + // TODO (Techassi): Use the FileTransferClient for that let index_file_content = reqwest::get(url) .await .context(RequestSnafu)? @@ -428,7 +429,7 @@ where .await .context(RequestSnafu)?; - serde_yaml::from_str(&index_file_content).context(YamlSnafu) + serde_yaml::from_str(&index_file_content).context(DeserializeYamlSnafu) } /// Helper function to convert raw C string pointers to &str. diff --git a/rust/stackable-cockpit/src/platform/stacklet/mod.rs b/rust/stackable-cockpit/src/platform/stacklet/mod.rs index 75bcde07..156591d8 100644 --- a/rust/stackable-cockpit/src/platform/stacklet/mod.rs +++ b/rust/stackable-cockpit/src/platform/stacklet/mod.rs @@ -57,7 +57,7 @@ pub enum StackletError { #[snafu(display("no namespace set for custom resource '{crd_name}'"))] CustomCrdNamespaceError { crd_name: String }, - #[snafu(display("failed to deserialize cluster conditions from json"))] + #[snafu(display("failed to deserialize cluster conditions from JSON"))] DeserializeConditionsError { source: serde_json::Error }, #[snafu(display("service error"))] diff --git a/rust/stackable-cockpit/src/utils/k8s/client.rs b/rust/stackable-cockpit/src/utils/k8s/client.rs index 89ebc457..65ce3428 100644 --- a/rust/stackable-cockpit/src/utils/k8s/client.rs +++ b/rust/stackable-cockpit/src/utils/k8s/client.rs @@ -32,7 +32,7 @@ pub enum KubeClientError { #[snafu(display("kubernetes error"))] KubeError { source: kube::error::Error }, - #[snafu(display("failed to deserialize yaml data"))] + #[snafu(display("failed to deserialize YAML data"))] DeserializeYamlError { source: serde_yaml::Error }, #[snafu(display("failed to deploy manifest because type of object {object:?} is not set"))] diff --git a/rust/stackable-cockpit/src/utils/path.rs b/rust/stackable-cockpit/src/utils/path.rs index d3654f61..331f1538 100644 --- a/rust/stackable-cockpit/src/utils/path.rs +++ b/rust/stackable-cockpit/src/utils/path.rs @@ -11,7 +11,7 @@ pub enum PathOrUrl { #[derive(Debug, Snafu)] pub enum PathOrUrlParseError { - #[snafu(display("failed to parse url"))] + #[snafu(display("failed to parse URL"))] UrlParseError { source: ParseError }, } diff --git a/rust/stackablectl/src/cmds/demo.rs b/rust/stackablectl/src/cmds/demo.rs index 9c55ffe4..ed4ddb09 100644 --- a/rust/stackablectl/src/cmds/demo.rs +++ b/rust/stackablectl/src/cmds/demo.rs @@ -112,10 +112,10 @@ pub struct DemoUninstallArgs {} #[derive(Debug, Snafu)] pub enum CmdError { - #[snafu(display("unable to format yaml output"))] + #[snafu(display("unable to format YAML output"))] YamlOutputFormatError { source: serde_yaml::Error }, - #[snafu(display("unable to format json output"))] + #[snafu(display("unable to format JSON output"))] JsonOutputFormatError { source: serde_json::Error }, #[snafu(display("no demo with name '{name}'"))] diff --git a/rust/stackablectl/src/cmds/operator.rs b/rust/stackablectl/src/cmds/operator.rs index 9766d3ee..47cdbc68 100644 --- a/rust/stackablectl/src/cmds/operator.rs +++ b/rust/stackablectl/src/cmds/operator.rs @@ -138,10 +138,10 @@ pub enum CmdError { #[snafu(display("semver parse error"))] SemVerParseError { source: semver::Error }, - #[snafu(display("unable to format yaml output"))] + #[snafu(display("unable to format YAML output"))] YamlOutputFormatError { source: serde_yaml::Error }, - #[snafu(display("unable to format json output"))] + #[snafu(display("unable to format JSON output"))] JsonOutputFormatError { source: serde_json::Error }, #[snafu(display("failed to create namespace '{namespace}'"))] diff --git a/rust/stackablectl/src/cmds/release.rs b/rust/stackablectl/src/cmds/release.rs index 38f2bfb4..d79fdab1 100644 --- a/rust/stackablectl/src/cmds/release.rs +++ b/rust/stackablectl/src/cmds/release.rs @@ -97,10 +97,10 @@ pub struct ReleaseUninstallArgs { #[derive(Debug, Snafu)] pub enum CmdError { - #[snafu(display("unable to format yaml output"))] + #[snafu(display("unable to format YAML output"))] YamlOutputFormatError { source: serde_yaml::Error }, - #[snafu(display("unable to format json output"))] + #[snafu(display("unable to format JSON output"))] JsonOutputFormatError { source: serde_json::Error }, #[snafu(display("path/url parse error"))] diff --git a/rust/stackablectl/src/cmds/stack.rs b/rust/stackablectl/src/cmds/stack.rs index de071410..1cc9f8d7 100644 --- a/rust/stackablectl/src/cmds/stack.rs +++ b/rust/stackablectl/src/cmds/stack.rs @@ -107,10 +107,10 @@ pub enum CmdError { #[snafu(display("path/url parse error"))] PathOrUrlParseError { source: PathOrUrlParseError }, - #[snafu(display("unable to format yaml output"))] + #[snafu(display("unable to format YAML output"))] YamlOutputFormatError { source: serde_yaml::Error }, - #[snafu(display("unable to format json output"))] + #[snafu(display("unable to format JSON output"))] JsonOutputFormatError { source: serde_json::Error }, #[snafu(display("stack error"))] diff --git a/rust/stackablectl/src/cmds/stacklet.rs b/rust/stackablectl/src/cmds/stacklet.rs index 6de3de95..314b260e 100644 --- a/rust/stackablectl/src/cmds/stacklet.rs +++ b/rust/stackablectl/src/cmds/stacklet.rs @@ -71,10 +71,10 @@ pub enum CmdError { #[snafu(display("failed to retrieve credentials for stacklet"))] StackletCredentialsError { source: StackletError }, - #[snafu(display("unable to format yaml output"))] + #[snafu(display("unable to format YAML output"))] YamlOutputFormatError { source: serde_yaml::Error }, - #[snafu(display("unable to format json output"))] + #[snafu(display("unable to format JSON output"))] JsonOutputFormatError { source: serde_json::Error }, } From 1bc4f6a46570affdf40018944ad0d425cec09ecd Mon Sep 17 00:00:00 2001 From: Techassi Date: Fri, 20 Oct 2023 11:40:14 +0200 Subject: [PATCH 18/40] Bump k8s_openapi and operator-rs version --- Cargo.lock | 694 +++++++++++++--------------- Cargo.toml | 6 +- extra/completions/stackablectl.bash | 2 +- extra/completions/stackablectl.fish | 28 +- 4 files changed, 337 insertions(+), 393 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cab4aa60..6ea49573 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "addr2line" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" dependencies = [ "gimli", ] @@ -31,9 +31,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.0.4" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6748e8def348ed4d14996fa801f4122cd763fff530258cdc03f64b25f89d3a5a" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" dependencies = [ "memchr", ] @@ -61,30 +61,29 @@ dependencies = [ [[package]] name = "anstream" -version = "0.3.2" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" +checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", - "is-terminal", "utf8parse", ] [[package]] name = "anstyle" -version = "1.0.1" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd" +checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" [[package]] name = "anstyle-parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" +checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" dependencies = [ "utf8parse", ] @@ -100,9 +99,9 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "1.0.2" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c677ab05e09154296dd37acecd46420c17b9713e8366facafa8fc0885167cf4c" +checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" dependencies = [ "anstyle", "windows-sys 0.48.0", @@ -110,13 +109,13 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.73" +version = "0.1.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" +checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -188,9 +187,9 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.68" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" dependencies = [ "addr2line", "cc", @@ -201,12 +200,6 @@ dependencies = [ "rustc-demangle", ] -[[package]] -name = "base64" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - [[package]] name = "base64" version = "0.20.0" @@ -215,9 +208,9 @@ checksum = "0ea22880d78093b0cbe17c89f64a7d457941e65759157ec6cb31a31d652b05e5" [[package]] name = "base64" -version = "0.21.2" +version = "0.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" +checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" [[package]] name = "bcrypt" @@ -225,7 +218,7 @@ version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28d1c9c15093eb224f0baa400f38fcd713fc1391a6f1c389d886beef146d60a3" dependencies = [ - "base64 0.21.2", + "base64 0.21.4", "blowfish", "getrandom", "subtle", @@ -255,9 +248,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" [[package]] name = "block-buffer" @@ -280,9 +273,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05" +checksum = "c79ad7fb2dd38f3dabd76b09c6a5a20c038fc0213ef1e9afd30eb777f120f019" dependencies = [ "memchr", "serde", @@ -290,27 +283,27 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.13.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[package]] name = "byteorder" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "cc" -version = "1.0.82" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "305fe645edc1442a0fa8b6726ba61d422798d37a52e12eaecf4b022ebbb88f01" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" dependencies = [ "libc", ] @@ -323,37 +316,37 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.26" +version = "0.4.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" +checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" dependencies = [ "android-tzdata", "iana-time-zone", "num-traits", "serde", - "winapi", + "windows-targets 0.48.5", ] [[package]] name = "chrono-tz" -version = "0.6.1" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58549f1842da3080ce63002102d5bc954c7bc843d4f47818e642abdc36253552" +checksum = "f1369bc6b9e9a7dfdae2055f6ec151fe9c554a9d23d357c0237cee2e25eaabb7" dependencies = [ "chrono", "chrono-tz-build", - "phf 0.10.1", + "phf", ] [[package]] name = "chrono-tz-build" -version = "0.0.2" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db058d493fb2f65f41861bfed7e3fe6335264a9f0f92710cab5bdf01fef09069" +checksum = "e2f5ebdc942f57ed96d560a6d1a459bae5851102a25d5bf89dc04ae453e31ecf" dependencies = [ "parse-zoneinfo", - "phf 0.10.1", - "phf_codegen 0.10.0", + "phf", + "phf_codegen", ] [[package]] @@ -368,60 +361,58 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.21" +version = "4.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c27cdf28c0f604ba3f512b0c9a409f8de8513e4816705deb0498b627e7c3a3fd" +checksum = "d04704f56c2cde07f43e8e2c154b43f216dc5c92fc98ada720177362f953b956" dependencies = [ "clap_builder", "clap_derive", - "once_cell", ] [[package]] name = "clap_builder" -version = "4.3.21" +version = "4.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08a9f1ab5e9f01a9b81f202e8562eb9a10de70abf9eaeac1be465c28b75aa4aa" +checksum = "0e231faeaca65ebd1ea3c737966bf858971cd38c3849107aa3ea7de90a804e45" dependencies = [ "anstream", "anstyle", "clap_lex", - "once_cell", "strsim", ] [[package]] name = "clap_complete" -version = "4.3.2" +version = "4.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fc443334c81a804575546c5a8a79b4913b50e28d69232903604cada1de817ce" +checksum = "e3ae8ba90b9d8b007efe66e55e48fb936272f5ca00349b5b0e89877520d35ea7" dependencies = [ "clap", ] [[package]] name = "clap_derive" -version = "4.3.12" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050" +checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] name = "clap_lex" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" +checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" [[package]] name = "clap_mangen" -version = "0.2.12" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f2e32b579dae093c2424a8b7e2bea09c89da01e1ce5065eb2f0a6f1cc15cc1f" +checksum = "b44f35c514163027542f7147797ff930523eea288e03642727348ef1a9666f6b" dependencies = [ "clap", "roff", @@ -493,18 +484,18 @@ dependencies = [ [[package]] name = "const_format" -version = "0.2.31" +version = "0.2.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c990efc7a285731f9a4378d81aff2f0e85a2c8781a05ef0f8baa8dac54d0ff48" +checksum = "e3a214c7af3d04997541b18d432afaff4c455e79e2029079647e72fc2bd27673" dependencies = [ "const_format_proc_macros", ] [[package]] name = "const_format_proc_macros" -version = "0.2.31" +version = "0.2.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e026b6ce194a874cb9cf32cd5772d1ef9767cc8fcb5765948d74f37a9d8b2bf6" +checksum = "c7f6ff08fd20f4f299298a28e2dfa8a8ba1036e6cd2460ac1de7b425d76f2500" dependencies = [ "proc-macro2", "quote", @@ -644,7 +635,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -666,7 +657,7 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core 0.20.3", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -682,9 +673,18 @@ dependencies = [ [[package]] name = "deunicode" -version = "0.4.4" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71dbf1bf89c23e9cd1baf5e654f622872655f195b36588dc9dc38f7eda30758c" +dependencies = [ + "deunicode 1.4.1", +] + +[[package]] +name = "deunicode" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d95203a6a50906215a502507c0f879a0ce7ff205a6111e2db2a5ef8e4bb92e43" +checksum = "6a1abaf4d861455be59f64fd2b55606cb151fce304ede7165f410243ce96bde6" [[package]] name = "digest" @@ -751,9 +751,9 @@ checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" [[package]] name = "dyn-clone" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbfc4744c1b8f2a09adc0e55242f60b1af195d88596bd8700be74418c056c555" +checksum = "23d2f3407d9a573d666de4b5bdf10569d73ca9478087346697dcbae6244bfbcd" [[package]] name = "either" @@ -769,9 +769,9 @@ checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" [[package]] name = "encoding_rs" -version = "0.8.32" +version = "0.8.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" dependencies = [ "cfg-if", ] @@ -784,25 +784,14 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.2" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f" +checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" dependencies = [ - "errno-dragonfly", "libc", "windows-sys 0.48.0", ] -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - [[package]] name = "fancy-regex" version = "0.11.0" @@ -815,9 +804,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.27" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" +checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" dependencies = [ "crc32fast", "miniz_oxide", @@ -894,7 +883,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -950,9 +939,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.27.3" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" +checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" [[package]] name = "globset" @@ -989,9 +978,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.20" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97ec8491ebaf99c8eaa73058b045fe58073cd6be7f596ac993ced0b0a0c01049" +checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" dependencies = [ "bytes", "fnv", @@ -1014,9 +1003,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.14.0" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" +checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" dependencies = [ "ahash", "allocator-api2", @@ -1024,12 +1013,11 @@ dependencies = [ [[package]] name = "headers" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3e372db8e5c0d213e0cd0b9be18be2aca3d44cf2fe30a9d46a65581cd454584" +checksum = "06683b93020a07e3dbcf5f8c0f6d40080d725bea7936fc01ad345c01b97dc270" dependencies = [ - "base64 0.13.1", - "bitflags 1.3.2", + "base64 0.21.4", "bytes", "headers-core", "http", @@ -1062,9 +1050,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" [[package]] name = "home" @@ -1178,16 +1166,16 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.57" +version = "0.1.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" +checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows", + "windows-core", ] [[package]] @@ -1244,12 +1232,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.0.0" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" dependencies = [ "equivalent", - "hashbrown 0.14.0", + "hashbrown 0.14.2", "serde", ] @@ -1322,9 +1310,9 @@ dependencies = [ [[package]] name = "json-patch" -version = "1.0.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f54898088ccb91df1b492cc80029a6fdf1c48ca0db7c6822a8babad69c94658" +checksum = "55ff1e1486799e3f64129f8ccad108b38290df9cd7015cd31bed17239f0789d6" dependencies = [ "serde", "serde_json", @@ -1345,11 +1333,11 @@ dependencies = [ [[package]] name = "k8s-openapi" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95578de7d6eac4fba42114bc751e38c59a739968769df1be56feba6f17fd148e" +checksum = "edc3606fd16aca7989db2f84bb25684d0270c6d6fa1dbcd0025af7b4130523a6" dependencies = [ - "base64 0.21.2", + "base64 0.21.4", "bytes", "chrono", "schemars", @@ -1360,9 +1348,9 @@ dependencies = [ [[package]] name = "kube" -version = "0.85.0" +version = "0.86.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a189cb8721a47de68d883040713bbb9c956763d784fcf066828018d32c180b96" +checksum = "f8647c2211a9b480d910b155d573602c52cd5f646acecb06a03d594865dc4784" dependencies = [ "k8s-openapi", "kube-client", @@ -1373,9 +1361,9 @@ dependencies = [ [[package]] name = "kube-client" -version = "0.85.0" +version = "0.86.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98989b6e1f27695afe22aa29c94136fa06be5e8d28b91222e6dfbe5a460c803f" +checksum = "af8952521f3e8ce11920229e5f2965fef70525aecd9efc7b65e39bf9e2c6f66d" dependencies = [ "base64 0.20.0", "bytes", @@ -1409,9 +1397,9 @@ dependencies = [ [[package]] name = "kube-core" -version = "0.85.0" +version = "0.86.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c24d23bf764ec9a5652f943442ff062b91fd52318ea6d2fc11115f19d8c84d13" +checksum = "7608a0cd05dfa36167d2da982bb70f17feb5450f73ec601f6d428bbcf991c5b9" dependencies = [ "chrono", "form_urlencoded", @@ -1427,9 +1415,9 @@ dependencies = [ [[package]] name = "kube-derive" -version = "0.85.0" +version = "0.86.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bbec4da219dcb02bb32afd762a7ac4dffd47ed92b7e35ac9a7b961d21327117" +checksum = "a8dd623cf49cd632da4727a70e05d9cb948d5ea1098a1af49b1fd3bc9ec60b3c" dependencies = [ "darling 0.14.4", "proc-macro2", @@ -1440,16 +1428,16 @@ dependencies = [ [[package]] name = "kube-runtime" -version = "0.85.0" +version = "0.86.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "381224caa8a6fc16f8251cf1fd6d8678cdf5366f33000a923e4c54192e4b25b5" +checksum = "fde2bd0b2d248be72f30c658b728f87e84c68495bec2c689dff7a3479eb29afd" dependencies = [ "ahash", "async-trait", "backoff", "derivative", "futures", - "hashbrown 0.14.0", + "hashbrown 0.14.2", "json-patch", "k8s-openapi", "kube-client", @@ -1472,27 +1460,27 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.147" +version = "0.2.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" [[package]] name = "libm" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" [[package]] name = "linux-raw-sys" -version = "0.4.5" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" +checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" [[package]] name = "lock_api" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" dependencies = [ "autocfg", "scopeguard", @@ -1515,15 +1503,15 @@ dependencies = [ [[package]] name = "matchit" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed1202b2a6f884ae56f04cff409ab315c5ce26b5e58d7412e484f01fd52f52ef" +checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" [[package]] name = "memchr" -version = "2.5.0" +version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" [[package]] name = "mime" @@ -1590,9 +1578,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" dependencies = [ "autocfg", ] @@ -1609,9 +1597,9 @@ dependencies = [ [[package]] name = "object" -version = "0.31.1" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" +checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" dependencies = [ "memchr", ] @@ -1691,7 +1679,7 @@ dependencies = [ "futures-util", "once_cell", "opentelemetry_api", - "ordered-float 3.7.0", + "ordered-float 3.9.2", "percent-encoding", "rand", "regex", @@ -1708,18 +1696,18 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" [[package]] name = "ordered-float" -version = "2.10.0" +version = "2.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7940cf2ca942593318d07fcf2596cdca60a85c9e7fab408a5e21a4f9dcd40d87" +checksum = "68f19d67e5a2795c94e73e0bb1cc1a7edeb2e28efd39e2e1c9b7a40c1108b11c" dependencies = [ "num-traits", ] [[package]] name = "ordered-float" -version = "3.7.0" +version = "3.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fc2dbde8f8a79f2102cc474ceb0ad68e3b80b85289ea62389b60e66777e4213" +checksum = "f1e1c390732d15f1d48471625cd92d154e66db2c56645e29a9cd26f4699f72dc" dependencies = [ "num-traits", ] @@ -1742,15 +1730,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.8" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.3.5", + "redox_syscall 0.4.1", "smallvec", - "windows-targets 0.48.2", + "windows-targets 0.48.5", ] [[package]] @@ -1770,11 +1758,12 @@ checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" [[package]] name = "pem" -version = "1.1.1" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8835c273a76a90455d7344889b0964598e3316e2a79ede8e36f16bdcf2228b8" +checksum = "3163d2912b7c3b52d651a055f2c7eec9ba5cd22d26ef75b8dd3a59980b185923" dependencies = [ - "base64 0.13.1", + "base64 0.21.4", + "serde", ] [[package]] @@ -1785,19 +1774,20 @@ checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pest" -version = "2.7.2" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1acb4a4365a13f749a93f1a094a7805e5cfa0955373a9de860d962eaa3a5fe5a" +checksum = "c022f1e7b65d6a24c0dbbd5fb344c66881bc01f3e5ae74a1c8100f2f985d98a4" dependencies = [ + "memchr", "thiserror", "ucd-trie", ] [[package]] name = "pest_derive" -version = "2.7.2" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "666d00490d4ac815001da55838c500eafb0320019bbaa44444137c48b443a853" +checksum = "35513f630d46400a977c4cb58f78e1bfbe01434316e60c37d27b9ad6139c66d8" dependencies = [ "pest", "pest_generator", @@ -1805,54 +1795,35 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.2" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68ca01446f50dbda87c1786af8770d535423fa8a53aec03b8f4e3d7eb10e0929" +checksum = "bc9fc1b9e7057baba189b5c626e2d6f40681ae5b6eb064dc7c7834101ec8123a" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] name = "pest_meta" -version = "2.7.2" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56af0a30af74d0445c0bf6d9d051c979b516a1a5af790d251daee76005420a48" +checksum = "1df74e9e7ec4053ceb980e7c0c8bd3594e977fde1af91daba9c928e8e8c6708d" dependencies = [ "once_cell", "pest", "sha2", ] -[[package]] -name = "phf" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259" -dependencies = [ - "phf_shared 0.10.0", -] - [[package]] name = "phf" version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" dependencies = [ - "phf_shared 0.11.2", -] - -[[package]] -name = "phf_codegen" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb1c3a8bc4dd4e5cfce29b44ffc14bedd2ee294559a294e2a4d4c9e9a6a13cd" -dependencies = [ - "phf_generator 0.10.0", - "phf_shared 0.10.0", + "phf_shared", ] [[package]] @@ -1861,18 +1832,8 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a" dependencies = [ - "phf_generator 0.11.2", - "phf_shared 0.11.2", -] - -[[package]] -name = "phf_generator" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" -dependencies = [ - "phf_shared 0.10.0", - "rand", + "phf_generator", + "phf_shared", ] [[package]] @@ -1881,20 +1842,10 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" dependencies = [ - "phf_shared 0.11.2", + "phf_shared", "rand", ] -[[package]] -name = "phf_shared" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" -dependencies = [ - "siphasher", - "uncased", -] - [[package]] name = "phf_shared" version = "0.11.2" @@ -1921,14 +1872,14 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] name = "pin-project-lite" -version = "0.2.12" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12cc1b0bf1727a77a54b6654e7b5f1af8604923edc8b81885f8ec92f9e3f0a05" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" [[package]] name = "pin-utils" @@ -1968,9 +1919,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ "unicode-ident", ] @@ -2041,9 +1992,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.3.5" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ "bitflags 1.3.2", ] @@ -2061,14 +2012,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.9.3" +version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.3.6", - "regex-syntax 0.7.4", + "regex-automata 0.4.3", + "regex-syntax 0.8.2", ] [[package]] @@ -2082,13 +2033,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.6" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.7.4", + "regex-syntax 0.8.2", ] [[package]] @@ -2099,9 +2050,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.7.4" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "reqwest" @@ -2109,7 +2060,7 @@ version = "0.11.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" dependencies = [ - "base64 0.21.2", + "base64 0.21.4", "bytes", "encoding_rs", "futures-core", @@ -2185,7 +2136,7 @@ dependencies = [ "quote", "rust-embed-utils", "shellexpand", - "syn 2.0.29", + "syn 2.0.38", "walkdir", ] @@ -2207,11 +2158,11 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustix" -version = "0.38.8" +version = "0.38.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19ed4fa021d81c8392ce04db050a3da9a60299050b7ae1cf482d862b54a7218f" +checksum = "67ce50cb2e16c2903e30d1cbccfd8387a74b9d4c938b6a4c5ec6cc7556f7a8a0" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "errno", "libc", "linux-raw-sys", @@ -2220,9 +2171,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.6" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d1feddffcfcc0b33f5c6ce9a29e341e4cd59c3f78e7ee45f4a40c038b1d6cbb" +checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" dependencies = [ "log", "ring", @@ -2248,14 +2199,14 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" dependencies = [ - "base64 0.21.2", + "base64 0.21.4", ] [[package]] name = "rustls-webpki" -version = "0.101.4" +version = "0.101.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d93931baf2d282fff8d3a532bbfd7653f734643161b87e3e01e59a04439bf0d" +checksum = "3c7d5dece342910d9ba34d259310cae3e0154b873b35408b787b59bce53d34fe" dependencies = [ "ring", "untrusted", @@ -2293,9 +2244,9 @@ dependencies = [ [[package]] name = "schemars" -version = "0.8.12" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02c613288622e5f0c3fdc5dbd4db1c5fbe752746b1d1a56a0630b78fd00de44f" +checksum = "1f7b0ce13155372a76ee2e1c5ffba1fe61ede73fbea5630d61eee6fac4929c0c" dependencies = [ "dyn-clone", "schemars_derive", @@ -2305,9 +2256,9 @@ dependencies = [ [[package]] name = "schemars_derive" -version = "0.8.12" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "109da1e6b197438deb6db99952990c7f959572794b80ff93707d55a232545e7c" +checksum = "e85e2a16b12bdb763244c69ab79363d71db2b4b918a2def53f80b02e0574b13c" dependencies = [ "proc-macro2", "quote", @@ -2366,18 +2317,18 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.18" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" +checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" dependencies = [ "serde", ] [[package]] name = "serde" -version = "1.0.171" +version = "1.0.189" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30e27d1e4fd7659406c492fd6cfaf2066ba8773de45ca75e855590f856dc34a9" +checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537" dependencies = [ "serde_derive", ] @@ -2388,19 +2339,19 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c" dependencies = [ - "ordered-float 2.10.0", + "ordered-float 2.10.1", "serde", ] [[package]] name = "serde_derive" -version = "1.0.171" +version = "1.0.189" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "389894603bd18c46fa56231694f8d827779c0951a667087194cf9de94ed24682" +checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -2416,11 +2367,11 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.105" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" +checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" dependencies = [ - "indexmap 2.0.0", + "indexmap 2.0.2", "itoa", "ryu", "serde", @@ -2454,7 +2405,7 @@ version = "0.9.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a49e178e4452f45cb61d0cd8cebc1b0fafd3e41929e996cef79aa3aca91f574" dependencies = [ - "indexmap 2.0.0", + "indexmap 2.0.2", "itoa", "ryu", "serde", @@ -2463,9 +2414,9 @@ dependencies = [ [[package]] name = "sha1" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", "cpufeatures", @@ -2474,9 +2425,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.7" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", @@ -2485,9 +2436,9 @@ dependencies = [ [[package]] name = "sharded-slab" -version = "0.1.4" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" dependencies = [ "lazy_static", ] @@ -2533,15 +2484,15 @@ dependencies = [ [[package]] name = "siphasher" -version = "0.3.10" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" [[package]] name = "slab" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ "autocfg", ] @@ -2552,14 +2503,14 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3bc762e6a4b6c6fcaade73e77f9ebc6991b676f88bb2358bddb56560f073373" dependencies = [ - "deunicode", + "deunicode 0.4.5", ] [[package]] name = "smallvec" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" [[package]] name = "snafu" @@ -2595,9 +2546,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877" +checksum = "4031e820eb552adee9295814c0ced9e5cf38ddf1e8b7d566d6de8e2538ea989e" dependencies = [ "libc", "windows-sys 0.48.0", @@ -2626,7 +2577,7 @@ version = "0.0.0-dev" dependencies = [ "bcrypt", "helm-sys", - "indexmap 2.0.0", + "indexmap 2.0.2", "k8s-openapi", "kube", "rand", @@ -2650,8 +2601,8 @@ dependencies = [ name = "stackable-cockpit-web" version = "0.0.0-dev" dependencies = [ - "phf 0.11.2", - "phf_codegen 0.11.2", + "phf", + "phf_codegen", ] [[package]] @@ -2678,8 +2629,8 @@ dependencies = [ [[package]] name = "stackable-operator" -version = "0.47.0" -source = "git+https://github.com/stackabletech/operator-rs.git?tag=0.47.0#b58f31eb70cd295d882367e13cf60a538ff79b51" +version = "0.55.0" +source = "git+https://github.com/stackabletech/operator-rs.git?tag=0.55.0#bfbc23d3819f815413cb4135e0835acd76aecf97" dependencies = [ "chrono", "clap", @@ -2712,13 +2663,13 @@ dependencies = [ [[package]] name = "stackable-operator-derive" -version = "0.47.0" -source = "git+https://github.com/stackabletech/operator-rs.git?tag=0.47.0#b58f31eb70cd295d882367e13cf60a538ff79b51" +version = "0.55.0" +source = "git+https://github.com/stackabletech/operator-rs.git?tag=0.55.0#bfbc23d3819f815413cb4135e0835acd76aecf97" dependencies = [ "darling 0.20.3", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -2731,7 +2682,7 @@ dependencies = [ "comfy-table", "directories", "dotenvy", - "indexmap 2.0.0", + "indexmap 2.0.2", "lazy_static", "rand", "reqwest", @@ -2766,7 +2717,7 @@ version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" dependencies = [ - "strum_macros 0.25.2", + "strum_macros 0.25.3", ] [[package]] @@ -2784,15 +2735,15 @@ dependencies = [ [[package]] name = "strum_macros" -version = "0.25.2" +version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad8d03b598d3d0fff69bf533ee3ef19b8eeb342729596df84bcc7e1f96ec4059" +checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" dependencies = [ "heck", "proc-macro2", "quote", "rustversion", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -2814,9 +2765,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.29" +version = "2.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" dependencies = [ "proc-macro2", "quote", @@ -2852,9 +2803,9 @@ dependencies = [ [[package]] name = "tera" -version = "1.19.0" +version = "1.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5ab29bb4f3e256ae6ad5c3e2775aa1f8829f2c0c101fc407bfd3a6df15c60c5" +checksum = "970dff17c11e884a4a09bc76e3a17ef71e01bb13447a11e85226e254fe6d10b8" dependencies = [ "chrono", "chrono-tz", @@ -2869,36 +2820,36 @@ dependencies = [ "serde", "serde_json", "slug", - "thread_local", "unic-segment", ] [[package]] name = "thiserror" -version = "1.0.47" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97a802ec30afc17eee47b2855fc72e0c4cd62be9b4efe6591edde0ec5bd68d8f" +checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.47" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b" +checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] name = "thread_local" -version = "1.1.4" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" dependencies = [ + "cfg-if", "once_cell", ] @@ -2920,7 +2871,7 @@ dependencies = [ "byteorder", "integer-encoding", "log", - "ordered-float 2.10.0", + "ordered-float 2.10.1", "threadpool", ] @@ -2941,9 +2892,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.32.0" +version = "1.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9" +checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" dependencies = [ "backtrace", "bytes", @@ -2952,7 +2903,7 @@ dependencies = [ "num_cpus", "pin-project-lite", "signal-hook-registry", - "socket2 0.5.3", + "socket2 0.5.4", "tokio-macros", "windows-sys 0.48.0", ] @@ -2975,7 +2926,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -3001,9 +2952,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" +checksum = "1d68074620f57a0b21594d9735eb2e98ab38b17f80d3fcb189fca266771ca60d" dependencies = [ "bytes", "futures-core", @@ -3033,12 +2984,12 @@ dependencies = [ [[package]] name = "tower-http" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55ae70283aba8d2a8b411c695c437fe25b8b5e44e23e780662002fc72fb47a82" +checksum = "61c5bb1d698276a2443e5ecfabc1008bf15a36c12e6a7176e7bf089ea9131140" dependencies = [ - "base64 0.21.2", - "bitflags 2.4.0", + "base64 0.21.4", + "bitflags 2.4.1", "bytes", "futures-core", "futures-util", @@ -3066,11 +3017,10 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.37" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "cfg-if", "log", "pin-project-lite", "tracing-attributes", @@ -3079,20 +3029,20 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] name = "tracing-core" -version = "0.1.31" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", "valuable", @@ -3111,12 +3061,14 @@ dependencies = [ [[package]] name = "tracing-opentelemetry" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc09e402904a5261e42cf27aea09ccb7d5318c6717a9eec3d8e2e65c56b18f19" +checksum = "75327c6b667828ddc28f5e3f169036cb793c3f588d83bf0f262a7f062ffed3c8" dependencies = [ "once_cell", "opentelemetry", + "opentelemetry_sdk", + "smallvec", "tracing", "tracing-core", "tracing-log", @@ -3158,9 +3110,9 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "typenum" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "ucd-trie" @@ -3168,15 +3120,6 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" -[[package]] -name = "uncased" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b9bc53168a4be7402ab86c3aad243a84dd7381d09be0eddc81280c1da95ca68" -dependencies = [ - "version_check", -] - [[package]] name = "unic-char-property" version = "0.9.0" @@ -3229,9 +3172,9 @@ dependencies = [ [[package]] name = "unicase" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" +checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" dependencies = [ "version_check", ] @@ -3244,9 +3187,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" @@ -3259,9 +3202,9 @@ dependencies = [ [[package]] name = "unicode-width" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" [[package]] name = "unicode-xid" @@ -3283,9 +3226,9 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "url" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" dependencies = [ "form_urlencoded", "idna", @@ -3306,11 +3249,11 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "utoipa" -version = "3.4.4" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de634b7f8178c9c246c88ea251f3a0215c9a4d80778db2d7bd4423a78b5170ec" +checksum = "d82b1bc5417102a73e8464c686eef947bdfb99fcdfc0a4f228e81afa9526470a" dependencies = [ - "indexmap 2.0.0", + "indexmap 2.0.2", "serde", "serde_json", "utoipa-gen", @@ -3318,14 +3261,14 @@ dependencies = [ [[package]] name = "utoipa-gen" -version = "3.4.5" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcba79cb3e5020d9bcc8313cd5aadaf51d6d54a6b3fd08c3d0360ae6b3c83d0" +checksum = "05d96dcd6fc96f3df9b3280ef480770af1b7c5d14bc55192baa9b067976d920c" dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -3346,9 +3289,9 @@ dependencies = [ [[package]] name = "uuid" -version = "1.4.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d" +checksum = "88ad59a7560b41a70d191093a945f0b87bc1deeda46fb237479708a1d6b6cdfc" dependencies = [ "getrandom", ] @@ -3367,9 +3310,9 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "walkdir" -version = "2.3.3" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" +checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" dependencies = [ "same-file", "winapi-util", @@ -3411,7 +3354,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", "wasm-bindgen-shared", ] @@ -3445,7 +3388,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3474,13 +3417,14 @@ checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" [[package]] name = "which" -version = "4.4.0" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" dependencies = [ "either", - "libc", + "home", "once_cell", + "rustix", ] [[package]] @@ -3501,9 +3445,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" dependencies = [ "winapi", ] @@ -3515,12 +3459,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] -name = "windows" -version = "0.48.0" +name = "windows-core" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" dependencies = [ - "windows-targets 0.48.2", + "windows-targets 0.48.5", ] [[package]] @@ -3538,7 +3482,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.2", + "windows-targets 0.48.5", ] [[package]] @@ -3558,17 +3502,17 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.2" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1eeca1c172a285ee6c2c84c341ccea837e7c01b12fbb2d0fe3c9e550ce49ec8" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows_aarch64_gnullvm 0.48.2", - "windows_aarch64_msvc 0.48.2", - "windows_i686_gnu 0.48.2", - "windows_i686_msvc 0.48.2", - "windows_x86_64_gnu 0.48.2", - "windows_x86_64_gnullvm 0.48.2", - "windows_x86_64_msvc 0.48.2", + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] @@ -3579,9 +3523,9 @@ checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.2" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b10d0c968ba7f6166195e13d593af609ec2e3d24f916f081690695cf5eaffb2f" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_msvc" @@ -3591,9 +3535,9 @@ checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" [[package]] name = "windows_aarch64_msvc" -version = "0.48.2" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "571d8d4e62f26d4932099a9efe89660e8bd5087775a2ab5cdd8b747b811f1058" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_i686_gnu" @@ -3603,9 +3547,9 @@ checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" [[package]] name = "windows_i686_gnu" -version = "0.48.2" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2229ad223e178db5fbbc8bd8d3835e51e566b8474bfca58d2e6150c48bb723cd" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_msvc" @@ -3615,9 +3559,9 @@ checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" [[package]] name = "windows_i686_msvc" -version = "0.48.2" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "600956e2d840c194eedfc5d18f8242bc2e17c7775b6684488af3a9fff6fe3287" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_x86_64_gnu" @@ -3627,9 +3571,9 @@ checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" [[package]] name = "windows_x86_64_gnu" -version = "0.48.2" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea99ff3f8b49fb7a8e0d305e5aec485bd068c2ba691b6e277d29eaeac945868a" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnullvm" @@ -3639,9 +3583,9 @@ checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.2" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f1a05a1ece9a7a0d5a7ccf30ba2c33e3a61a30e042ffd247567d1de1d94120d" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_msvc" @@ -3651,9 +3595,9 @@ checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" [[package]] name = "windows_x86_64_msvc" -version = "0.48.2" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d419259aba16b663966e29e6d7c6ecfa0bb8425818bb96f6f1f3c3eb71a6e7b9" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winreg" @@ -3667,9 +3611,9 @@ dependencies = [ [[package]] name = "xml-rs" -version = "0.8.16" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47430998a7b5d499ccee752b41567bc3afc57e1327dc855b1a2aa44ce29b5fa1" +checksum = "0fcb9cbac069e033553e8bb871be2fbdffcab578eb25bd0f7c508cedc6dcd75a" [[package]] name = "xtask" diff --git a/Cargo.toml b/Cargo.toml index 11dc3f53..5becd768 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,8 +27,8 @@ dotenvy = "0.15" futures = "0.3" gobuild = "0.1.0-alpha.2" indexmap = { version = "2.0", features = ["serde"] } -k8s-openapi = { version = "0.19", default-features = false, features = ["v1_27"] } -kube = { version = "0.85", default-features = false, features = ["client", "rustls-tls"] } +k8s-openapi = { version = "0.20", default-features = false, features = ["v1_28"] } +kube = { version = "0.86", default-features = false, features = ["client", "rustls-tls"] } lazy_static = "1.4" once_cell = "1.18" phf = "0.11" @@ -43,7 +43,7 @@ serde_yaml = "0.9" sha2 = "0.10" snafu = "0.7" spinoff = "0.8.0" -stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "0.47.0" } +stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "0.55.0" } tera = "1.18" tokio = { version = "1.29.0", features = ["rt-multi-thread", "macros", "fs", "process"] } tower-http = "0.4" diff --git a/extra/completions/stackablectl.bash b/extra/completions/stackablectl.bash index c3b2252a..1edcd48d 100644 --- a/extra/completions/stackablectl.bash +++ b/extra/completions/stackablectl.bash @@ -3291,4 +3291,4 @@ _stackablectl() { esac } -complete -F _stackablectl -o bashdefault -o default stackablectl +complete -F _stackablectl -o nosort -o bashdefault -o default stackablectl diff --git a/extra/completions/stackablectl.fish b/extra/completions/stackablectl.fish index 3457d739..8421799c 100644 --- a/extra/completions/stackablectl.fish +++ b/extra/completions/stackablectl.fish @@ -34,7 +34,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from operator; and not __fis complete -c stackablectl -n "__fish_seen_subcommand_from operator; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from installed; and not __fish_seen_subcommand_from help" -f -a "uninstall" -d 'Uninstall one or more operators' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from installed; and not __fish_seen_subcommand_from help" -f -a "installed" -d 'List installed operators' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from installed; and not __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' -complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from list" -s o -l output -r -f -a "{plain Print output formatted as plain text,json Print output formatted as JSON,yaml Print output formatted as YAML}" +complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from list" -s o -l output -r -f -a "{plain 'Print output formatted as plain text',json 'Print output formatted as JSON',yaml 'Print output formatted as YAML'}" complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from list" -s l -l log-level -d 'Log level this application uses' -r complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from list" -s d -l demo-file -d 'Provide one or more additional (custom) demo file(s)' -r -F complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from list" -s s -l stack-file -d 'Provide one or more additional (custom) stack file(s)' -r -F @@ -46,7 +46,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_se complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from list" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from list" -s h -l help -d 'Print help (see more with \'--help\')' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from list" -s V -l version -d 'Print version' -complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from describe" -s o -l output -r -f -a "{plain Print output formatted as plain text,json Print output formatted as JSON,yaml Print output formatted as YAML}" +complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from describe" -s o -l output -r -f -a "{plain 'Print output formatted as plain text',json 'Print output formatted as JSON',yaml 'Print output formatted as YAML'}" complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from describe" -s l -l log-level -d 'Log level this application uses' -r complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from describe" -s d -l demo-file -d 'Provide one or more additional (custom) demo file(s)' -r -F complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from describe" -s s -l stack-file -d 'Provide one or more additional (custom) stack file(s)' -r -F @@ -59,7 +59,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_se complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from describe" -s h -l help -d 'Print help (see more with \'--help\')' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from describe" -s V -l version -d 'Print version' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from install" -l operator-namespace -l operator-ns -d 'Namespace in the cluster used to deploy the operators' -r -complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from install" -s c -l cluster -d 'Type of local cluster to use for testing' -r -f -a "{kind Use a kind cluster\, see ,minikube Use a minikube cluster}" +complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from install" -s c -l cluster -d 'Type of local cluster to use for testing' -r -f -a "{kind 'Use a kind cluster, see ',minikube 'Use a minikube cluster'}" complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from install" -l cluster-name -d 'Name of the local cluster' -r complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from install" -l cluster-nodes -d 'Number of total nodes in the local cluster' -r complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from install" -l cluster-cp-nodes -d 'Number of control plane nodes in the local cluster' -r @@ -86,7 +86,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_se complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from uninstall" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from uninstall" -s h -l help -d 'Print help (see more with \'--help\')' complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from uninstall" -s V -l version -d 'Print version' -complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from installed" -s o -l output -r -f -a "{plain Print output formatted as plain text,json Print output formatted as JSON,yaml Print output formatted as YAML}" +complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from installed" -s o -l output -r -f -a "{plain 'Print output formatted as plain text',json 'Print output formatted as JSON',yaml 'Print output formatted as YAML'}" complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from installed" -l operator-namespace -l operator-ns -d 'Namespace in the cluster used to deploy the operators' -r complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from installed" -s l -l log-level -d 'Log level this application uses' -r complete -c stackablectl -n "__fish_seen_subcommand_from operator; and __fish_seen_subcommand_from installed" -s d -l demo-file -d 'Provide one or more additional (custom) demo file(s)' -r -F @@ -121,7 +121,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from release; and not __fish complete -c stackablectl -n "__fish_seen_subcommand_from release; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from help" -f -a "install" -d 'Install a specific release' complete -c stackablectl -n "__fish_seen_subcommand_from release; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from help" -f -a "uninstall" -d 'Uninstall a release' complete -c stackablectl -n "__fish_seen_subcommand_from release; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' -complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from list" -s o -l output -r -f -a "{plain Print output formatted as plain text,json Print output formatted as JSON,yaml Print output formatted as YAML}" +complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from list" -s o -l output -r -f -a "{plain 'Print output formatted as plain text',json 'Print output formatted as JSON',yaml 'Print output formatted as YAML'}" complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from list" -s l -l log-level -d 'Log level this application uses' -r complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from list" -s d -l demo-file -d 'Provide one or more additional (custom) demo file(s)' -r -F complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from list" -s s -l stack-file -d 'Provide one or more additional (custom) stack file(s)' -r -F @@ -133,7 +133,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_see complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from list" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from list" -s h -l help -d 'Print help (see more with \'--help\')' complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from list" -s V -l version -d 'Print version' -complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from describe" -s o -l output -r -f -a "{plain Print output formatted as plain text,json Print output formatted as JSON,yaml Print output formatted as YAML}" +complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from describe" -s o -l output -r -f -a "{plain 'Print output formatted as plain text',json 'Print output formatted as JSON',yaml 'Print output formatted as YAML'}" complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from describe" -s l -l log-level -d 'Log level this application uses' -r complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from describe" -s d -l demo-file -d 'Provide one or more additional (custom) demo file(s)' -r -F complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from describe" -s s -l stack-file -d 'Provide one or more additional (custom) stack file(s)' -r -F @@ -148,7 +148,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_see complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from install" -s i -l include -d 'Whitelist of product operators to install' -r complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from install" -s e -l exclude -d 'Blacklist of product operators to install' -r complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from install" -l operator-namespace -l operator-ns -d 'Namespace in the cluster used to deploy the operators' -r -complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from install" -s c -l cluster -d 'Type of local cluster to use for testing' -r -f -a "{kind Use a kind cluster\, see ,minikube Use a minikube cluster}" +complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from install" -s c -l cluster -d 'Type of local cluster to use for testing' -r -f -a "{kind 'Use a kind cluster, see ',minikube 'Use a minikube cluster'}" complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from install" -l cluster-name -d 'Name of the local cluster' -r complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from install" -l cluster-nodes -d 'Number of total nodes in the local cluster' -r complete -c stackablectl -n "__fish_seen_subcommand_from release; and __fish_seen_subcommand_from install" -l cluster-cp-nodes -d 'Number of control plane nodes in the local cluster' -r @@ -195,7 +195,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from stack; and not __fish_s complete -c stackablectl -n "__fish_seen_subcommand_from stack; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from help" -f -a "describe" -d 'Describe a specific stack' complete -c stackablectl -n "__fish_seen_subcommand_from stack; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from help" -f -a "install" -d 'Install a specific stack' complete -c stackablectl -n "__fish_seen_subcommand_from stack; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' -complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from list" -s o -l output -r -f -a "{plain Print output formatted as plain text,json Print output formatted as JSON,yaml Print output formatted as YAML}" +complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from list" -s o -l output -r -f -a "{plain 'Print output formatted as plain text',json 'Print output formatted as JSON',yaml 'Print output formatted as YAML'}" complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from list" -s l -l log-level -d 'Log level this application uses' -r complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from list" -s d -l demo-file -d 'Provide one or more additional (custom) demo file(s)' -r -F complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from list" -s s -l stack-file -d 'Provide one or more additional (custom) stack file(s)' -r -F @@ -207,7 +207,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_ complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from list" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from list" -s h -l help -d 'Print help (see more with \'--help\')' complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from list" -s V -l version -d 'Print version' -complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from describe" -s o -l output -r -f -a "{plain Print output formatted as plain text,json Print output formatted as JSON,yaml Print output formatted as YAML}" +complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from describe" -s o -l output -r -f -a "{plain 'Print output formatted as plain text',json 'Print output formatted as JSON',yaml 'Print output formatted as YAML'}" complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from describe" -s l -l log-level -d 'Log level this application uses' -r complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from describe" -s d -l demo-file -d 'Provide one or more additional (custom) demo file(s)' -r -F complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from describe" -s s -l stack-file -d 'Provide one or more additional (custom) stack file(s)' -r -F @@ -221,7 +221,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_ complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from describe" -s V -l version -d 'Print version' complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from install" -l stack-parameters -d 'List of parameters to use when installing the stack' -r complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from install" -l parameters -d 'List of parameters to use when installing the stack' -r -complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from install" -s c -l cluster -d 'Type of local cluster to use for testing' -r -f -a "{kind Use a kind cluster\, see ,minikube Use a minikube cluster}" +complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from install" -s c -l cluster -d 'Type of local cluster to use for testing' -r -f -a "{kind 'Use a kind cluster, see ',minikube 'Use a minikube cluster'}" complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from install" -l cluster-name -d 'Name of the local cluster' -r complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from install" -l cluster-nodes -d 'Number of total nodes in the local cluster' -r complete -c stackablectl -n "__fish_seen_subcommand_from stack; and __fish_seen_subcommand_from install" -l cluster-cp-nodes -d 'Number of control plane nodes in the local cluster' -r @@ -269,7 +269,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_se complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_seen_subcommand_from credentials" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_seen_subcommand_from credentials" -s h -l help -d 'Print help (see more with \'--help\')' complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_seen_subcommand_from credentials" -s V -l version -d 'Print version' -complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_seen_subcommand_from list" -s o -l output -r -f -a "{plain Print output formatted as plain text,json Print output formatted as JSON,yaml Print output formatted as YAML}" +complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_seen_subcommand_from list" -s o -l output -r -f -a "{plain 'Print output formatted as plain text',json 'Print output formatted as JSON',yaml 'Print output formatted as YAML'}" complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_seen_subcommand_from list" -l operator-namespace -l operator-ns -d 'Namespace where the operators are deployed' -r complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_seen_subcommand_from list" -s n -l product-namespace -l product-ns -d 'Namespace where the products (e.g. stacks or demos) are deployed' -r complete -c stackablectl -n "__fish_seen_subcommand_from stacklet; and __fish_seen_subcommand_from list" -s l -l log-level -d 'Log level this application uses' -r @@ -301,7 +301,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from demo; and not __fish_se complete -c stackablectl -n "__fish_seen_subcommand_from demo; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from help" -f -a "describe" -d 'Print out detailed demo information' complete -c stackablectl -n "__fish_seen_subcommand_from demo; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from help" -f -a "install" -d 'Install a specific demo' complete -c stackablectl -n "__fish_seen_subcommand_from demo; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from describe; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' -complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from list" -s o -l output -r -f -a "{plain Print output formatted as plain text,json Print output formatted as JSON,yaml Print output formatted as YAML}" +complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from list" -s o -l output -r -f -a "{plain 'Print output formatted as plain text',json 'Print output formatted as JSON',yaml 'Print output formatted as YAML'}" complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from list" -s l -l log-level -d 'Log level this application uses' -r complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from list" -s d -l demo-file -d 'Provide one or more additional (custom) demo file(s)' -r -F complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from list" -s s -l stack-file -d 'Provide one or more additional (custom) stack file(s)' -r -F @@ -313,7 +313,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_s complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from list" -l offline -d 'Do not request any remote files via the network' complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from list" -s h -l help -d 'Print help (see more with \'--help\')' complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from list" -s V -l version -d 'Print version' -complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from describe" -s o -l output -r -f -a "{plain Print output formatted as plain text,json Print output formatted as JSON,yaml Print output formatted as YAML}" +complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from describe" -s o -l output -r -f -a "{plain 'Print output formatted as plain text',json 'Print output formatted as JSON',yaml 'Print output formatted as YAML'}" complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from describe" -s l -l log-level -d 'Log level this application uses' -r complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from describe" -s d -l demo-file -d 'Provide one or more additional (custom) demo file(s)' -r -F complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from describe" -s s -l stack-file -d 'Provide one or more additional (custom) stack file(s)' -r -F @@ -327,7 +327,7 @@ complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_s complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from describe" -s V -l version -d 'Print version' complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from install" -l stack-parameters -d 'List of parameters to use when installing the stack' -r complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from install" -l parameters -d 'List of parameters to use when installing the demo' -r -complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from install" -s c -l cluster -d 'Type of local cluster to use for testing' -r -f -a "{kind Use a kind cluster\, see ,minikube Use a minikube cluster}" +complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from install" -s c -l cluster -d 'Type of local cluster to use for testing' -r -f -a "{kind 'Use a kind cluster, see ',minikube 'Use a minikube cluster'}" complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from install" -l cluster-name -d 'Name of the local cluster' -r complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from install" -l cluster-nodes -d 'Number of total nodes in the local cluster' -r complete -c stackablectl -n "__fish_seen_subcommand_from demo; and __fish_seen_subcommand_from install" -l cluster-cp-nodes -d 'Number of control plane nodes in the local cluster' -r From 082bfaa86fae42b42baf7963cf685573cdd70add Mon Sep 17 00:00:00 2001 From: Techassi Date: Fri, 20 Oct 2023 13:29:37 +0200 Subject: [PATCH 19/40] Add basic progress output --- rust/stackable-cockpit/src/engine/kind/mod.rs | 2 ++ rust/stackable-cockpit/src/platform/stack/spec.rs | 2 +- rust/stackablectl/src/cmds/demo.rs | 15 +++++++++++---- rust/stackablectl/src/cmds/release.rs | 13 +++++++++---- rust/stackablectl/src/cmds/stack.rs | 15 +++++++++++---- rust/stackablectl/src/output/mod.rs | 10 ++++++++-- 6 files changed, 42 insertions(+), 15 deletions(-) diff --git a/rust/stackable-cockpit/src/engine/kind/mod.rs b/rust/stackable-cockpit/src/engine/kind/mod.rs index 2101e3da..8818d521 100644 --- a/rust/stackable-cockpit/src/engine/kind/mod.rs +++ b/rust/stackable-cockpit/src/engine/kind/mod.rs @@ -75,6 +75,8 @@ impl KindCluster { .args(["create", "cluster"]) .args(["--name", self.name.as_str()]) .args(["--config", "-"]) + .stdout(Stdio::null()) + .stderr(Stdio::null()) .stdin(Stdio::piped()) .spawn() .context(IoSnafu)?; diff --git a/rust/stackable-cockpit/src/platform/stack/spec.rs b/rust/stackable-cockpit/src/platform/stack/spec.rs index a159d46d..9af1b6ab 100644 --- a/rust/stackable-cockpit/src/platform/stack/spec.rs +++ b/rust/stackable-cockpit/src/platform/stack/spec.rs @@ -295,7 +295,7 @@ impl StackSpecV2 { }, Some(&values_yaml), product_namespace, - false, + true, ) .context(HelmInstallReleaseSnafu { release_name: helm_chart.release_name, diff --git a/rust/stackablectl/src/cmds/demo.rs b/rust/stackablectl/src/cmds/demo.rs index ed4ddb09..c825a7f8 100644 --- a/rust/stackablectl/src/cmds/demo.rs +++ b/rust/stackablectl/src/cmds/demo.rs @@ -272,6 +272,10 @@ async fn install_cmd( ) -> Result { info!("Installing demo {}", args.demo_name); + // Init result output and progress output + let mut output = cli.result(); + output.enable_progress(format!("Installing demo '{}'", args.demo_name)); + let demo_spec = list.get(&args.demo_name).ok_or(CmdError::NoSuchDemo { name: args.demo_name.clone(), })?; @@ -289,6 +293,7 @@ async fn install_cmd( .context(ListSnafu)?; // Install local cluster if needed + output.set_progress_message("Creating local cluster"); args.local_cluster .install_if_needed(None) .await @@ -307,6 +312,7 @@ async fn install_cmd( .unwrap_or(DEFAULT_PRODUCT_NAMESPACE.into()); if !args.skip_release { + output.set_progress_message("Creating operator namespace"); namespace::create_if_needed(operator_namespace.clone()) .await .context(NamespaceSnafu { @@ -314,12 +320,14 @@ async fn install_cmd( })?; } + output.set_progress_message("Creating product namespace"); namespace::create_if_needed(product_namespace.clone()) .await .context(NamespaceSnafu { namespace: product_namespace.clone(), })?; + output.set_progress_message("Installing demo manifests"); demo_spec .install( stack_list, @@ -334,8 +342,6 @@ async fn install_cmd( .await .context(DemoSnafu)?; - let mut result = cli.result(); - let operator_cmd = format!( "stackablectl operator installed{}", if args.namespaces.operator_namespace.is_some() { @@ -354,11 +360,12 @@ async fn install_cmd( } ); - result + output .with_command_hint(operator_cmd, "display the installed operators") .with_command_hint(stacklet_cmd, "display the installed stacklets") .with_output(format!("Installed demo '{}'", args.demo_name)); + output.finish_progress("Done"); // TODO (Techassi): Remove unwrap - Ok(result.render().unwrap()) + Ok(output.render().unwrap()) } diff --git a/rust/stackablectl/src/cmds/release.rs b/rust/stackablectl/src/cmds/release.rs index d79fdab1..7d0a626e 100644 --- a/rust/stackablectl/src/cmds/release.rs +++ b/rust/stackablectl/src/cmds/release.rs @@ -271,19 +271,25 @@ async fn install_cmd( match release_list.get(&args.release) { Some(release) => { + let mut output = cli.result(); + output.enable_progress(format!("Installing release '{}'", args.release)); + // Install local cluster if needed + output.set_progress_message("Installing local cluster"); args.local_cluster .install_if_needed(None) .await .context(CommonClusterArgsSnafu)?; // Create operator namespace if needed + output.set_progress_message("Creating operator namespace"); namespace::create_if_needed(args.operator_namespace.clone()) .await .context(NamespaceSnafu { namespace: args.operator_namespace.clone(), })?; + output.set_progress_message("Installing release manifests"); release .install( &args.included_products, @@ -292,17 +298,16 @@ async fn install_cmd( ) .context(ReleaseInstallSnafu)?; - let mut result = cli.result(); - - result + output .with_command_hint( "stackablectl operator installed", "list installed operators", ) .with_output(format!("Installed release '{}'", args.release)); + output.finish_progress("Done"); // TODO (Techassi): Remove unwrap - Ok(result.render().unwrap()) + Ok(output.render().unwrap()) } None => Ok("No such release".into()), } diff --git a/rust/stackablectl/src/cmds/stack.rs b/rust/stackablectl/src/cmds/stack.rs index 1cc9f8d7..4c639fd7 100644 --- a/rust/stackablectl/src/cmds/stack.rs +++ b/rust/stackablectl/src/cmds/stack.rs @@ -283,7 +283,11 @@ async fn install_cmd( match stack_list.get(&args.stack_name) { Some(stack_spec) => { + let mut output = cli.result(); + output.enable_progress(format!("Installing stack '{}'", args.stack_name)); + // Install local cluster if needed + output.set_progress_message("Creating local cluster"); args.local_cluster .install_if_needed(None) .await @@ -297,12 +301,14 @@ async fn install_cmd( // Install release if not opted out if !args.skip_release { + output.set_progress_message("Creating operator namespace"); namespace::create_if_needed(operator_namespace.clone()) .await .context(NamespaceSnafu { namespace: operator_namespace.clone(), })?; + output.set_progress_message("Installing release manifests"); stack_spec .install_release(release_list, &operator_namespace, &product_namespace) .await @@ -312,6 +318,7 @@ async fn install_cmd( } // Create product namespace if needed + output.set_progress_message("Creating product namespace"); namespace::create_if_needed(product_namespace.clone()) .await .context(NamespaceSnafu { @@ -319,6 +326,7 @@ async fn install_cmd( })?; // Install stack + output.set_progress_message("Installing stack manifests"); stack_spec .install_stack_manifests( &args.stack_parameters, @@ -328,8 +336,6 @@ async fn install_cmd( .await .context(StackSnafu)?; - let mut result = cli.result(); - let operator_cmd = format!( "stackablectl operator installed{}", if args.namespaces.operator_namespace.is_some() { @@ -348,13 +354,14 @@ async fn install_cmd( } ); - result + output .with_command_hint(operator_cmd, "display the installed operators") .with_command_hint(stacklet_cmd, "display the installed stacklets") .with_output(format!("Installed stack '{}'", args.stack_name)); + output.finish_progress("Done"); // TODO (Techassi): Remove unwrap - Ok(result.render().unwrap()) + Ok(output.render().unwrap()) } None => Ok("No such stack".into()), } diff --git a/rust/stackablectl/src/output/mod.rs b/rust/stackablectl/src/output/mod.rs index a5b77f76..686734f2 100644 --- a/rust/stackablectl/src/output/mod.rs +++ b/rust/stackablectl/src/output/mod.rs @@ -119,9 +119,15 @@ where .get_or_insert(Spinner::new(spinners::Dots, initial_message, Color::Green)); } - pub fn set_progress_message(&mut self, message: String) { + pub fn set_progress_message(&mut self, message: impl Into) { if let Some(progress) = self.progress.as_mut() { - progress.update_text(message) + progress.update_text(message.into()) + } + } + + pub fn finish_progress(&mut self, message: impl AsRef) { + if let Some(progress) = self.progress.as_mut() { + progress.success(message.as_ref()) } } From 3b04c802d7fa5c4ad364c529d8bf6800063321b8 Mon Sep 17 00:00:00 2001 From: Techassi Date: Fri, 20 Oct 2023 15:05:07 +0200 Subject: [PATCH 20/40] Remove unwraps --- rust/stackablectl/src/cli/mod.rs | 6 ++---- rust/stackablectl/src/cmds/cache.rs | 2 +- rust/stackablectl/src/cmds/demo.rs | 9 +++------ rust/stackablectl/src/cmds/operator.rs | 15 +++++---------- rust/stackablectl/src/cmds/release.rs | 12 ++++-------- rust/stackablectl/src/cmds/stack.rs | 9 +++------ rust/stackablectl/src/cmds/stacklet.rs | 6 ++---- rust/stackablectl/src/main.rs | 2 +- rust/stackablectl/src/output/mod.rs | 8 +++++--- 9 files changed, 26 insertions(+), 43 deletions(-) diff --git a/rust/stackablectl/src/cli/mod.rs b/rust/stackablectl/src/cli/mod.rs index bb4da609..c7311de4 100644 --- a/rust/stackablectl/src/cli/mod.rs +++ b/rust/stackablectl/src/cli/mod.rs @@ -196,13 +196,11 @@ impl Cli { // Output utility functions pub fn result(&self) -> Output { - // TODO (Techassi): Remove unwrap - Output::new(ResultContext::default(), false).unwrap() + Output::new(ResultContext::default(), false).expect("Failed to create output renderer") } pub fn error(&self) -> Output { - // TODO (Techassi): Remove unwrap - Output::new(ErrorContext::default(), false).unwrap() + Output::new(ErrorContext::default(), false).expect("Failed to create output renderer") } } diff --git a/rust/stackablectl/src/cmds/cache.rs b/rust/stackablectl/src/cmds/cache.rs index ce12c18f..b345555f 100644 --- a/rust/stackablectl/src/cmds/cache.rs +++ b/rust/stackablectl/src/cmds/cache.rs @@ -80,7 +80,7 @@ async fn list_cmd(cache: Cache, cli: &Cli) -> Result { .with_command_hint("stackablectl cache clean", "to clean all cached files") .with_output(table.to_string()); - Ok(result.render().unwrap()) + Ok(result.render()) } #[instrument(skip_all)] diff --git a/rust/stackablectl/src/cmds/demo.rs b/rust/stackablectl/src/cmds/demo.rs index c825a7f8..dc529c5a 100644 --- a/rust/stackablectl/src/cmds/demo.rs +++ b/rust/stackablectl/src/cmds/demo.rs @@ -206,8 +206,7 @@ async fn list_cmd(args: &DemoListArgs, cli: &Cli, list: DemoList) -> Result serde_json::to_string(&list.inner()).context(JsonOutputFormatSnafu), OutputType::Yaml => serde_yaml::to_string(&list.inner()).context(YamlOutputFormatSnafu), @@ -254,8 +253,7 @@ async fn describe_cmd( .with_command_hint("stackablectl demo list", "list all available demos") .with_output(table.to_string()); - // TODO (Techassi): Remove unwrap - Ok(result.render().unwrap()) + Ok(result.render()) } OutputType::Json => serde_json::to_string(&demo).context(JsonOutputFormatSnafu), OutputType::Yaml => serde_yaml::to_string(&demo).context(YamlOutputFormatSnafu), @@ -366,6 +364,5 @@ async fn install_cmd( .with_output(format!("Installed demo '{}'", args.demo_name)); output.finish_progress("Done"); - // TODO (Techassi): Remove unwrap - Ok(output.render().unwrap()) + Ok(output.render()) } diff --git a/rust/stackablectl/src/cmds/operator.rs b/rust/stackablectl/src/cmds/operator.rs index 47cdbc68..d93b4c17 100644 --- a/rust/stackablectl/src/cmds/operator.rs +++ b/rust/stackablectl/src/cmds/operator.rs @@ -214,8 +214,7 @@ async fn list_cmd(args: &OperatorListArgs, cli: &Cli) -> Result { Ok(serde_json::to_string(&versions_list).context(JsonOutputFormatSnafu)?) @@ -272,8 +271,7 @@ async fn describe_cmd(args: &OperatorDescribeArgs, cli: &Cli) -> Result serde_json::to_string(&versions_list).context(JsonOutputFormatSnafu), OutputType::Yaml => serde_yaml::to_string(&versions_list).context(YamlOutputFormatSnafu), @@ -321,8 +319,7 @@ async fn install_cmd(args: &OperatorInstallArgs, cli: &Cli) -> Result Result Result Ok(serde_json::to_string(&installed).context(JsonOutputFormatSnafu)?), OutputType::Yaml => Ok(serde_yaml::to_string(&installed).context(YamlOutputFormatSnafu)?), diff --git a/rust/stackablectl/src/cmds/release.rs b/rust/stackablectl/src/cmds/release.rs index 7d0a626e..4d99de94 100644 --- a/rust/stackablectl/src/cmds/release.rs +++ b/rust/stackablectl/src/cmds/release.rs @@ -196,8 +196,7 @@ async fn list_cmd( ) .with_output(table.to_string()); - // TODO (Techassi): Remove unwrap - Ok(result.render().unwrap()) + Ok(result.render()) } OutputType::Json => serde_json::to_string(&release_list).context(JsonOutputFormatSnafu), OutputType::Yaml => serde_yaml::to_string(&release_list).context(YamlOutputFormatSnafu), @@ -251,8 +250,7 @@ async fn describe_cmd( .with_command_hint("stackablectl release list", "list all available releases") .with_output(table.to_string()); - // TODO (Techassi): Remove unwrap - Ok(result.render().unwrap()) + Ok(result.render()) } OutputType::Json => serde_json::to_string(&release).context(JsonOutputFormatSnafu), OutputType::Yaml => serde_yaml::to_string(&release).context(YamlOutputFormatSnafu), @@ -306,8 +304,7 @@ async fn install_cmd( .with_output(format!("Installed release '{}'", args.release)); output.finish_progress("Done"); - // TODO (Techassi): Remove unwrap - Ok(output.render().unwrap()) + Ok(output.render()) } None => Ok("No such release".into()), } @@ -332,8 +329,7 @@ async fn uninstall_cmd( .with_command_hint("stackablectl release list", "list available releases") .with_output(format!("Uninstalled release '{}'", args.release)); - // TODO (Techassi): Remove unwrap - Ok(result.render().unwrap()) + Ok(result.render()) } None => Ok("No such release".into()), } diff --git a/rust/stackablectl/src/cmds/stack.rs b/rust/stackablectl/src/cmds/stack.rs index 4c639fd7..2018ddf9 100644 --- a/rust/stackablectl/src/cmds/stack.rs +++ b/rust/stackablectl/src/cmds/stack.rs @@ -188,8 +188,7 @@ fn list_cmd(args: &StackListArgs, cli: &Cli, stack_list: StackList) -> Result serde_json::to_string(&stack_list).context(JsonOutputFormatSnafu {}), OutputType::Yaml => serde_yaml::to_string(&stack_list).context(YamlOutputFormatSnafu {}), @@ -244,8 +243,7 @@ fn describe_cmd( .with_command_hint("stackablectl stack list", "list all available stacks") .with_output(table.to_string()); - // TODO (Techassi): Remove unwrap - Ok(result.render().unwrap()) + Ok(result.render()) } OutputType::Json => serde_json::to_string(&stack).context(JsonOutputFormatSnafu {}), OutputType::Yaml => serde_yaml::to_string(&stack).context(YamlOutputFormatSnafu {}), @@ -360,8 +358,7 @@ async fn install_cmd( .with_output(format!("Installed stack '{}'", args.stack_name)); output.finish_progress("Done"); - // TODO (Techassi): Remove unwrap - Ok(output.render().unwrap()) + Ok(output.render()) } None => Ok("No such stack".into()), } diff --git a/rust/stackablectl/src/cmds/stacklet.rs b/rust/stackablectl/src/cmds/stacklet.rs index 314b260e..9fd51429 100644 --- a/rust/stackablectl/src/cmds/stacklet.rs +++ b/rust/stackablectl/src/cmds/stacklet.rs @@ -112,8 +112,7 @@ async fn list_cmd(args: &StackletListArgs, cli: &Cli) -> Result Result serde_json::to_string(&stacklets).context(JsonOutputFormatSnafu), OutputType::Yaml => serde_yaml::to_string(&stacklets).context(YamlOutputFormatSnafu), diff --git a/rust/stackablectl/src/main.rs b/rust/stackablectl/src/main.rs index ac3dc64f..013cc80f 100644 --- a/rust/stackablectl/src/main.rs +++ b/rust/stackablectl/src/main.rs @@ -47,7 +47,7 @@ async fn main() -> Result<(), Error> { let mut output = app.error(); output.with_error_report(err); - eprint!("{}", output.render().unwrap()) + eprint!("{}", output.render()) } } diff --git a/rust/stackablectl/src/output/mod.rs b/rust/stackablectl/src/output/mod.rs index 686734f2..70a71ad4 100644 --- a/rust/stackablectl/src/output/mod.rs +++ b/rust/stackablectl/src/output/mod.rs @@ -131,16 +131,18 @@ where } } - pub fn render(self) -> Result { + pub fn render(self) -> String { + // We ignore the error. If we cannot render the output, there is + // no point to explicitly handle the error. match self.context.output_kind() { OutputKind::Result => self .renderer .render("result", &self.context.into_context()) - .context(RenderSnafu), + .expect("Failed to render result"), OutputKind::Error => self .renderer .render("error", &self.context.into_context()) - .context(RenderSnafu), + .expect("Failed to render error"), } } From afeaf8acce21aa7c9d2326bd686415a00bb764b3 Mon Sep 17 00:00:00 2001 From: Techassi Date: Thu, 9 Nov 2023 16:09:41 +0100 Subject: [PATCH 21/40] Update errors from code review --- rust/stackable-cockpit/src/common/list.rs | 4 +-- .../src/engine/docker/mod.rs | 6 ++-- rust/stackable-cockpit/src/engine/kind/mod.rs | 34 ++++++++++--------- .../src/engine/minikube/mod.rs | 6 ++-- 4 files changed, 26 insertions(+), 24 deletions(-) diff --git a/rust/stackable-cockpit/src/common/list.rs b/rust/stackable-cockpit/src/common/list.rs index 9f06be28..9de321de 100644 --- a/rust/stackable-cockpit/src/common/list.rs +++ b/rust/stackable-cockpit/src/common/list.rs @@ -16,7 +16,7 @@ pub trait SpecIter { #[derive(Debug, Snafu)] pub enum ListError { #[snafu(display("failed to transfer the list file"))] - TransferError { source: FileTransferError }, + FileTransfer { source: FileTransferError }, } /// A [`List`] describes a list of specs. The list can contain any specs, for @@ -52,7 +52,7 @@ where let specs = transfer_client .get(file, &Yaml::::new()) .await - .context(TransferSnafu)?; + .context(FileTransferSnafu)?; for (spec_name, spec) in specs.inner() { map.insert(spec_name.clone(), spec.clone()); diff --git a/rust/stackable-cockpit/src/engine/docker/mod.rs b/rust/stackable-cockpit/src/engine/docker/mod.rs index e36abf75..614d00e4 100644 --- a/rust/stackable-cockpit/src/engine/docker/mod.rs +++ b/rust/stackable-cockpit/src/engine/docker/mod.rs @@ -7,7 +7,7 @@ use tracing::{debug, instrument}; #[derive(Debug, Snafu)] pub enum DockerError { #[snafu(display("failed to read stdout"))] - IoError { source: std::io::Error }, + StdoutRead { source: std::io::Error }, #[snafu(display("It seems like Docker is not running on this system"))] NotRunning, @@ -22,10 +22,10 @@ pub async fn check_if_docker_is_running() -> Result<(), DockerError> { .arg("info") .stdout(Stdio::null()) .spawn() - .context(IoSnafu)? + .context(StdoutReadSnafu)? .wait() .await - .context(IoSnafu)? + .context(StdoutReadSnafu)? .success() { return Ok(()); diff --git a/rust/stackable-cockpit/src/engine/kind/mod.rs b/rust/stackable-cockpit/src/engine/kind/mod.rs index 8818d521..f7966d36 100644 --- a/rust/stackable-cockpit/src/engine/kind/mod.rs +++ b/rust/stackable-cockpit/src/engine/kind/mod.rs @@ -15,13 +15,16 @@ mod config; #[derive(Debug, Snafu)] pub enum KindClusterError { #[snafu(display("failed to pipe kind config using stdin"))] - IoError { source: std::io::Error }, + PipeConfigStdin { source: std::io::Error }, #[snafu(display("failed to obtain stdin handle"))] - StdinError, + ObtainStdinHandle, - #[snafu(display("failed to execute kind command: {error}"))] - CommandError { error: String }, + #[snafu(display("failed to execute kind command"))] + CommandError { source: std::io::Error }, + + #[snafu(display("kind command executed, but returned error: {error}"))] + CommandErroredOut { error: String }, #[snafu(display("missing required binary: {binary}"))] MissingBinaryError { binary: String }, @@ -79,25 +82,24 @@ impl KindCluster { .stderr(Stdio::null()) .stdin(Stdio::piped()) .spawn() - .context(IoSnafu)?; + .context(PipeConfigStdinSnafu)?; // Pipe in config - let mut stdin = kind_cmd.stdin.take().ok_or(KindClusterError::StdinError)?; + let mut stdin = kind_cmd + .stdin + .take() + .ok_or(KindClusterError::ObtainStdinHandle)?; + stdin .write_all(config_string.as_bytes()) .await - .context(IoSnafu)?; + .context(PipeConfigStdinSnafu)?; // Write the piped in data - stdin.flush().await.context(IoSnafu)?; + stdin.flush().await.context(PipeConfigStdinSnafu)?; drop(stdin); - if let Err(err) = kind_cmd.wait().await { - return Err(KindClusterError::CommandError { - error: err.to_string(), - }); - } - + kind_cmd.wait().await.context(CommandSnafu)?; Ok(()) } @@ -132,11 +134,11 @@ impl KindCluster { .args(["get", "clusters"]) .output() .await - .context(IoSnafu)?; + .context(CommandSnafu)?; ensure!( output.status.success(), - CommandSnafu { + CommandErroredOutSnafu { error: String::from_utf8_lossy(&output.stderr) } ); diff --git a/rust/stackable-cockpit/src/engine/minikube/mod.rs b/rust/stackable-cockpit/src/engine/minikube/mod.rs index 53968de5..4a445dae 100644 --- a/rust/stackable-cockpit/src/engine/minikube/mod.rs +++ b/rust/stackable-cockpit/src/engine/minikube/mod.rs @@ -13,13 +13,13 @@ pub enum MinikubeClusterError { #[snafu(display( "failed to determine if a minikube cluster named {cluster_name} already exists" ))] - CheckClusterError { + CheckCluster { source: std::io::Error, cluster_name: String, }, #[snafu(display("missing required binary: {binary}"))] - MissingBinaryError { binary: String }, + MissingBinary { binary: String }, #[snafu(display("failed to execute minikube command: {error}"))] CommandError { error: String }, @@ -51,7 +51,7 @@ impl MinikubeCluster { // Check if required binaries are present if let Some(binary) = binaries_present_with_name(&["docker", "minikube"]) { - return Err(MinikubeClusterError::MissingBinaryError { binary }); + return Err(MinikubeClusterError::MissingBinary { binary }); } // Check if Docker is running From ac8ed849bc8c06b479cadc783aa006b5f72e9165 Mon Sep 17 00:00:00 2001 From: Techassi Date: Thu, 9 Nov 2023 16:13:44 +0100 Subject: [PATCH 22/40] Rename error variants --- rust/stackable-cockpit/src/platform/cluster/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rust/stackable-cockpit/src/platform/cluster/mod.rs b/rust/stackable-cockpit/src/platform/cluster/mod.rs index ed98eca3..f62725c8 100644 --- a/rust/stackable-cockpit/src/platform/cluster/mod.rs +++ b/rust/stackable-cockpit/src/platform/cluster/mod.rs @@ -10,12 +10,12 @@ pub use resource_request::*; #[derive(Debug, Snafu)] pub enum ClusterError { #[snafu(display("failed to parse node cpu quantity"))] - ParseCpuQuantityError { + ParseNodeCpuQuantity { source: stackable_operator::error::Error, }, #[snafu(display("failed to parse node memory quantity"))] - ParseMemoryQuantityError { + ParseNodeMemoryQuantity { source: stackable_operator::error::Error, }, } @@ -66,12 +66,12 @@ impl ClusterInfo { for mut node in untainted_allocatable { if let Some(q) = node.remove("cpu") { - let cpu = CpuQuantity::try_from(q).context(ParseCpuQuantitySnafu)?; + let cpu = CpuQuantity::try_from(q).context(ParseNodeCpuQuantitySnafu)?; untainted_allocatable_cpu += cpu; } if let Some(q) = node.remove("memory") { - let memory = MemoryQuantity::try_from(q).context(ParseMemoryQuantitySnafu)?; + let memory = MemoryQuantity::try_from(q).context(ParseNodeMemoryQuantitySnafu)?; untainted_allocatable_memory += memory; } } From f795a4876ccbb9a6bf9a01c4af99b6f9a8c375e9 Mon Sep 17 00:00:00 2001 From: Techassi Date: Fri, 10 Nov 2023 15:12:18 +0100 Subject: [PATCH 23/40] Add command start and command run error cases --- rust/stackable-cockpit/src/engine/docker/mod.rs | 13 ++++++++----- rust/stackable-cockpit/src/engine/kind/mod.rs | 16 ++++++++++------ 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/rust/stackable-cockpit/src/engine/docker/mod.rs b/rust/stackable-cockpit/src/engine/docker/mod.rs index 614d00e4..16cfdf01 100644 --- a/rust/stackable-cockpit/src/engine/docker/mod.rs +++ b/rust/stackable-cockpit/src/engine/docker/mod.rs @@ -6,10 +6,13 @@ use tracing::{debug, instrument}; #[derive(Debug, Snafu)] pub enum DockerError { - #[snafu(display("failed to read stdout"))] - StdoutRead { source: std::io::Error }, + #[snafu(display("failed to start docker command"))] + CommandFailedToStart { source: std::io::Error }, - #[snafu(display("It seems like Docker is not running on this system"))] + #[snafu(display("failed to run docker command"))] + CommandFailedToRun { source: std::io::Error }, + + #[snafu(display("it seems like Docker is not running on this system"))] NotRunning, } @@ -22,10 +25,10 @@ pub async fn check_if_docker_is_running() -> Result<(), DockerError> { .arg("info") .stdout(Stdio::null()) .spawn() - .context(StdoutReadSnafu)? + .context(CommandFailedToStartSnafu)? .wait() .await - .context(StdoutReadSnafu)? + .context(CommandFailedToRunSnafu)? .success() { return Ok(()); diff --git a/rust/stackable-cockpit/src/engine/kind/mod.rs b/rust/stackable-cockpit/src/engine/kind/mod.rs index f7966d36..8914d248 100644 --- a/rust/stackable-cockpit/src/engine/kind/mod.rs +++ b/rust/stackable-cockpit/src/engine/kind/mod.rs @@ -20,8 +20,11 @@ pub enum KindClusterError { #[snafu(display("failed to obtain stdin handle"))] ObtainStdinHandle, - #[snafu(display("failed to execute kind command"))] - CommandError { source: std::io::Error }, + #[snafu(display("failed to start kind command"))] + CommandFailedToStart { source: std::io::Error }, + + #[snafu(display("failed to run kind command"))] + CommandFailedToRun { source: std::io::Error }, #[snafu(display("kind command executed, but returned error: {error}"))] CommandErroredOut { error: String }, @@ -82,14 +85,15 @@ impl KindCluster { .stderr(Stdio::null()) .stdin(Stdio::piped()) .spawn() - .context(PipeConfigStdinSnafu)?; + .context(CommandFailedToStartSnafu)?; - // Pipe in config + // Try to obtain stdin handle let mut stdin = kind_cmd .stdin .take() .ok_or(KindClusterError::ObtainStdinHandle)?; + // Pipe in config stdin .write_all(config_string.as_bytes()) .await @@ -99,7 +103,7 @@ impl KindCluster { stdin.flush().await.context(PipeConfigStdinSnafu)?; drop(stdin); - kind_cmd.wait().await.context(CommandSnafu)?; + kind_cmd.wait().await.context(CommandFailedToRunSnafu)?; Ok(()) } @@ -134,7 +138,7 @@ impl KindCluster { .args(["get", "clusters"]) .output() .await - .context(CommandSnafu)?; + .context(CommandFailedToRunSnafu)?; ensure!( output.status.success(), From 1d3b16af9b7b05ebb0f5fb7f91eae72f5a47c637 Mon Sep 17 00:00:00 2001 From: Techassi Date: Tue, 14 Nov 2023 17:13:41 +0100 Subject: [PATCH 24/40] Start to improve error variants even more --- rust/stackable-cockpit/src/common/list.rs | 15 +++-- rust/stackable-cockpit/src/common/mod.rs | 7 +-- .../src/engine/docker/mod.rs | 10 ++-- .../src/engine/kind/config.rs | 14 ++--- rust/stackable-cockpit/src/engine/kind/mod.rs | 32 +++++----- .../src/engine/minikube/mod.rs | 31 ++++------ rust/stackable-cockpit/src/engine/mod.rs | 10 +--- rust/stackable-cockpit/src/helm.rs | 51 ++++++++-------- .../src/platform/cluster/mod.rs | 6 +- .../src/platform/cluster/resource_request.rs | 15 ++--- .../src/platform/credentials.rs | 4 +- .../src/platform/demo/mod.rs | 2 +- .../src/platform/demo/spec.rs | 59 +++++++++++-------- .../src/platform/namespace.rs | 10 ++-- .../src/platform/release/mod.rs | 2 +- .../src/platform/stack/mod.rs | 2 +- .../src/platform/stack/spec.rs | 2 +- .../src/platform/stacklet/mod.rs | 6 +- .../stackable-cockpit/src/utils/k8s/client.rs | 4 +- rust/stackable-cockpit/src/xfer/mod.rs | 46 +++++++++------ rust/stackable-cockpitd/src/api_doc.rs | 2 +- rust/stackablectl/src/args/cluster.rs | 9 ++- rust/stackablectl/src/cmds/demo.rs | 8 +-- rust/stackablectl/src/cmds/operator.rs | 7 +-- rust/stackablectl/src/cmds/release.rs | 11 ++-- rust/stackablectl/src/cmds/stack.rs | 11 ++-- 26 files changed, 185 insertions(+), 191 deletions(-) diff --git a/rust/stackable-cockpit/src/common/list.rs b/rust/stackable-cockpit/src/common/list.rs index 9de321de..6d97e751 100644 --- a/rust/stackable-cockpit/src/common/list.rs +++ b/rust/stackable-cockpit/src/common/list.rs @@ -9,16 +9,18 @@ use crate::{ xfer::{processor::Yaml, FileTransferClient, FileTransferError}, }; -pub trait SpecIter { - fn inner(&self) -> &IndexMap; -} +type Result = std::result::Result; #[derive(Debug, Snafu)] -pub enum ListError { +pub enum Error { #[snafu(display("failed to transfer the list file"))] FileTransfer { source: FileTransferError }, } +pub trait SpecIter { + fn inner(&self) -> &IndexMap; +} + /// A [`List`] describes a list of specs. The list can contain any specs, for /// example demos, stacks or releases. The generic parameter `L` represents /// the initial type of the spec list, directly deserialized from YAML. This @@ -42,10 +44,7 @@ where /// Builds a list of specs of type `S` based on a list of files. These files /// can be located locally (on disk) or remotely. Remote files will get /// downloaded. - pub async fn build( - files: &[PathOrUrl], - transfer_client: &FileTransferClient, - ) -> Result { + pub async fn build(files: &[PathOrUrl], transfer_client: &FileTransferClient) -> Result { let mut map = IndexMap::new(); for file in files { diff --git a/rust/stackable-cockpit/src/common/mod.rs b/rust/stackable-cockpit/src/common/mod.rs index bc64f01f..81addf83 100644 --- a/rust/stackable-cockpit/src/common/mod.rs +++ b/rust/stackable-cockpit/src/common/mod.rs @@ -1,5 +1,2 @@ -mod list; -mod manifest; - -pub use list::*; -pub use manifest::*; +pub mod list; +pub mod manifest; diff --git a/rust/stackable-cockpit/src/engine/docker/mod.rs b/rust/stackable-cockpit/src/engine/docker/mod.rs index 16cfdf01..19893d94 100644 --- a/rust/stackable-cockpit/src/engine/docker/mod.rs +++ b/rust/stackable-cockpit/src/engine/docker/mod.rs @@ -1,11 +1,13 @@ use std::process::Stdio; -use tokio::process::Command; use snafu::{ResultExt, Snafu}; +use tokio::process::Command; use tracing::{debug, instrument}; +type Result = std::result::Result; + #[derive(Debug, Snafu)] -pub enum DockerError { +pub enum Error { #[snafu(display("failed to start docker command"))] CommandFailedToStart { source: std::io::Error }, @@ -18,7 +20,7 @@ pub enum DockerError { /// Checks if Docker is running on the system #[instrument] -pub async fn check_if_docker_is_running() -> Result<(), DockerError> { +pub async fn check_if_docker_is_running() -> Result<()> { debug!("Checking if Docker is running"); if Command::new("docker") @@ -34,5 +36,5 @@ pub async fn check_if_docker_is_running() -> Result<(), DockerError> { return Ok(()); } - Err(DockerError::NotRunning) + Err(Error::NotRunning) } diff --git a/rust/stackable-cockpit/src/engine/kind/config.rs b/rust/stackable-cockpit/src/engine/kind/config.rs index 9caf520d..4b8aec21 100644 --- a/rust/stackable-cockpit/src/engine/kind/config.rs +++ b/rust/stackable-cockpit/src/engine/kind/config.rs @@ -4,13 +4,13 @@ use crate::engine::NodeRole; #[derive(Debug, Serialize)] #[serde(rename_all = "camelCase")] -pub struct KindClusterConfig { +pub struct Config { kind: String, api_version: String, - nodes: Vec, + nodes: Vec, } -impl Default for KindClusterConfig { +impl Default for Config { fn default() -> Self { Self { kind: "Cluster".into(), @@ -22,11 +22,11 @@ impl Default for KindClusterConfig { #[derive(Clone, Debug, Serialize)] #[serde(rename_all = "camelCase")] -pub struct KindClusterNodeConfig { +pub struct NodeConfig { role: NodeRole, } -impl KindClusterConfig { +impl Config { pub fn new(node_count: usize, cp_node_count: usize) -> Self { let mut cp_node_count = cp_node_count; @@ -38,7 +38,7 @@ impl KindClusterConfig { let mut control_plane_nodes = Vec::new(); for _ in 0..cp_node_count { - control_plane_nodes.push(KindClusterNodeConfig { + control_plane_nodes.push(NodeConfig { role: NodeRole::ControlPlane, }); } @@ -47,7 +47,7 @@ impl KindClusterConfig { let mut worker_nodes = Vec::new(); for _ in 0..node_count - cp_node_count { - worker_nodes.push(KindClusterNodeConfig { + worker_nodes.push(NodeConfig { role: NodeRole::Worker, }) } diff --git a/rust/stackable-cockpit/src/engine/kind/mod.rs b/rust/stackable-cockpit/src/engine/kind/mod.rs index 8914d248..54c35809 100644 --- a/rust/stackable-cockpit/src/engine/kind/mod.rs +++ b/rust/stackable-cockpit/src/engine/kind/mod.rs @@ -1,19 +1,24 @@ use std::process::Stdio; -use snafu::{ensure, ResultExt, Snafu}; +use snafu::{ensure, OptionExt, ResultExt, Snafu}; use tokio::{io::AsyncWriteExt, process::Command}; use tracing::{debug, info, instrument}; use crate::{ constants::DEFAULT_LOCAL_CLUSTER_NAME, - engine::{check_if_docker_is_running, kind::config::KindClusterConfig, DockerError}, + engine::{ + docker::{self, check_if_docker_is_running}, + kind::config::Config, + }, utils::check::binaries_present_with_name, }; mod config; +type Result = std::result::Result; + #[derive(Debug, Snafu)] -pub enum KindClusterError { +pub enum Error { #[snafu(display("failed to pipe kind config using stdin"))] PipeConfigStdin { source: std::io::Error }, @@ -33,10 +38,10 @@ pub enum KindClusterError { MissingBinaryError { binary: String }, #[snafu(display("failed to determine if Docker is running"))] - DockerError { source: DockerError }, + DockerError { source: docker::Error }, #[snafu(display("failed to covert kind config to YAML"))] - YamlError { source: serde_yaml::Error }, + ConfigSerialization { source: serde_yaml::Error }, } #[derive(Debug)] @@ -61,20 +66,20 @@ impl KindCluster { /// Create a new local cluster by calling the kind binary. #[instrument] - pub async fn create(&self) -> Result<(), KindClusterError> { + pub async fn create(&self) -> Result<()> { info!("Creating local cluster using kind"); // Check if required binaries are present if let Some(binary) = binaries_present_with_name(&["docker", "kind"]) { - return Err(KindClusterError::MissingBinaryError { binary }); + return Err(Error::MissingBinaryError { binary }); } // Check if Docker is running check_if_docker_is_running().await.context(DockerSnafu)?; debug!("Creating kind cluster config"); - let config = KindClusterConfig::new(self.node_count, self.cp_node_count); - let config_string = serde_yaml::to_string(&config).context(YamlSnafu)?; + let config = Config::new(self.node_count, self.cp_node_count); + let config_string = serde_yaml::to_string(&config).context(ConfigSerializationSnafu)?; debug!("Creating kind cluster"); let mut kind_cmd = Command::new("kind") @@ -88,10 +93,7 @@ impl KindCluster { .context(CommandFailedToStartSnafu)?; // Try to obtain stdin handle - let mut stdin = kind_cmd - .stdin - .take() - .ok_or(KindClusterError::ObtainStdinHandle)?; + let mut stdin = kind_cmd.stdin.take().context(ObtainStdinHandleSnafu)?; // Pipe in config stdin @@ -109,7 +111,7 @@ impl KindCluster { /// Creates a kind cluster if it doesn't exist already. #[instrument] - pub async fn create_if_not_exists(&self) -> Result<(), KindClusterError> { + pub async fn create_if_not_exists(&self) -> Result<()> { info!("Creating cluster if it doesn't exist using kind"); if Self::check_if_cluster_exists(&self.name).await? { @@ -131,7 +133,7 @@ impl KindCluster { /// Check if a kind cluster with the provided name already exists. #[instrument] - async fn check_if_cluster_exists(cluster_name: &str) -> Result { + async fn check_if_cluster_exists(cluster_name: &str) -> Result { debug!("Checking if kind cluster exists"); let output = Command::new("kind") diff --git a/rust/stackable-cockpit/src/engine/minikube/mod.rs b/rust/stackable-cockpit/src/engine/minikube/mod.rs index 4a445dae..1178b71b 100644 --- a/rust/stackable-cockpit/src/engine/minikube/mod.rs +++ b/rust/stackable-cockpit/src/engine/minikube/mod.rs @@ -4,14 +4,14 @@ use tracing::{debug, info, instrument}; use crate::{ constants::DEFAULT_LOCAL_CLUSTER_NAME, - engine::{check_if_docker_is_running, DockerError}, + engine::docker::{self, check_if_docker_is_running}, utils::check::binaries_present_with_name, }; #[derive(Debug, Snafu)] -pub enum MinikubeClusterError { +pub enum Error { #[snafu(display( - "failed to determine if a minikube cluster named {cluster_name} already exists" + "failed to determine if a minikube cluster named '{cluster_name}' already exists" ))] CheckCluster { source: std::io::Error, @@ -21,11 +21,11 @@ pub enum MinikubeClusterError { #[snafu(display("missing required binary: {binary}"))] MissingBinary { binary: String }, - #[snafu(display("failed to execute minikube command: {error}"))] - CommandError { error: String }, + #[snafu(display("failed to execute minikube command"))] + CommandError { source: std::io::Error }, #[snafu(display("failed to determine if Docker is running"))] - DockerError { source: DockerError }, + DockerError { source: docker::Error }, } #[derive(Debug)] @@ -46,12 +46,12 @@ impl MinikubeCluster { /// Create a new local cluster by calling the minikube binary #[instrument] - pub async fn create(&self) -> Result<(), MinikubeClusterError> { + pub async fn create(&self) -> Result<(), Error> { info!("Creating local cluster using minikube"); // Check if required binaries are present if let Some(binary) = binaries_present_with_name(&["docker", "minikube"]) { - return Err(MinikubeClusterError::MissingBinary { binary }); + return Err(Error::MissingBinary { binary }); } // Check if Docker is running @@ -59,26 +59,21 @@ impl MinikubeCluster { // Create local cluster via minikube debug!("Creating minikube cluster"); - let minikube_cmd = Command::new("minikube") + Command::new("minikube") .arg("start") .args(["--driver", "docker"]) .args(["--nodes", self.node_count.to_string().as_str()]) .args(["-p", self.name.as_str()]) .status() - .await; - - if let Err(err) = minikube_cmd { - return Err(MinikubeClusterError::CommandError { - error: err.to_string(), - }); - } + .await + .context(CommandSnafu)?; Ok(()) } /// Creates a minikube cluster if it doesn't exist already. #[instrument] - pub async fn create_if_not_exists(&self) -> Result<(), MinikubeClusterError> { + pub async fn create_if_not_exists(&self) -> Result<(), Error> { info!("Creating cluster if it doesn't exist using minikube"); if Self::check_if_cluster_exists(&self.name).await? { @@ -100,7 +95,7 @@ impl MinikubeCluster { /// Check if a kind cluster with the provided name already exists. #[instrument] - async fn check_if_cluster_exists(cluster_name: &str) -> Result { + async fn check_if_cluster_exists(cluster_name: &str) -> Result { debug!("Checking if minikube cluster exists"); let output = Command::new("minikube") diff --git a/rust/stackable-cockpit/src/engine/mod.rs b/rust/stackable-cockpit/src/engine/mod.rs index 1e42d2c3..593fb343 100644 --- a/rust/stackable-cockpit/src/engine/mod.rs +++ b/rust/stackable-cockpit/src/engine/mod.rs @@ -1,12 +1,8 @@ use serde::Serialize; -mod docker; -mod kind; -mod minikube; - -pub use docker::*; -pub use kind::*; -pub use minikube::*; +pub mod docker; +pub mod kind; +pub mod minikube; #[derive(Clone, Debug, Serialize)] #[serde(rename_all = "kebab-case")] diff --git a/rust/stackable-cockpit/src/helm.rs b/rust/stackable-cockpit/src/helm.rs index 5311b0c8..e881f4d6 100644 --- a/rust/stackable-cockpit/src/helm.rs +++ b/rust/stackable-cockpit/src/helm.rs @@ -1,6 +1,5 @@ use std::collections::HashMap; use std::fmt::Display; -use std::str::{self, Utf8Error}; use serde::{Deserialize, Serialize}; use snafu::{ResultExt, Snafu}; @@ -48,32 +47,29 @@ pub struct HelmRepoEntry { #[derive(Debug, Snafu)] pub enum HelmError { - #[snafu(display("failed to convert raw C string pointer to UTF-8 string"))] - StrUtf8Error { source: Utf8Error }, - #[snafu(display("failed to parse URL"))] - UrlParseError { source: url::ParseError }, + UrlParse { source: url::ParseError }, #[snafu(display("failed to deserialize JSON data"))] - DeserializeJsonError { source: serde_json::Error }, + DeserializeJson { source: serde_json::Error }, #[snafu(display("failed to deserialize YAML data"))] - DeserializeYamlError { source: serde_yaml::Error }, + DeserializeYaml { source: serde_yaml::Error }, #[snafu(display("failed to retrieve remote content"))] - RequestError { source: reqwest::Error }, + FetchRemoteContent { source: reqwest::Error }, #[snafu(display("failed to add Helm repo ({error})"))] - AddRepoError { error: String }, + AddRepo { error: String }, #[snafu(display("failed to list Helm releases: {error}"))] - ListReleasesError { error: String }, + ListReleases { error: String }, #[snafu(display("failed to install Helm release"))] - InstallReleaseError { source: HelmInstallReleaseError }, + InstallRelease { source: HelmInstallReleaseError }, #[snafu(display("failed to uninstall Helm release: {error}"))] - UninstallReleaseError { error: String }, + UninstallRelease { error: String }, } #[derive(Debug, Snafu)] @@ -207,12 +203,11 @@ pub fn install_release_from_repo( debug!("Install Helm release from repo"); if check_release_exists(release_name, namespace)? { - let release = - get_release(release_name, namespace)?.ok_or(HelmError::InstallReleaseError { - source: HelmInstallReleaseError::NoSuchRelease { - name: release_name.to_owned(), - }, - })?; + let release = get_release(release_name, namespace)?.ok_or(HelmError::InstallRelease { + source: HelmInstallReleaseError::NoSuchRelease { + name: release_name.to_owned(), + }, + })?; let current_version = release.version; @@ -227,7 +222,7 @@ pub fn install_release_from_repo( }, ); } else { - return Err(HelmError::InstallReleaseError { + return Err(HelmError::InstallRelease { source: HelmInstallReleaseError::ReleaseAlreadyInstalled { requested_version: chart_version.into(), name: release_name.into(), @@ -286,14 +281,14 @@ fn install_release( suppress_output, ); - if let Some(err) = helm_sys::to_helm_error(&result) { + if let Some(error) = helm_sys::to_helm_error(&result) { error!( "Go wrapper function go_install_helm_release encountered an error: {}", - err + error ); - return Err(HelmError::InstallReleaseError { - source: HelmInstallReleaseError::HelmWrapperError { error: err }, + return Err(HelmError::InstallRelease { + source: HelmInstallReleaseError::HelmWrapperError { error }, }); } @@ -318,7 +313,7 @@ pub fn uninstall_release( err ); - return Err(HelmError::UninstallReleaseError { error: err }); + return Err(HelmError::UninstallRelease { error: err }); } return Ok(HelmUninstallReleaseStatus::Uninstalled( @@ -358,7 +353,7 @@ pub fn list_releases(namespace: &str) -> Result, HelmError> { err ); - return Err(HelmError::ListReleasesError { error: err }); + return Err(HelmError::ListReleases { error: err }); } serde_json::from_str(&result).context(DeserializeJsonSnafu) @@ -387,7 +382,7 @@ pub fn add_repo(repository_name: &str, repository_url: &str) -> Result<(), HelmE err ); - return Err(HelmError::AddRepoError { error: err }); + return Err(HelmError::AddRepo { error: err }); } Ok(()) @@ -409,10 +404,10 @@ where // TODO (Techassi): Use the FileTransferClient for that let index_file_content = reqwest::get(url) .await - .context(RequestSnafu)? + .context(FetchRemoteContentSnafu)? .text() .await - .context(RequestSnafu)?; + .context(FetchRemoteContentSnafu)?; serde_yaml::from_str(&index_file_content).context(DeserializeYamlSnafu) } diff --git a/rust/stackable-cockpit/src/platform/cluster/mod.rs b/rust/stackable-cockpit/src/platform/cluster/mod.rs index f62725c8..a8ba2d8c 100644 --- a/rust/stackable-cockpit/src/platform/cluster/mod.rs +++ b/rust/stackable-cockpit/src/platform/cluster/mod.rs @@ -7,8 +7,10 @@ mod resource_request; pub use resource_request::*; +type Result = std::result::Result; + #[derive(Debug, Snafu)] -pub enum ClusterError { +pub enum Error { #[snafu(display("failed to parse node cpu quantity"))] ParseNodeCpuQuantity { source: stackable_operator::error::Error, @@ -44,7 +46,7 @@ pub struct ClusterInfo { } impl ClusterInfo { - pub fn from_nodes(nodes: ObjectList) -> Result { + pub fn from_nodes(nodes: ObjectList) -> Result { // FIXME (Techassi): Also retrieve number of control plane nodes let node_count = nodes.items.len(); diff --git a/rust/stackable-cockpit/src/platform/cluster/resource_request.rs b/rust/stackable-cockpit/src/platform/cluster/resource_request.rs index 827b4d0e..4148898e 100644 --- a/rust/stackable-cockpit/src/platform/cluster/resource_request.rs +++ b/rust/stackable-cockpit/src/platform/cluster/resource_request.rs @@ -1,6 +1,5 @@ use std::fmt::Display; -use rand::Rng; #[cfg(feature = "openapi")] use utoipa::ToSchema; @@ -11,7 +10,7 @@ use stackable_operator::{cpu::CpuQuantity, memory::MemoryQuantity}; use crate::utils::k8s::{KubeClient, KubeClientError}; -const HELP_MESSAGE: &str = ". Have a look at https://github.com/torvalds/linux/blob/f7757129e3dea336c407551c98f50057c22bb266/include/math-emu/double.h#L29 for a possible solution"; +type Result = std::result::Result; /// Demos and stacks can define how much cluster resources they need to run /// via their definition. The struct [`ResourceRequests`] contains information @@ -69,11 +68,10 @@ pub enum ResourceRequestsError { #[derive(Debug, Snafu)] pub enum ResourceRequestsValidationError { #[snafu(display( - "The {object_name} requires {} CPU cores, but there are only {} CPU cores available in the cluster{}", - required.as_cpu_count(), available.as_cpu_count(), help_message.clone().unwrap_or_default() + "The {object_name} requires {} CPU cores, but there are only {} CPU cores available in the cluster", + required.as_cpu_count(), available.as_cpu_count() ))] InsufficientCpu { - help_message: Option, available: CpuQuantity, required: CpuQuantity, object_name: String, @@ -93,10 +91,7 @@ impl ResourceRequests { /// Validates the struct [`ResourceRequests`] by comparing the required /// resources to the available ones in the current cluster. `object_name` /// should be `stack` or `demo`. - pub async fn validate_cluster_size( - &self, - object_name: &str, - ) -> Result<(), ResourceRequestsError> { + pub async fn validate_cluster_size(&self, object_name: &str) -> Result<()> { let kube_client = KubeClient::new().await.context(KubeClientSnafu)?; let cluster_info = kube_client .get_cluster_info() @@ -115,12 +110,10 @@ impl ResourceRequests { let mut errors = Vec::new(); if stack_cpu > cluster_info.untainted_allocatable_cpu { - let mut rng = rand::thread_rng(); errors.push(ResourceRequestsValidationError::InsufficientCpu { available: cluster_info.untainted_allocatable_cpu, object_name: object_name.to_string(), required: stack_cpu, - help_message: (rng.gen::() < 0.005).then_some(HELP_MESSAGE.to_string()), }); } diff --git a/rust/stackable-cockpit/src/platform/credentials.rs b/rust/stackable-cockpit/src/platform/credentials.rs index aea1093e..9e38607f 100644 --- a/rust/stackable-cockpit/src/platform/credentials.rs +++ b/rust/stackable-cockpit/src/platform/credentials.rs @@ -6,10 +6,10 @@ use snafu::{OptionExt, ResultExt, Snafu}; use crate::utils::k8s::{KubeClient, KubeClientError}; -pub type Result = std::result::Result; +pub type Result = std::result::Result; #[derive(Debug, Snafu)] -pub enum CredentialsError { +pub enum Error { #[snafu(display("failed to fetch data from kubernetes api"))] KubeClientFetchError { source: KubeClientError }, diff --git a/rust/stackable-cockpit/src/platform/demo/mod.rs b/rust/stackable-cockpit/src/platform/demo/mod.rs index 6c4b5c50..0ffae822 100644 --- a/rust/stackable-cockpit/src/platform/demo/mod.rs +++ b/rust/stackable-cockpit/src/platform/demo/mod.rs @@ -1,7 +1,7 @@ use indexmap::IndexMap; use serde::{Deserialize, Serialize}; -use crate::common::{List, SpecIter}; +use crate::common::list::{List, SpecIter}; mod spec; diff --git a/rust/stackable-cockpit/src/platform/demo/spec.rs b/rust/stackable-cockpit/src/platform/demo/spec.rs index 10465c0d..dbd7877f 100644 --- a/rust/stackable-cockpit/src/platform/demo/spec.rs +++ b/rust/stackable-cockpit/src/platform/demo/spec.rs @@ -6,7 +6,7 @@ use tracing::{debug, instrument, warn}; use utoipa::ToSchema; use crate::{ - common::ManifestSpec, + common::manifest::ManifestSpec, platform::{ cluster::{ResourceRequests, ResourceRequestsError}, release::ReleaseList, @@ -20,6 +20,33 @@ pub type RawDemoParameterParseError = RawParameterParseError; pub type RawDemoParameter = RawParameter; pub type DemoParameter = Parameter; +#[derive(Debug, Snafu)] +pub enum DemoError { + #[snafu(display("no stack named '{name}'"))] + NoSuchStack { name: String }, + + #[snafu(display("failed to install stack because some prerequisites failed"))] + StackPrerequisites { source: StackError }, + + #[snafu(display("failed to install release associated with stack"))] + StackInstallRelease { source: StackError }, + + #[snafu(display("failed to install stack manifests"))] + InstallStackManifests { source: StackError }, + + #[snafu(display("failed to install demo manifests"))] + InstallDemoManifests { source: StackError }, + + #[snafu(display("demo resource requests error"), context(false))] + DemoResourceRequestsError { source: ResourceRequestsError }, + + #[snafu(display("cannot install demo in namespace '{requested}', only '{}' supported", supported.join(", ")))] + UnsupportedNamespace { + requested: String, + supported: Vec, + }, +} + /// This struct describes a demo with the v2 spec #[derive(Debug, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] @@ -57,24 +84,6 @@ pub struct DemoSpecV2 { pub parameters: Vec, } -#[derive(Debug, Snafu)] -pub enum DemoError { - #[snafu(display("no stack named {name}"))] - NoSuchStack { name: String }, - - #[snafu(display("failed to install stack"))] - StackError { source: StackError }, - - #[snafu(display("demo resource requests error"), context(false))] - DemoResourceRequestsError { source: ResourceRequestsError }, - - #[snafu(display("cannot install demo in namespace '{requested}', only '{}' supported", supported.join(", ")))] - UnsupportedNamespace { - requested: String, - supported: Vec, - }, -} - impl DemoSpecV2 { /// Checks if the prerequisites to run this demo are met. These checks /// include: @@ -129,11 +138,13 @@ impl DemoSpecV2 { name: self.stack.clone(), })?; - // Check prerequisites + // Check stack prerequisites stack_spec .check_prerequisites(product_namespace) .await - .context(StackSnafu)?; + .context(StackPrerequisitesSnafu)?; + + // Check demo prerequisites self.check_prerequisites(product_namespace).await?; // Install release if not opted out @@ -141,14 +152,14 @@ impl DemoSpecV2 { stack_spec .install_release(release_list, operator_namespace, product_namespace) .await - .context(StackSnafu)?; + .context(StackInstallReleaseSnafu)?; } // Install stack stack_spec .install_stack_manifests(stack_parameters, product_namespace, transfer_client) .await - .context(StackSnafu)?; + .context(InstallStackManifestsSnafu)?; // Install demo manifests stack_spec @@ -160,7 +171,7 @@ impl DemoSpecV2 { transfer_client, ) .await - .context(StackSnafu)?; + .context(InstallDemoManifestsSnafu)?; Ok(()) } diff --git a/rust/stackable-cockpit/src/platform/namespace.rs b/rust/stackable-cockpit/src/platform/namespace.rs index 61f17cd9..5e8ee3a8 100644 --- a/rust/stackable-cockpit/src/platform/namespace.rs +++ b/rust/stackable-cockpit/src/platform/namespace.rs @@ -3,7 +3,7 @@ use snafu::{ResultExt, Snafu}; use crate::utils::k8s::{KubeClient, KubeClientError}; #[derive(Debug, Snafu)] -pub enum NamespaceError { +pub enum Error { #[snafu(display("failed to create kubernetes client"))] KubeClientCreateError { source: KubeClientError }, @@ -13,7 +13,7 @@ pub enum NamespaceError { /// Creates a namespace with `name` if needed (not already present in the /// cluster). -pub async fn create_if_needed(name: String) -> Result<(), NamespaceError> { +pub async fn create_if_needed(name: String) -> Result<(), Error> { let client = KubeClient::new().await.context(KubeClientCreateSnafu)?; client @@ -21,11 +21,11 @@ pub async fn create_if_needed(name: String) -> Result<(), NamespaceError> { .await .map_err(|err| match err { KubeClientError::KubeError { source } => match source { - kube::Error::Api(err) if err.code == 401 => NamespaceError::PermissionDenied, - _ => NamespaceError::KubeClientCreateError { + kube::Error::Api(err) if err.code == 401 => Error::PermissionDenied, + _ => Error::KubeClientCreateError { source: KubeClientError::KubeError { source }, }, }, - _ => NamespaceError::KubeClientCreateError { source: err }, + _ => Error::KubeClientCreateError { source: err }, }) } diff --git a/rust/stackable-cockpit/src/platform/release/mod.rs b/rust/stackable-cockpit/src/platform/release/mod.rs index 8b6ab9bd..636c2fe7 100644 --- a/rust/stackable-cockpit/src/platform/release/mod.rs +++ b/rust/stackable-cockpit/src/platform/release/mod.rs @@ -5,7 +5,7 @@ mod spec; pub use spec::*; -use crate::common::{List, SpecIter}; +use crate::common::list::{List, SpecIter}; #[derive(Debug, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] diff --git a/rust/stackable-cockpit/src/platform/stack/mod.rs b/rust/stackable-cockpit/src/platform/stack/mod.rs index 6eba855f..97463f11 100644 --- a/rust/stackable-cockpit/src/platform/stack/mod.rs +++ b/rust/stackable-cockpit/src/platform/stack/mod.rs @@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize}; mod spec; pub use spec::*; -use crate::common::{List, SpecIter}; +use crate::common::list::{List, SpecIter}; /// This struct describes a complete demos v2 file #[derive(Debug, Deserialize, Serialize)] diff --git a/rust/stackable-cockpit/src/platform/stack/spec.rs b/rust/stackable-cockpit/src/platform/stack/spec.rs index 9af1b6ab..5210b87b 100644 --- a/rust/stackable-cockpit/src/platform/stack/spec.rs +++ b/rust/stackable-cockpit/src/platform/stack/spec.rs @@ -8,7 +8,7 @@ use tracing::{debug, info, instrument, log::warn}; use utoipa::ToSchema; use crate::{ - common::ManifestSpec, + common::manifest::ManifestSpec, helm::{self, HelmChart, HelmError}, platform::{ cluster::{ResourceRequests, ResourceRequestsError}, diff --git a/rust/stackable-cockpit/src/platform/stacklet/mod.rs b/rust/stackable-cockpit/src/platform/stacklet/mod.rs index 156591d8..86a3e4b0 100644 --- a/rust/stackable-cockpit/src/platform/stacklet/mod.rs +++ b/rust/stackable-cockpit/src/platform/stacklet/mod.rs @@ -11,7 +11,7 @@ use utoipa::ToSchema; use crate::{ constants::PRODUCT_NAMES, platform::{ - credentials::{get_credentials, Credentials, CredentialsError}, + credentials::{get_credentials, Credentials, Error}, service::{get_service_endpoints, ServiceError}, }, utils::{ @@ -104,8 +104,8 @@ pub async fn get_credentials_for_product( let credentials = match get_credentials(&kube_client, product_name, &product_cluster).await { Ok(credentials) => credentials, - Err(CredentialsError::NoSecret) => None, - Err(CredentialsError::KubeClientFetchError { source }) => { + Err(Error::NoSecret) => None, + Err(Error::KubeClientFetchError { source }) => { return Err(StackletError::KubeClientFetchError { source }) } }; diff --git a/rust/stackable-cockpit/src/utils/k8s/client.rs b/rust/stackable-cockpit/src/utils/k8s/client.rs index 65ce3428..0566ce89 100644 --- a/rust/stackable-cockpit/src/utils/k8s/client.rs +++ b/rust/stackable-cockpit/src/utils/k8s/client.rs @@ -15,7 +15,7 @@ use snafu::{OptionExt, ResultExt, Snafu}; use crate::{ platform::{ - cluster::{ClusterError, ClusterInfo}, + cluster::{ClusterInfo, Error}, credentials::Credentials, }, utils::k8s::ByteStringExt, @@ -48,7 +48,7 @@ pub enum KubeClientError { MissingServiceNamespace { service: String }, #[snafu(display("failed to retrieve cluster information"))] - ClusterError { source: ClusterError }, + ClusterError { source: Error }, #[snafu(display("invalid or empty secret data in '{secret_name}'"))] InvalidSecretData { secret_name: String }, diff --git a/rust/stackable-cockpit/src/xfer/mod.rs b/rust/stackable-cockpit/src/xfer/mod.rs index cf408b4f..855ebfb3 100644 --- a/rust/stackable-cockpit/src/xfer/mod.rs +++ b/rust/stackable-cockpit/src/xfer/mod.rs @@ -10,7 +10,7 @@ pub mod processor; use crate::{ utils::path::PathOrUrl, xfer::{ - cache::{Cache, CacheSettings, CacheStatus, Error}, + cache::{Cache, CacheSettings, CacheStatus}, processor::{Processor, ProcessorError}, }, }; @@ -20,22 +20,25 @@ type Result = core::result::Result; #[derive(Debug, Snafu)] pub enum FileTransferError { #[snafu(display("failed to read local file"))] - IoError { source: std::io::Error }, - - #[snafu(display("failed to extract file name from URL"))] - FileNameError, + ReadLocalFile { source: std::io::Error }, #[snafu(display("failed to create cache from provided settings"))] - CacheSettingsError { source: Error }, + CacheSettings { source: cache::Error }, + + #[snafu(display("failed to store file in cache"))] + CacheStore { source: cache::Error }, + + #[snafu(display("failed to retrieve file from cache"))] + CacheRetrieve { source: cache::Error }, - #[snafu(display("failed to read/write cache from/to cache"))] - CacheError { source: Error }, + #[snafu(display("failed to build http request"))] + BuildRequest { source: reqwest::Error }, - #[snafu(display("failed to retrieve remote file"))] - RequestError { source: reqwest::Error }, + #[snafu(display("failed to retrieve remote file contents"))] + FetchRemoteContent { source: reqwest::Error }, #[snafu(display("failed to process file contents"))] - ProcessingError { source: ProcessorError }, + ProcessFileContent { source: ProcessorError }, } #[derive(Debug)] @@ -71,29 +74,29 @@ impl FileTransferClient { match path_or_url { PathOrUrl::Path(path) => processor .process(self.get_from_local_file(path).await?) - .context(ProcessingSnafu), + .context(ProcessFileContentSnafu), PathOrUrl::Url(url) => processor .process(self.get_from_cache_or_remote(url).await?) - .context(ProcessingSnafu), + .context(ProcessFileContentSnafu), } } async fn get_from_local_file(&self, path: &PathBuf) -> Result { - fs::read_to_string(path).await.context(IoSnafu) + fs::read_to_string(path).await.context(ReadLocalFileSnafu) } /// Internal method which either looks up the requested file in the cache /// or retrieves it from the remote located at `url` when the cache missed /// or is expired. async fn get_from_cache_or_remote(&self, url: &Url) -> Result { - match self.cache.retrieve(url).await.context(CacheSnafu {})? { + match self.cache.retrieve(url).await.context(CacheRetrieveSnafu)? { CacheStatus::Hit(content) => Ok(content), CacheStatus::Expired | CacheStatus::Miss => { let content = self.get_from_remote(url).await?; self.cache .store(url, &content) .await - .context(CacheSnafu {})?; + .context(CacheStoreSnafu)?; Ok(content) } @@ -106,9 +109,14 @@ impl FileTransferClient { .client .get(url.clone()) .build() - .context(RequestSnafu {})?; + .context(BuildRequestSnafu)?; + + let result = self + .client + .execute(req) + .await + .context(FetchRemoteContentSnafu)?; - let result = self.client.execute(req).await.context(RequestSnafu {})?; - result.text().await.context(RequestSnafu {}) + result.text().await.context(FetchRemoteContentSnafu) } } diff --git a/rust/stackable-cockpitd/src/api_doc.rs b/rust/stackable-cockpitd/src/api_doc.rs index 169f03b1..53cf3c6d 100644 --- a/rust/stackable-cockpitd/src/api_doc.rs +++ b/rust/stackable-cockpitd/src/api_doc.rs @@ -1,5 +1,5 @@ use stackable_cockpit::{ - common::ManifestSpec, + common::manifest::ManifestSpec, platform::{ cluster::ResourceRequests, demo::DemoSpecV2, release::ReleaseSpec, stacklet::Stacklet, }, diff --git a/rust/stackablectl/src/args/cluster.rs b/rust/stackablectl/src/args/cluster.rs index eca7cd1c..7845bb10 100644 --- a/rust/stackablectl/src/args/cluster.rs +++ b/rust/stackablectl/src/args/cluster.rs @@ -3,16 +3,19 @@ use snafu::{ensure, ResultExt, Snafu}; use stackable_cockpit::{ constants::DEFAULT_LOCAL_CLUSTER_NAME, - engine::{KindCluster, KindClusterError, MinikubeCluster, MinikubeClusterError}, + engine::{ + kind::{self, KindCluster}, + minikube::{self, MinikubeCluster}, + }, }; #[derive(Debug, Snafu)] pub enum CommonClusterArgsError { #[snafu(display("failed to create kind cluster"))] - KindClusterError { source: KindClusterError }, + KindClusterError { source: kind::Error }, #[snafu(display("minikube cluster error"))] - MinikubeClusterError { source: MinikubeClusterError }, + MinikubeClusterError { source: minikube::Error }, #[snafu(display( "invalid total node count - at least two nodes in total are needed to run a local cluster" diff --git a/rust/stackablectl/src/cmds/demo.rs b/rust/stackablectl/src/cmds/demo.rs index dc529c5a..682451a9 100644 --- a/rust/stackablectl/src/cmds/demo.rs +++ b/rust/stackablectl/src/cmds/demo.rs @@ -7,11 +7,11 @@ use snafu::{ResultExt, Snafu}; use tracing::{debug, info, instrument}; use stackable_cockpit::{ - common::ListError, + common::list, constants::{DEFAULT_OPERATOR_NAMESPACE, DEFAULT_PRODUCT_NAMESPACE}, platform::{ demo::{DemoError, DemoList}, - namespace::{self, NamespaceError}, + namespace::{self}, release::ReleaseList, stack::StackList, }, @@ -125,7 +125,7 @@ pub enum CmdError { NoSuchStack { name: String }, #[snafu(display("list error"))] - ListError { source: ListError }, + ListError { source: list::Error }, #[snafu(display("demo error"))] DemoError { source: DemoError }, @@ -141,7 +141,7 @@ pub enum CmdError { #[snafu(display("failed to create namespace '{namespace}'"))] NamespaceError { - source: NamespaceError, + source: namespace::Error, namespace: String, }, } diff --git a/rust/stackablectl/src/cmds/operator.rs b/rust/stackablectl/src/cmds/operator.rs index d93b4c17..12aa7bd9 100644 --- a/rust/stackablectl/src/cmds/operator.rs +++ b/rust/stackablectl/src/cmds/operator.rs @@ -17,7 +17,7 @@ use stackable_cockpit::{ }, helm::{self, HelmError, HelmRelease, HelmRepo}, platform::{ - namespace::{self, NamespaceError}, + namespace::{self, Error}, operator::{OperatorSpec, VALID_OPERATORS}, }, utils, @@ -145,10 +145,7 @@ pub enum CmdError { JsonOutputFormatError { source: serde_json::Error }, #[snafu(display("failed to create namespace '{namespace}'"))] - NamespaceError { - source: NamespaceError, - namespace: String, - }, + NamespaceError { source: Error, namespace: String }, } /// This list contains a list of operator version grouped by stable, test and diff --git a/rust/stackablectl/src/cmds/release.rs b/rust/stackablectl/src/cmds/release.rs index 4d99de94..7efb3abd 100644 --- a/rust/stackablectl/src/cmds/release.rs +++ b/rust/stackablectl/src/cmds/release.rs @@ -7,10 +7,10 @@ use snafu::{ResultExt, Snafu}; use tracing::{debug, info, instrument}; use stackable_cockpit::{ - common::ListError, + common::list, constants::DEFAULT_OPERATOR_NAMESPACE, platform::{ - namespace::{self, NamespaceError}, + namespace::{self, Error}, release::{ReleaseInstallError, ReleaseList, ReleaseUninstallError}, }, utils::path::PathOrUrlParseError, @@ -107,7 +107,7 @@ pub enum CmdError { PathOrUrlParseError { source: PathOrUrlParseError }, #[snafu(display("list error"))] - ListError { source: ListError }, + ListError { source: list::Error }, #[snafu(display("release install error"))] ReleaseInstallError { source: ReleaseInstallError }, @@ -122,10 +122,7 @@ pub enum CmdError { TransferError { source: FileTransferError }, #[snafu(display("failed to create namespace '{namespace}'"))] - NamespaceError { - source: NamespaceError, - namespace: String, - }, + NamespaceError { source: Error, namespace: String }, } impl ReleaseArgs { diff --git a/rust/stackablectl/src/cmds/stack.rs b/rust/stackablectl/src/cmds/stack.rs index 2018ddf9..0639fa90 100644 --- a/rust/stackablectl/src/cmds/stack.rs +++ b/rust/stackablectl/src/cmds/stack.rs @@ -7,10 +7,10 @@ use snafu::{ResultExt, Snafu}; use tracing::{debug, info, instrument}; use stackable_cockpit::{ - common::ListError, + common::list, constants::{DEFAULT_OPERATOR_NAMESPACE, DEFAULT_PRODUCT_NAMESPACE}, platform::{ - namespace::{self, NamespaceError}, + namespace::{self, Error}, release::ReleaseList, stack::{StackError, StackList}, }, @@ -117,7 +117,7 @@ pub enum CmdError { StackError { source: StackError }, #[snafu(display("list error"))] - ListError { source: ListError }, + ListError { source: list::Error }, #[snafu(display("cluster argument error"))] CommonClusterArgsError { source: CommonClusterArgsError }, @@ -126,10 +126,7 @@ pub enum CmdError { TransferError { source: FileTransferError }, #[snafu(display("failed to create namespace '{namespace}'"))] - NamespaceError { - source: NamespaceError, - namespace: String, - }, + NamespaceError { source: Error, namespace: String }, } impl StackArgs { From 7994db32d3a60231f39bf497324e308d65a67e8f Mon Sep 17 00:00:00 2001 From: Techassi Date: Mon, 20 Nov 2023 14:34:34 +0100 Subject: [PATCH 25/40] Update error names, error variant names, struct names --- rust/stackable-cockpit/src/helm.rs | 32 ++++++++--------- .../src/platform/demo/mod.rs | 10 +++--- .../src/platform/demo/spec.rs | 28 +++++++-------- .../src/platform/operator/spec.rs | 34 +++++++++---------- .../stackable-cockpit/src/platform/product.rs | 5 +++ .../src/platform/release/mod.rs | 4 +-- .../src/platform/release/spec.rs | 27 +++++++-------- .../src/platform/stack/mod.rs | 10 +++--- .../src/platform/stack/spec.rs | 32 ++++++++--------- .../src/platform/stacklet/grafana.rs | 4 +-- .../src/platform/stacklet/minio.rs | 4 +-- .../src/platform/stacklet/mod.rs | 27 ++++++++------- .../src/platform/stacklet/opensearch.rs | 4 +-- .../src/platform/stacklet/prometheus.rs | 4 +-- .../src/utils/k8s/conditions.rs | 1 - rust/stackable-cockpit/src/utils/params.rs | 5 +-- rust/stackable-cockpitd/src/api_doc.rs | 6 ++-- rust/stackable-cockpitd/src/handlers/demos.rs | 6 ++-- .../stackable-cockpitd/src/handlers/stacks.rs | 6 ++-- rust/stackablectl/src/cli/mod.rs | 12 +++---- rust/stackablectl/src/cmds/demo.rs | 21 +++++------- rust/stackablectl/src/cmds/operator.rs | 22 ++++++------ rust/stackablectl/src/cmds/release.rs | 16 ++++----- rust/stackablectl/src/cmds/stack.rs | 23 ++++++------- rust/stackablectl/src/cmds/stacklet.rs | 6 ++-- web/src/api/schema.d.ts | 12 +++++-- 26 files changed, 182 insertions(+), 179 deletions(-) diff --git a/rust/stackable-cockpit/src/helm.rs b/rust/stackable-cockpit/src/helm.rs index e881f4d6..6d7bf2a9 100644 --- a/rust/stackable-cockpit/src/helm.rs +++ b/rust/stackable-cockpit/src/helm.rs @@ -20,7 +20,7 @@ pub struct HelmRelease { #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct HelmChart { +pub struct Chart { pub release_name: String, pub name: String, pub repo: HelmChartRepo, @@ -46,7 +46,7 @@ pub struct HelmRepoEntry { } #[derive(Debug, Snafu)] -pub enum HelmError { +pub enum Error { #[snafu(display("failed to parse URL"))] UrlParse { source: url::ParseError }, @@ -199,11 +199,11 @@ pub fn install_release_from_repo( values_yaml: Option<&str>, namespace: &str, suppress_output: bool, -) -> Result { +) -> Result { debug!("Install Helm release from repo"); if check_release_exists(release_name, namespace)? { - let release = get_release(release_name, namespace)?.ok_or(HelmError::InstallRelease { + let release = get_release(release_name, namespace)?.ok_or(Error::InstallRelease { source: HelmInstallReleaseError::NoSuchRelease { name: release_name.to_owned(), }, @@ -222,7 +222,7 @@ pub fn install_release_from_repo( }, ); } else { - return Err(HelmError::InstallRelease { + return Err(Error::InstallRelease { source: HelmInstallReleaseError::ReleaseAlreadyInstalled { requested_version: chart_version.into(), name: release_name.into(), @@ -271,7 +271,7 @@ fn install_release( values_yaml: Option<&str>, namespace: &str, suppress_output: bool, -) -> Result<(), HelmError> { +) -> Result<(), Error> { let result = helm_sys::install_helm_release( release_name, chart_name, @@ -287,7 +287,7 @@ fn install_release( error ); - return Err(HelmError::InstallRelease { + return Err(Error::InstallRelease { source: HelmInstallReleaseError::HelmWrapperError { error }, }); } @@ -301,7 +301,7 @@ pub fn uninstall_release( release_name: &str, namespace: &str, suppress_output: bool, -) -> Result { +) -> Result { debug!("Uninstall Helm release"); if check_release_exists(release_name, namespace)? { @@ -313,7 +313,7 @@ pub fn uninstall_release( err ); - return Err(HelmError::UninstallRelease { error: err }); + return Err(Error::UninstallRelease { error: err }); } return Ok(HelmUninstallReleaseStatus::Uninstalled( @@ -333,7 +333,7 @@ pub fn uninstall_release( /// Returns if a Helm release exists #[instrument] -pub fn check_release_exists(release_name: &str, namespace: &str) -> Result { +pub fn check_release_exists(release_name: &str, namespace: &str) -> Result { debug!("Check if Helm release exists"); // TODO (Techassi): Handle error @@ -342,7 +342,7 @@ pub fn check_release_exists(release_name: &str, namespace: &str) -> Result Result, HelmError> { +pub fn list_releases(namespace: &str) -> Result, Error> { debug!("List Helm releases"); let result = helm_sys::list_helm_releases(namespace); @@ -353,7 +353,7 @@ pub fn list_releases(namespace: &str) -> Result, HelmError> { err ); - return Err(HelmError::ListReleases { error: err }); + return Err(Error::ListReleases { error: err }); } serde_json::from_str(&result).context(DeserializeJsonSnafu) @@ -361,7 +361,7 @@ pub fn list_releases(namespace: &str) -> Result, HelmError> { /// Returns a single Helm release by `release_name`. #[instrument] -pub fn get_release(release_name: &str, namespace: &str) -> Result, HelmError> { +pub fn get_release(release_name: &str, namespace: &str) -> Result, Error> { debug!("Get Helm release"); Ok(list_releases(namespace)? @@ -371,7 +371,7 @@ pub fn get_release(release_name: &str, namespace: &str) -> Result Result<(), HelmError> { +pub fn add_repo(repository_name: &str, repository_url: &str) -> Result<(), Error> { debug!("Add Helm repo"); let result = helm_sys::add_helm_repository(repository_name, repository_url); @@ -382,7 +382,7 @@ pub fn add_repo(repository_name: &str, repository_url: &str) -> Result<(), HelmE err ); - return Err(HelmError::AddRepo { error: err }); + return Err(Error::AddRepo { error: err }); } Ok(()) @@ -390,7 +390,7 @@ pub fn add_repo(repository_name: &str, repository_url: &str) -> Result<(), HelmE /// Retrieves the Helm index file from the repository URL. #[instrument] -pub async fn get_helm_index(repo_url: T) -> Result +pub async fn get_helm_index(repo_url: T) -> Result where T: AsRef + std::fmt::Debug, { diff --git a/rust/stackable-cockpit/src/platform/demo/mod.rs b/rust/stackable-cockpit/src/platform/demo/mod.rs index 0ffae822..9c9dcb3d 100644 --- a/rust/stackable-cockpit/src/platform/demo/mod.rs +++ b/rust/stackable-cockpit/src/platform/demo/mod.rs @@ -1,7 +1,7 @@ use indexmap::IndexMap; use serde::{Deserialize, Serialize}; -use crate::common::list::{List, SpecIter}; +use crate::common::list::SpecIter; mod spec; @@ -12,13 +12,13 @@ pub use spec::*; #[serde(rename_all = "camelCase")] pub struct DemosV2 { #[serde(with = "serde_yaml::with::singleton_map_recursive")] - demos: IndexMap, + demos: IndexMap, } -impl SpecIter for DemosV2 { - fn inner(&self) -> &IndexMap { +impl SpecIter for DemosV2 { + fn inner(&self) -> &IndexMap { &self.demos } } -pub type DemoList = List; +pub type List = crate::common::list::List; diff --git a/rust/stackable-cockpit/src/platform/demo/spec.rs b/rust/stackable-cockpit/src/platform/demo/spec.rs index dbd7877f..3a8a7431 100644 --- a/rust/stackable-cockpit/src/platform/demo/spec.rs +++ b/rust/stackable-cockpit/src/platform/demo/spec.rs @@ -9,8 +9,8 @@ use crate::{ common::manifest::ManifestSpec, platform::{ cluster::{ResourceRequests, ResourceRequestsError}, - release::ReleaseList, - stack::{StackError, StackList}, + release::List, + stack, }, utils::params::{Parameter, RawParameter, RawParameterParseError}, xfer::FileTransferClient, @@ -21,21 +21,21 @@ pub type RawDemoParameter = RawParameter; pub type DemoParameter = Parameter; #[derive(Debug, Snafu)] -pub enum DemoError { +pub enum Error { #[snafu(display("no stack named '{name}'"))] NoSuchStack { name: String }, #[snafu(display("failed to install stack because some prerequisites failed"))] - StackPrerequisites { source: StackError }, + StackPrerequisites { source: stack::Error }, #[snafu(display("failed to install release associated with stack"))] - StackInstallRelease { source: StackError }, + StackInstallRelease { source: stack::Error }, #[snafu(display("failed to install stack manifests"))] - InstallStackManifests { source: StackError }, + InstallStackManifests { source: stack::Error }, #[snafu(display("failed to install demo manifests"))] - InstallDemoManifests { source: StackError }, + InstallDemoManifests { source: stack::Error }, #[snafu(display("demo resource requests error"), context(false))] DemoResourceRequestsError { source: ResourceRequestsError }, @@ -51,7 +51,7 @@ pub enum DemoError { #[derive(Debug, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] #[cfg_attr(feature = "openapi", derive(ToSchema))] -pub struct DemoSpecV2 { +pub struct DemoSpec { /// A short description of the demo pub description: String, @@ -84,20 +84,20 @@ pub struct DemoSpecV2 { pub parameters: Vec, } -impl DemoSpecV2 { +impl DemoSpec { /// Checks if the prerequisites to run this demo are met. These checks /// include: /// /// - Does the demo support to be installed in the requested namespace? /// - Does the cluster have enough resources available to run this demo? #[instrument(skip_all)] - pub async fn check_prerequisites(&self, product_namespace: &str) -> Result<(), DemoError> { + pub async fn check_prerequisites(&self, product_namespace: &str) -> Result<(), Error> { debug!("Checking prerequisites before installing demo"); // Returns an error if the demo doesn't support to be installed in the // requested namespace if !self.supports_namespace(product_namespace) { - return Err(DemoError::UnsupportedNamespace { + return Err(Error::UnsupportedNamespace { requested: product_namespace.to_string(), supported: self.supported_namespaces.clone(), }); @@ -124,15 +124,15 @@ impl DemoSpecV2 { #[allow(clippy::too_many_arguments)] pub async fn install( &self, - stack_list: StackList, - release_list: ReleaseList, + stack_list: stack::List, + release_list: List, operator_namespace: &str, product_namespace: &str, stack_parameters: &[String], demo_parameters: &[String], transfer_client: &FileTransferClient, skip_release: bool, - ) -> Result<(), DemoError> { + ) -> Result<(), Error> { // Get the stack spec based on the name defined in the demo spec let stack_spec = stack_list.get(&self.stack).context(NoSuchStackSnafu { name: self.stack.clone(), diff --git a/rust/stackable-cockpit/src/platform/operator/spec.rs b/rust/stackable-cockpit/src/platform/operator/spec.rs index d3e9b9e8..32fd095d 100644 --- a/rust/stackable-cockpit/src/platform/operator/spec.rs +++ b/rust/stackable-cockpit/src/platform/operator/spec.rs @@ -29,12 +29,12 @@ pub const VALID_OPERATORS: &[&str] = &[ ]; #[derive(Debug, Snafu)] -pub enum OperatorSpecParseError { +pub enum SpecParseError { #[snafu(display("invalid equal sign count in operator spec, expected one"))] InvalidEqualSignCount, #[snafu(display("failed to parse SemVer version"))] - ParseVersionError { source: semver::Error }, + ParseVersion { source: semver::Error }, #[snafu(display("the operator spec includes '=' but no version was specified"))] MissingVersion, @@ -70,14 +70,14 @@ impl Display for OperatorSpec { } impl FromStr for OperatorSpec { - type Err = OperatorSpecParseError; + type Err = SpecParseError; fn from_str(s: &str) -> Result { let input = s.trim(); // Empty input is not allowed if input.is_empty() { - return Err(OperatorSpecParseError::EmptyInput); + return Err(SpecParseError::EmptyInput); } // Split at each equal sign @@ -87,7 +87,7 @@ impl FromStr for OperatorSpec { // If there are more than 2 equal signs, return error // because of invalid spec format if len > 2 { - return Err(OperatorSpecParseError::InvalidEqualSignCount); + return Err(SpecParseError::InvalidEqualSignCount); } // If there is only one part, the input didn't include @@ -101,11 +101,11 @@ impl FromStr for OperatorSpec { // If there is an equal sign, but no version after if parts[1].is_empty() { - return Err(OperatorSpecParseError::MissingVersion); + return Err(SpecParseError::MissingVersion); } if !VALID_OPERATORS.contains(&parts[0]) { - return Err(OperatorSpecParseError::InvalidName { + return Err(SpecParseError::InvalidName { name: parts[0].to_string(), }); } @@ -121,7 +121,7 @@ impl FromStr for OperatorSpec { } impl TryFrom for OperatorSpec { - type Error = OperatorSpecParseError; + type Error = SpecParseError; fn try_from(value: String) -> Result { Self::from_str(&value) @@ -129,7 +129,7 @@ impl TryFrom for OperatorSpec { } impl TryFrom<&str> for OperatorSpec { - type Error = OperatorSpecParseError; + type Error = SpecParseError; fn try_from(value: &str) -> Result { Self::try_from(value.to_string()) @@ -137,14 +137,14 @@ impl TryFrom<&str> for OperatorSpec { } impl OperatorSpec { - pub fn new(name: T, version: Option) -> Result + pub fn new(name: T, version: Option) -> Result where T: AsRef, { let name = name.as_ref(); if !VALID_OPERATORS.contains(&name) { - return Err(OperatorSpecParseError::InvalidName { + return Err(SpecParseError::InvalidName { name: name.to_string(), }); } @@ -174,7 +174,7 @@ impl OperatorSpec { /// Installs the operator using Helm. #[instrument(skip_all)] - pub fn install(&self, namespace: &str) -> Result<(), helm::HelmError> { + pub fn install(&self, namespace: &str) -> Result<(), helm::Error> { info!("Installing operator {}", self); let version = self.version.as_ref().map(|v| v.to_string()); @@ -200,7 +200,7 @@ impl OperatorSpec { /// Uninstalls the operator using Helm. #[instrument] - pub fn uninstall(&self, namespace: T) -> Result<(), helm::HelmError> + pub fn uninstall(&self, namespace: T) -> Result<(), helm::Error> where T: AsRef + std::fmt::Debug, { @@ -218,7 +218,7 @@ impl OperatorSpec { mod test { use semver::Version; - use crate::platform::operator::{OperatorSpec, OperatorSpecParseError}; + use crate::platform::operator::{OperatorSpec, SpecParseError}; #[test] fn simple_operator_spec() { @@ -246,7 +246,7 @@ mod test { fn empty_operator_spec() { match OperatorSpec::try_from("") { Ok(spec) => panic!("SHOULD FAIL: {spec}"), - Err(err) => assert!(matches!(err, OperatorSpecParseError::EmptyInput)), + Err(err) => assert!(matches!(err, SpecParseError::EmptyInput)), } } @@ -254,7 +254,7 @@ mod test { fn empty_version_operator_spec() { match OperatorSpec::try_from("operator=") { Ok(spec) => panic!("SHOULD FAIL: {spec}"), - Err(err) => assert!(matches!(err, OperatorSpecParseError::MissingVersion)), + Err(err) => assert!(matches!(err, SpecParseError::MissingVersion)), } } @@ -262,7 +262,7 @@ mod test { fn invalid_version_operator_spec() { match OperatorSpec::try_from("operator=1.2.3=") { Ok(spec) => panic!("SHOULD FAIL: {spec}"), - Err(err) => assert!(matches!(err, OperatorSpecParseError::InvalidEqualSignCount)), + Err(err) => assert!(matches!(err, SpecParseError::InvalidEqualSignCount)), } } } diff --git a/rust/stackable-cockpit/src/platform/product.rs b/rust/stackable-cockpit/src/platform/product.rs index b7441115..e243c246 100644 --- a/rust/stackable-cockpit/src/platform/product.rs +++ b/rust/stackable-cockpit/src/platform/product.rs @@ -1,9 +1,14 @@ use semver::Version; use serde::{Deserialize, Serialize}; +#[cfg(feature = "openapi")] +use utoipa::ToSchema; + #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] +#[cfg_attr(feature = "openapi", derive(ToSchema))] pub struct ProductSpec { #[serde(rename = "operatorVersion")] + #[cfg_attr(feature = "openapi", schema(value_type = String))] pub version: Version, } diff --git a/rust/stackable-cockpit/src/platform/release/mod.rs b/rust/stackable-cockpit/src/platform/release/mod.rs index 636c2fe7..8df39f23 100644 --- a/rust/stackable-cockpit/src/platform/release/mod.rs +++ b/rust/stackable-cockpit/src/platform/release/mod.rs @@ -5,7 +5,7 @@ mod spec; pub use spec::*; -use crate::common::list::{List, SpecIter}; +use crate::common::list::SpecIter; #[derive(Debug, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] @@ -20,7 +20,7 @@ impl SpecIter for Releases { } } -pub type ReleaseList = List; +pub type List = crate::common::list::List; #[derive(Default)] pub struct Release {} diff --git a/rust/stackable-cockpit/src/platform/release/spec.rs b/rust/stackable-cockpit/src/platform/release/spec.rs index 01aee2d8..9327837d 100644 --- a/rust/stackable-cockpit/src/platform/release/spec.rs +++ b/rust/stackable-cockpit/src/platform/release/spec.rs @@ -7,26 +7,23 @@ use tracing::{info, instrument}; use utoipa::ToSchema; use crate::{ - helm::{self, HelmError}, - platform::{ - operator::{OperatorSpec, OperatorSpecParseError}, - product::ProductSpec, - }, + helm, + platform::{operator, product}, }; #[derive(Debug, Snafu)] -pub enum ReleaseInstallError { +pub enum InstallError { #[snafu(display("failed to parse operator spec"))] - OperatorSpecParseError { source: OperatorSpecParseError }, + OperatorSpecParse { source: operator::SpecParseError }, #[snafu(display("failed to install release using Helm"))] - HelmInstallError { source: HelmError }, + HelmInstallError { source: helm::Error }, } #[derive(Debug, Snafu)] -pub enum ReleaseUninstallError { +pub enum UninstallError { #[snafu(display("failed to uninstall release using Helm"))] - HelmUninstallError { source: HelmError }, + HelmUninstallError { source: helm::Error }, } #[derive(Clone, Debug, Deserialize, Serialize)] @@ -41,7 +38,7 @@ pub struct ReleaseSpec { pub description: String, /// List of products and their version in this release - pub products: IndexMap, + pub products: IndexMap, } impl ReleaseSpec { @@ -52,14 +49,14 @@ impl ReleaseSpec { include_products: &[String], exclude_products: &[String], namespace: &str, - ) -> Result<(), ReleaseInstallError> { + ) -> Result<(), InstallError> { info!("Installing release"); for (product_name, product) in self.filter_products(include_products, exclude_products) { info!("Installing product {}", product_name); // Create operator spec - let operator = OperatorSpec::new(product_name, Some(product.version.clone())) + let operator = operator::OperatorSpec::new(product_name, Some(product.version.clone())) .context(OperatorSpecParseSnafu)?; // Install operator @@ -69,7 +66,7 @@ impl ReleaseSpec { Ok(()) } - pub fn uninstall(&self, namespace: &str) -> Result<(), ReleaseUninstallError> { + pub fn uninstall(&self, namespace: &str) -> Result<(), UninstallError> { for (product_name, _) in &self.products { helm::uninstall_release(product_name, namespace, true).context(HelmUninstallSnafu)?; } @@ -82,7 +79,7 @@ impl ReleaseSpec { &self, include_products: &[String], exclude_products: &[String], - ) -> Vec<(String, ProductSpec)> { + ) -> Vec<(String, product::ProductSpec)> { self.products .iter() .filter(|(name, _)| include_products.is_empty() || include_products.contains(name)) diff --git a/rust/stackable-cockpit/src/platform/stack/mod.rs b/rust/stackable-cockpit/src/platform/stack/mod.rs index 97463f11..2a6e7a8b 100644 --- a/rust/stackable-cockpit/src/platform/stack/mod.rs +++ b/rust/stackable-cockpit/src/platform/stack/mod.rs @@ -4,20 +4,20 @@ use serde::{Deserialize, Serialize}; mod spec; pub use spec::*; -use crate::common::list::{List, SpecIter}; +use crate::common::list::SpecIter; /// This struct describes a complete demos v2 file #[derive(Debug, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct StacksV2 { #[serde(with = "serde_yaml::with::singleton_map_recursive")] - stacks: IndexMap, + stacks: IndexMap, } -impl SpecIter for StacksV2 { - fn inner(&self) -> &IndexMap { +impl SpecIter for StacksV2 { + fn inner(&self) -> &IndexMap { &self.stacks } } -pub type StackList = List; +pub type List = crate::common::list::List; diff --git a/rust/stackable-cockpit/src/platform/stack/spec.rs b/rust/stackable-cockpit/src/platform/stack/spec.rs index 5210b87b..2ca806de 100644 --- a/rust/stackable-cockpit/src/platform/stack/spec.rs +++ b/rust/stackable-cockpit/src/platform/stack/spec.rs @@ -9,11 +9,11 @@ use utoipa::ToSchema; use crate::{ common::manifest::ManifestSpec, - helm::{self, HelmChart, HelmError}, + helm, platform::{ cluster::{ResourceRequests, ResourceRequestsError}, demo::DemoParameter, - release::{ReleaseInstallError, ReleaseList}, + release::{InstallError, List}, }, utils::{ k8s::{KubeClient, KubeClientError}, @@ -33,7 +33,7 @@ pub type RawStackParameter = RawParameter; pub type StackParameter = Parameter; #[derive(Debug, Snafu)] -pub enum StackError { +pub enum Error { /// This error indicates that parsing a string into stack / demo parameters /// failed. #[snafu(display("failed to parse demo / stack parameters"))] @@ -46,13 +46,13 @@ pub enum StackError { /// This error indicates that the release failed to install. #[snafu(display("failed to install release"))] - ReleaseInstallError { source: ReleaseInstallError }, + ReleaseInstallError { source: InstallError }, /// This error indicates that the Helm wrapper failed to add the Helm /// repository. #[snafu(display("failed to add Helm repository {repo_name}"))] HelmAddRepositoryError { - source: HelmError, + source: helm::Error, repo_name: String, }, @@ -61,7 +61,7 @@ pub enum StackError { #[snafu(display("failed to install Helm release {release_name}"))] HelmInstallReleaseError { release_name: String, - source: HelmError, + source: helm::Error, }, /// This error indicates that the creation of a kube client failed. @@ -104,7 +104,7 @@ pub enum StackError { #[derive(Debug, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] #[cfg_attr(feature = "openapi", derive(ToSchema))] -pub struct StackSpecV2 { +pub struct StackSpec { /// A short description of the demo pub description: String, @@ -137,14 +137,14 @@ pub struct StackSpecV2 { pub parameters: Vec, } -impl StackSpecV2 { +impl StackSpec { /// Checks if the prerequisites to run this stack are met. These checks /// include: /// /// - Does the stack support to be installed in the requested namespace? /// - Does the cluster have enough resources available to run this stack? #[instrument(skip_all)] - pub async fn check_prerequisites(&self, product_namespace: &str) -> Result<(), StackError> { + pub async fn check_prerequisites(&self, product_namespace: &str) -> Result<(), Error> { debug!("Checking prerequisites before installing stack"); // Returns an error if the stack doesn't support to be installed in the @@ -152,7 +152,7 @@ impl StackSpecV2 { // already done on the demo spec level, however we still need to check // here, as stacks can be installed on their own. if !self.supports_namespace(product_namespace) { - return Err(StackError::UnsupportedNamespace { + return Err(Error::UnsupportedNamespace { supported: self.supported_namespaces.clone(), requested: product_namespace.to_string(), }); @@ -179,10 +179,10 @@ impl StackSpecV2 { #[instrument(skip(self, release_list))] pub async fn install_release( &self, - release_list: ReleaseList, + release_list: List, operator_namespace: &str, product_namespace: &str, - ) -> Result<(), StackError> { + ) -> Result<(), Error> { info!("Trying to install release {}", self.release); // Get the release by name @@ -206,7 +206,7 @@ impl StackSpecV2 { parameters: &[String], product_namespace: &str, transfer_client: &FileTransferClient, - ) -> Result<(), StackError> { + ) -> Result<(), Error> { info!("Installing stack manifests"); let parameters = parameters @@ -232,7 +232,7 @@ impl StackSpecV2 { demo_parameters: &[String], product_namespace: &str, transfer_client: &FileTransferClient, - ) -> Result<(), StackError> { + ) -> Result<(), Error> { info!("Installing demo manifests"); let parameters = demo_parameters @@ -251,7 +251,7 @@ impl StackSpecV2 { parameters: &HashMap, product_namespace: &str, transfer_client: &FileTransferClient, - ) -> Result<(), StackError> { + ) -> Result<(), Error> { debug!("Installing demo / stack manifests"); for manifest in manifests { @@ -264,7 +264,7 @@ impl StackSpecV2 { path_or_url: helm_file.clone(), })?; - let helm_chart: HelmChart = transfer_client + let helm_chart: helm::Chart = transfer_client .get(&helm_file, &Template::new(parameters).then(Yaml::new())) .await .context(TransferSnafu)?; diff --git a/rust/stackable-cockpit/src/platform/stacklet/grafana.rs b/rust/stackable-cockpit/src/platform/stacklet/grafana.rs index fc4f21fc..b899d546 100644 --- a/rust/stackable-cockpit/src/platform/stacklet/grafana.rs +++ b/rust/stackable-cockpit/src/platform/stacklet/grafana.rs @@ -4,7 +4,7 @@ use snafu::ResultExt; use crate::{ platform::{ service::get_service_endpoint_urls, - stacklet::{KubeClientFetchSnafu, ServiceSnafu, Stacklet, StackletError}, + stacklet::{Error, KubeClientFetchSnafu, ServiceSnafu, Stacklet}, }, utils::k8s::{KubeClient, ListParamsExt, ProductLabel}, }; @@ -12,7 +12,7 @@ use crate::{ pub(super) async fn list( kube_client: &KubeClient, namespace: Option<&str>, -) -> Result, StackletError> { +) -> Result, Error> { let mut stacklets = Vec::new(); let params = ListParams::from_product("grafana", None, ProductLabel::Name); diff --git a/rust/stackable-cockpit/src/platform/stacklet/minio.rs b/rust/stackable-cockpit/src/platform/stacklet/minio.rs index 2c204c60..fb9cef2d 100644 --- a/rust/stackable-cockpit/src/platform/stacklet/minio.rs +++ b/rust/stackable-cockpit/src/platform/stacklet/minio.rs @@ -4,7 +4,7 @@ use snafu::ResultExt; use crate::{ platform::{ service::get_service_endpoint_urls, - stacklet::{KubeClientFetchSnafu, ServiceSnafu, Stacklet, StackletError}, + stacklet::{Error, KubeClientFetchSnafu, ServiceSnafu, Stacklet}, }, utils::k8s::KubeClient, }; @@ -12,7 +12,7 @@ use crate::{ pub(super) async fn list( kube_client: &KubeClient, namespace: Option<&str>, -) -> Result, StackletError> { +) -> Result, Error> { let mut stacklets = Vec::new(); // The helm-chart uses `app` instead of `app.kubernetes.io/app`, so we can't use `ListParams::from_product` here diff --git a/rust/stackable-cockpit/src/platform/stacklet/mod.rs b/rust/stackable-cockpit/src/platform/stacklet/mod.rs index 86a3e4b0..f017e2e2 100644 --- a/rust/stackable-cockpit/src/platform/stacklet/mod.rs +++ b/rust/stackable-cockpit/src/platform/stacklet/mod.rs @@ -11,7 +11,7 @@ use utoipa::ToSchema; use crate::{ constants::PRODUCT_NAMES, platform::{ - credentials::{get_credentials, Credentials, Error}, + credentials, service::{get_service_endpoints, ServiceError}, }, utils::{ @@ -26,8 +26,8 @@ mod opensearch; mod prometheus; #[derive(Debug, Serialize)] -#[cfg_attr(feature = "openapi", derive(ToSchema))] #[serde(rename_all = "camelCase")] +#[cfg_attr(feature = "openapi", derive(ToSchema))] pub struct Stacklet { /// Name of the stacklet. pub name: String, @@ -47,7 +47,7 @@ pub struct Stacklet { } #[derive(Debug, Snafu)] -pub enum StackletError { +pub enum Error { #[snafu(display("failed to create kubernetes client"))] KubeClientCreateError { source: KubeClientError }, @@ -68,7 +68,7 @@ pub enum StackletError { /// namespaces are returned. If `namespace` is [`Some`], only stacklets installed /// in the specified namespace are returned. The `options` allow further /// customization of the returned information. -pub async fn list_stacklets(namespace: Option<&str>) -> Result, StackletError> { +pub async fn list_stacklets(namespace: Option<&str>) -> Result, Error> { let kube_client = KubeClient::new().await.context(KubeClientCreateSnafu)?; let mut stacklets = list_stackable_stacklets(&kube_client, namespace).await?; @@ -84,7 +84,7 @@ pub async fn get_credentials_for_product( namespace: &str, object_name: &str, product_name: &str, -) -> Result, StackletError> { +) -> Result, Error> { let kube_client = KubeClient::new().await.context(KubeClientCreateSnafu)?; let product_gvk = gvk_from_product_name(product_name); @@ -102,13 +102,14 @@ pub async fn get_credentials_for_product( } }; - let credentials = match get_credentials(&kube_client, product_name, &product_cluster).await { - Ok(credentials) => credentials, - Err(Error::NoSecret) => None, - Err(Error::KubeClientFetchError { source }) => { - return Err(StackletError::KubeClientFetchError { source }) - } - }; + let credentials = + match credentials::get_credentials(&kube_client, product_name, &product_cluster).await { + Ok(credentials) => credentials, + Err(credentials::Error::NoSecret) => None, + Err(credentials::Error::KubeClientFetchError { source }) => { + return Err(Error::KubeClientFetchError { source }) + } + }; Ok(credentials) } @@ -116,7 +117,7 @@ pub async fn get_credentials_for_product( async fn list_stackable_stacklets( kube_client: &KubeClient, namespace: Option<&str>, -) -> Result, StackletError> { +) -> Result, Error> { let product_list = build_products_gvk_list(PRODUCT_NAMES); let mut stacklets = Vec::new(); diff --git a/rust/stackable-cockpit/src/platform/stacklet/opensearch.rs b/rust/stackable-cockpit/src/platform/stacklet/opensearch.rs index d5497f2b..c604e316 100644 --- a/rust/stackable-cockpit/src/platform/stacklet/opensearch.rs +++ b/rust/stackable-cockpit/src/platform/stacklet/opensearch.rs @@ -4,7 +4,7 @@ use snafu::ResultExt; use crate::{ platform::{ service::get_service_endpoint_urls, - stacklet::{KubeClientFetchSnafu, ServiceSnafu, Stacklet, StackletError}, + stacklet::{Error, KubeClientFetchSnafu, ServiceSnafu, Stacklet}, }, utils::k8s::{KubeClient, ListParamsExt, ProductLabel}, }; @@ -12,7 +12,7 @@ use crate::{ pub(super) async fn list( kube_client: &KubeClient, namespace: Option<&str>, -) -> Result, StackletError> { +) -> Result, Error> { let mut stacklets = Vec::new(); let params = ListParams::from_product("opensearch-dashboards", None, ProductLabel::Name); diff --git a/rust/stackable-cockpit/src/platform/stacklet/prometheus.rs b/rust/stackable-cockpit/src/platform/stacklet/prometheus.rs index 3d46baf2..d39358d2 100644 --- a/rust/stackable-cockpit/src/platform/stacklet/prometheus.rs +++ b/rust/stackable-cockpit/src/platform/stacklet/prometheus.rs @@ -4,7 +4,7 @@ use snafu::ResultExt; use crate::{ platform::{ service::get_service_endpoint_urls, - stacklet::{KubeClientFetchSnafu, ServiceSnafu, Stacklet, StackletError}, + stacklet::{Error, KubeClientFetchSnafu, ServiceSnafu, Stacklet}, }, utils::k8s::KubeClient, }; @@ -12,7 +12,7 @@ use crate::{ pub(super) async fn list( kube_client: &KubeClient, namespace: Option<&str>, -) -> Result, StackletError> { +) -> Result, Error> { let mut stacklets = Vec::new(); // The helm-chart uses `app` instead of `app.kubernetes.io/app`, so we can't use `ListParams::from_product` here diff --git a/rust/stackable-cockpit/src/utils/k8s/conditions.rs b/rust/stackable-cockpit/src/utils/k8s/conditions.rs index 71b3945a..e0a36099 100644 --- a/rust/stackable-cockpit/src/utils/k8s/conditions.rs +++ b/rust/stackable-cockpit/src/utils/k8s/conditions.rs @@ -3,7 +3,6 @@ use k8s_openapi::{ apimachinery::pkg::apis::meta::v1::Condition, }; use serde::Serialize; - use stackable_operator::status::condition::ClusterCondition; #[cfg(feature = "openapi")] diff --git a/rust/stackable-cockpit/src/utils/params.rs b/rust/stackable-cockpit/src/utils/params.rs index 56e2f6e4..112ca018 100644 --- a/rust/stackable-cockpit/src/utils/params.rs +++ b/rust/stackable-cockpit/src/utils/params.rs @@ -10,10 +10,11 @@ use snafu::{ensure, ResultExt, Snafu}; #[cfg(feature = "openapi")] use utoipa::ToSchema; -/// Parameter descibes a common parameter format. This format is used in demo and stack definitions +/// Parameter descibes a common parameter format. This format is used in demo +/// and stack definitions. #[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] #[cfg_attr(feature = "openapi", derive(ToSchema))] +#[serde(rename_all = "camelCase")] pub struct Parameter { /// Parameter description pub description: String, diff --git a/rust/stackable-cockpitd/src/api_doc.rs b/rust/stackable-cockpitd/src/api_doc.rs index 53cf3c6d..87406159 100644 --- a/rust/stackable-cockpitd/src/api_doc.rs +++ b/rust/stackable-cockpitd/src/api_doc.rs @@ -1,7 +1,7 @@ use stackable_cockpit::{ common::manifest::ManifestSpec, platform::{ - cluster::ResourceRequests, demo::DemoSpecV2, release::ReleaseSpec, stacklet::Stacklet, + cluster::ResourceRequests, demo, product::ProductSpec, release, stacklet::Stacklet, }, utils::{k8s::DisplayCondition, params::Parameter}, }; @@ -32,9 +32,9 @@ use crate::{ middleware::authentication::log_in, ), components(schemas( - DemoSpecV2, ManifestSpec, Parameter, ReleaseSpec, + demo::DemoSpec, ManifestSpec, Parameter, release::ReleaseSpec, Stacklet, DisplayCondition, synthetic_types::ObjectMeta, - Session, SessionToken, ResourceRequests + Session, SessionToken, ResourceRequests, ProductSpec )) )] struct ApiDoc {} diff --git a/rust/stackable-cockpitd/src/handlers/demos.rs b/rust/stackable-cockpitd/src/handlers/demos.rs index c52ae35f..f963599d 100644 --- a/rust/stackable-cockpitd/src/handlers/demos.rs +++ b/rust/stackable-cockpitd/src/handlers/demos.rs @@ -1,5 +1,5 @@ use axum::{extract::Path, routing::get, Json, Router}; -use stackable_cockpit::platform::demo::DemoSpecV2; +use stackable_cockpit::platform::demo::DemoSpec; /// Creates the demo sub-router. pub fn router() -> Router { @@ -13,7 +13,7 @@ pub fn router() -> Router { (status = 200, description = "Retrieving a list of demos succeeded", body = [DemoSpecV2]), (status = 404, description = "Retrieving a list of demos failed") ))] -pub async fn get_demos() -> Json> { +pub async fn get_demos() -> Json> { todo!() } @@ -22,6 +22,6 @@ pub async fn get_demos() -> Json> { (status = 200, description = "Retrieving the demo with 'name' succeeded", body = DemoSpecV2), (status = 404, description = "Retrieving the demo with 'name' failed") ))] -pub async fn get_demo(Path(_name): Path) -> Json { +pub async fn get_demo(Path(_name): Path) -> Json { todo!() } diff --git a/rust/stackable-cockpitd/src/handlers/stacks.rs b/rust/stackable-cockpitd/src/handlers/stacks.rs index b478cafd..acdd0a37 100644 --- a/rust/stackable-cockpitd/src/handlers/stacks.rs +++ b/rust/stackable-cockpitd/src/handlers/stacks.rs @@ -1,5 +1,5 @@ use axum::{extract::Path, routing::get, Json, Router}; -use stackable_cockpit::platform::stack::StackSpecV2; +use stackable_cockpit::platform::stack::StackSpec; /// Creates the stack sub-router. pub fn router() -> Router { @@ -9,11 +9,11 @@ pub fn router() -> Router { } /// Retrieves all stacks. -pub async fn get_stacks() -> Json> { +pub async fn get_stacks() -> Json> { todo!() } /// Retrieves one stack identified by `stack_name`. -pub async fn get_stack(Path(_stack_name): Path) -> Json { +pub async fn get_stack(Path(_stack_name): Path) -> Json { todo!() } diff --git a/rust/stackablectl/src/cli/mod.rs b/rust/stackablectl/src/cli/mod.rs index c7311de4..6cde08e7 100644 --- a/rust/stackablectl/src/cli/mod.rs +++ b/rust/stackablectl/src/cli/mod.rs @@ -7,8 +7,8 @@ use tracing::{debug, instrument, Level}; use stackable_cockpit::{ constants::{HELM_REPO_NAME_DEV, HELM_REPO_NAME_STABLE, HELM_REPO_NAME_TEST}, - helm::{self, HelmError}, - platform::demo::DemoList, + helm, + platform::demo::List, utils::path::{ IntoPathOrUrl, IntoPathsOrUrls, ParsePathsOrUrls, PathOrUrl, PathOrUrlParseError, }, @@ -50,7 +50,7 @@ pub enum Error { Cache { source: cache::CmdError }, #[snafu(display("helm error"))] - Helm { source: HelmError }, + Helm { source: helm::Error }, } #[derive(Debug, Parser)] @@ -98,9 +98,9 @@ impl Cli { Ok(files) } - pub async fn get_demo_list(&self, transfer_client: &FileTransferClient) -> DemoList { + pub async fn get_demo_list(&self, transfer_client: &FileTransferClient) -> List { let files = self.get_demo_files().unwrap(); - DemoList::build(&files, transfer_client).await.unwrap() + List::build(&files, transfer_client).await.unwrap() } /// Returns a list of stack files, consisting of entries which are either a path or URL. The list of files combines @@ -130,7 +130,7 @@ impl Cli { /// Adds the default (or custom) Helm repository URLs. Internally this calls the Helm SDK written in Go through the /// `go-helm-wrapper`. #[instrument] - pub fn add_helm_repos(&self) -> Result<(), HelmError> { + pub fn add_helm_repos(&self) -> Result<(), helm::Error> { debug!("Add Helm repos"); // Stable repository diff --git a/rust/stackablectl/src/cmds/demo.rs b/rust/stackablectl/src/cmds/demo.rs index 682451a9..562d39dc 100644 --- a/rust/stackablectl/src/cmds/demo.rs +++ b/rust/stackablectl/src/cmds/demo.rs @@ -9,12 +9,7 @@ use tracing::{debug, info, instrument}; use stackable_cockpit::{ common::list, constants::{DEFAULT_OPERATOR_NAMESPACE, DEFAULT_PRODUCT_NAMESPACE}, - platform::{ - demo::{DemoError, DemoList}, - namespace::{self}, - release::ReleaseList, - stack::StackList, - }, + platform::{demo, namespace, release, stack}, utils::path::PathOrUrlParseError, xfer::{cache::Cache, FileTransferClient, FileTransferError}, }; @@ -128,7 +123,7 @@ pub enum CmdError { ListError { source: list::Error }, #[snafu(display("demo error"))] - DemoError { source: DemoError }, + DemoError { source: demo::Error }, #[snafu(display("path/url parse error"))] PathOrUrlParseError { source: PathOrUrlParseError }, @@ -157,7 +152,7 @@ impl DemoArgs { // STACKABLE_DEMO_FILES env variable or the --demo-files CLI argument. let files = cli.get_demo_files().context(PathOrUrlParseSnafu)?; - let list = DemoList::build(&files, &transfer_client) + let list = demo::List::build(&files, &transfer_client) .await .context(ListSnafu)?; @@ -171,7 +166,7 @@ impl DemoArgs { /// Print out a list of demos, either as a table (plain), JSON or YAML #[instrument] -async fn list_cmd(args: &DemoListArgs, cli: &Cli, list: DemoList) -> Result { +async fn list_cmd(args: &DemoListArgs, cli: &Cli, list: demo::List) -> Result { info!("Listing demos"); match args.output_type { @@ -218,7 +213,7 @@ async fn list_cmd(args: &DemoListArgs, cli: &Cli, list: DemoList) -> Result Result { info!("Describing demo {}", args.demo_name); @@ -265,7 +260,7 @@ async fn describe_cmd( async fn install_cmd( args: &DemoInstallArgs, cli: &Cli, - list: DemoList, + list: demo::List, transfer_client: &FileTransferClient, ) -> Result { info!("Installing demo {}", args.demo_name); @@ -280,13 +275,13 @@ async fn install_cmd( // TODO (Techassi): Try to move all this boilerplate code to build the lists out of here let files = cli.get_stack_files().context(PathOrUrlParseSnafu)?; - let stack_list = StackList::build(&files, transfer_client) + let stack_list = stack::List::build(&files, transfer_client) .await .context(ListSnafu)?; let files = cli.get_release_files().context(PathOrUrlParseSnafu)?; - let release_list = ReleaseList::build(&files, transfer_client) + let release_list = release::List::build(&files, transfer_client) .await .context(ListSnafu)?; diff --git a/rust/stackablectl/src/cmds/operator.rs b/rust/stackablectl/src/cmds/operator.rs index 12aa7bd9..6e3813f6 100644 --- a/rust/stackablectl/src/cmds/operator.rs +++ b/rust/stackablectl/src/cmds/operator.rs @@ -15,11 +15,8 @@ use stackable_cockpit::{ constants::{ DEFAULT_OPERATOR_NAMESPACE, HELM_REPO_NAME_DEV, HELM_REPO_NAME_STABLE, HELM_REPO_NAME_TEST, }, - helm::{self, HelmError, HelmRelease, HelmRepo}, - platform::{ - namespace::{self, Error}, - operator::{OperatorSpec, VALID_OPERATORS}, - }, + helm::{self, HelmRelease, HelmRepo}, + platform::{namespace, operator}, utils, }; @@ -90,7 +87,7 @@ values are: Use \"stackablectl operator list\" to list available versions for all operators Use \"stackablectl operator describe \" to get available versions for one operator")] - operators: Vec, + operators: Vec, /// Namespace in the cluster used to deploy the operators #[arg(long, default_value = DEFAULT_OPERATOR_NAMESPACE, visible_aliases(["operator-ns"]))] @@ -104,7 +101,7 @@ Use \"stackablectl operator describe \" to get available versions for pub struct OperatorUninstallArgs { /// One or more operators to uninstall #[arg(required = true)] - operators: Vec, + operators: Vec, /// Namespace in the cluster used to deploy the operators #[arg(long, default_value = DEFAULT_OPERATOR_NAMESPACE, visible_aliases(["operator-ns"]))] @@ -130,7 +127,7 @@ pub enum CmdError { UnknownRepoNameError { name: String }, #[snafu(display("Helm error"))] - HelmError { source: HelmError }, + HelmError { source: helm::Error }, #[snafu(display("cluster argument error"))] CommonClusterArgsError { source: CommonClusterArgsError }, @@ -145,7 +142,10 @@ pub enum CmdError { JsonOutputFormatError { source: serde_json::Error }, #[snafu(display("failed to create namespace '{namespace}'"))] - NamespaceError { source: Error, namespace: String }, + NamespaceError { + source: namespace::Error, + namespace: String, + }, } /// This list contains a list of operator version grouped by stable, test and @@ -359,7 +359,7 @@ fn installed_cmd(args: &OperatorInstalledArgs, cli: &Cli) -> Result Result { info!("Listing releases"); @@ -204,7 +204,7 @@ async fn list_cmd( async fn describe_cmd( args: &ReleaseDescribeArgs, cli: &Cli, - release_list: ReleaseList, + release_list: List, ) -> Result { info!("Describing release"); @@ -260,7 +260,7 @@ async fn describe_cmd( async fn install_cmd( args: &ReleaseInstallArgs, cli: &Cli, - release_list: ReleaseList, + release_list: List, ) -> Result { info!("Installing release"); @@ -310,7 +310,7 @@ async fn install_cmd( async fn uninstall_cmd( args: &ReleaseUninstallArgs, cli: &Cli, - release_list: ReleaseList, + release_list: List, ) -> Result { info!("Installing release"); diff --git a/rust/stackablectl/src/cmds/stack.rs b/rust/stackablectl/src/cmds/stack.rs index 0639fa90..e1b17efc 100644 --- a/rust/stackablectl/src/cmds/stack.rs +++ b/rust/stackablectl/src/cmds/stack.rs @@ -9,11 +9,7 @@ use tracing::{debug, info, instrument}; use stackable_cockpit::{ common::list, constants::{DEFAULT_OPERATOR_NAMESPACE, DEFAULT_PRODUCT_NAMESPACE}, - platform::{ - namespace::{self, Error}, - release::ReleaseList, - stack::{StackError, StackList}, - }, + platform::{namespace, release, stack}, utils::path::PathOrUrlParseError, xfer::{cache::Cache, FileTransferClient, FileTransferError}, }; @@ -114,7 +110,7 @@ pub enum CmdError { JsonOutputFormatError { source: serde_json::Error }, #[snafu(display("stack error"))] - StackError { source: StackError }, + StackError { source: stack::Error }, #[snafu(display("list error"))] ListError { source: list::Error }, @@ -126,7 +122,10 @@ pub enum CmdError { TransferError { source: FileTransferError }, #[snafu(display("failed to create namespace '{namespace}'"))] - NamespaceError { source: Error, namespace: String }, + NamespaceError { + source: namespace::Error, + namespace: String, + }, } impl StackArgs { @@ -136,7 +135,7 @@ impl StackArgs { let transfer_client = FileTransferClient::new_with(cache); let files = cli.get_stack_files().context(PathOrUrlParseSnafu)?; - let stack_list = StackList::build(&files, &transfer_client) + let stack_list = stack::List::build(&files, &transfer_client) .await .context(ListSnafu)?; @@ -151,7 +150,7 @@ impl StackArgs { } #[instrument] -fn list_cmd(args: &StackListArgs, cli: &Cli, stack_list: StackList) -> Result { +fn list_cmd(args: &StackListArgs, cli: &Cli, stack_list: stack::List) -> Result { info!("Listing stacks"); match args.output_type { @@ -196,7 +195,7 @@ fn list_cmd(args: &StackListArgs, cli: &Cli, stack_list: StackList) -> Result Result { info!("Describing stack {}", args.stack_name); @@ -253,14 +252,14 @@ fn describe_cmd( async fn install_cmd( args: &StackInstallArgs, cli: &Cli, - stack_list: StackList, + stack_list: stack::List, transfer_client: &FileTransferClient, ) -> Result { info!("Installing stack {}", args.stack_name); let files = cli.get_release_files().context(PathOrUrlParseSnafu)?; - let release_list = ReleaseList::build(&files, transfer_client) + let release_list = release::List::build(&files, transfer_client) .await .context(ListSnafu)?; diff --git a/rust/stackablectl/src/cmds/stacklet.rs b/rust/stackablectl/src/cmds/stacklet.rs index 9fd51429..98fabfec 100644 --- a/rust/stackablectl/src/cmds/stacklet.rs +++ b/rust/stackablectl/src/cmds/stacklet.rs @@ -8,7 +8,7 @@ use tracing::{info, instrument}; use stackable_cockpit::{ constants::DEFAULT_PRODUCT_NAMESPACE, - platform::stacklet::{get_credentials_for_product, list_stacklets, StackletError}, + platform::stacklet::{get_credentials_for_product, list_stacklets, Error}, utils::k8s::DisplayCondition, }; @@ -66,10 +66,10 @@ pub struct StackletListArgs { #[derive(Debug, Snafu)] pub enum CmdError { #[snafu(display("failed to list stacklets"))] - StackletListError { source: StackletError }, + StackletListError { source: Error }, #[snafu(display("failed to retrieve credentials for stacklet"))] - StackletCredentialsError { source: StackletError }, + StackletCredentialsError { source: Error }, #[snafu(display("unable to format YAML output"))] YamlOutputFormatError { source: serde_yaml::Error }, diff --git a/web/src/api/schema.d.ts b/web/src/api/schema.d.ts index 755fa0c7..ac8d6907 100644 --- a/web/src/api/schema.d.ts +++ b/web/src/api/schema.d.ts @@ -58,7 +58,7 @@ export type webhooks = Record; export interface components { schemas: { /** @description This struct describes a demo with the v2 spec */ - DemoSpecV2: { + DemoSpec: { /** @description A short description of the demo */ description: string; /** @description An optional link to a documentation page */ @@ -92,7 +92,10 @@ export interface components { name: string; namespace: string; }; - /** @description Parameter descibes a common parameter format. This format is used in demo and stack definitions */ + /** + * @description Parameter descibes a common parameter format. This format is used in demo + * and stack definitions. + */ Parameter: { /** @description Parameter default value */ default: string; @@ -101,12 +104,15 @@ export interface components { /** @description Parameter name */ name: string; }; + ProductSpec: { + operatorVersion: string; + }; ReleaseSpec: { /** @description A short description of this release */ description: string; /** @description List of products and their version in this release */ products: { - [key: string]: components["schemas"]["ProductSpec"]; + [key: string]: components["schemas"]["product.ProductSpec"]; }; /** @description Date this released was released */ releaseDate: string; From 97f687469346abe969dae6d1eb2f8a4c14d4d701 Mon Sep 17 00:00:00 2001 From: Techassi Date: Mon, 20 Nov 2023 15:52:21 +0100 Subject: [PATCH 26/40] Rename more enums and structs --- rust/stackable-cockpit/src/common/list.rs | 6 +- rust/stackable-cockpit/src/engine/kind/mod.rs | 4 +- .../src/engine/minikube/mod.rs | 4 +- rust/stackable-cockpit/src/helm.rs | 80 +++--- .../src/platform/cluster/resource_request.rs | 8 +- .../src/platform/credentials.rs | 8 +- .../src/platform/demo/spec.rs | 4 +- .../src/platform/namespace.rs | 10 +- .../src/platform/operator/mod.rs | 269 +++++++++++++++++- .../src/platform/operator/spec.rs | 268 ----------------- .../src/platform/release/spec.rs | 11 +- .../stackable-cockpit/src/platform/service.rs | 42 +-- .../src/platform/stack/spec.rs | 24 +- .../src/platform/stacklet/grafana.rs | 8 +- .../src/platform/stacklet/minio.rs | 8 +- .../src/platform/stacklet/mod.rs | 38 ++- .../src/platform/stacklet/opensearch.rs | 8 +- .../src/platform/stacklet/prometheus.rs | 8 +- .../stackable-cockpit/src/utils/k8s/client.rs | 31 +- rust/stackable-cockpit/src/xfer/cache.rs | 58 ++-- rust/stackable-cockpit/src/xfer/mod.rs | 16 +- rust/stackablectl/src/args/cluster.rs | 9 +- rust/stackablectl/src/cli/mod.rs | 10 +- rust/stackablectl/src/cmds/demo.rs | 8 +- rust/stackablectl/src/cmds/operator.rs | 12 +- rust/stackablectl/src/cmds/release.rs | 30 +- rust/stackablectl/src/cmds/stack.rs | 8 +- web/src/api/schema.d.ts | 2 +- 28 files changed, 486 insertions(+), 506 deletions(-) delete mode 100644 rust/stackable-cockpit/src/platform/operator/spec.rs diff --git a/rust/stackable-cockpit/src/common/list.rs b/rust/stackable-cockpit/src/common/list.rs index 6d97e751..62b269bd 100644 --- a/rust/stackable-cockpit/src/common/list.rs +++ b/rust/stackable-cockpit/src/common/list.rs @@ -6,7 +6,7 @@ use snafu::{ResultExt, Snafu}; use crate::{ utils::path::PathOrUrl, - xfer::{processor::Yaml, FileTransferClient, FileTransferError}, + xfer::{self, processor::Yaml}, }; type Result = std::result::Result; @@ -14,7 +14,7 @@ type Result = std::result::Result; #[derive(Debug, Snafu)] pub enum Error { #[snafu(display("failed to transfer the list file"))] - FileTransfer { source: FileTransferError }, + FileTransfer { source: xfer::Error }, } pub trait SpecIter { @@ -44,7 +44,7 @@ where /// Builds a list of specs of type `S` based on a list of files. These files /// can be located locally (on disk) or remotely. Remote files will get /// downloaded. - pub async fn build(files: &[PathOrUrl], transfer_client: &FileTransferClient) -> Result { + pub async fn build(files: &[PathOrUrl], transfer_client: &xfer::Client) -> Result { let mut map = IndexMap::new(); for file in files { diff --git a/rust/stackable-cockpit/src/engine/kind/mod.rs b/rust/stackable-cockpit/src/engine/kind/mod.rs index 54c35809..99e24de5 100644 --- a/rust/stackable-cockpit/src/engine/kind/mod.rs +++ b/rust/stackable-cockpit/src/engine/kind/mod.rs @@ -45,13 +45,13 @@ pub enum Error { } #[derive(Debug)] -pub struct KindCluster { +pub struct Cluster { cp_node_count: usize, node_count: usize, name: String, } -impl KindCluster { +impl Cluster { /// Create a new kind cluster. This will NOT yet create the cluster on the /// system, but instead will return a data structure representing the /// cluster. To actually create the cluster, the `create` method must be diff --git a/rust/stackable-cockpit/src/engine/minikube/mod.rs b/rust/stackable-cockpit/src/engine/minikube/mod.rs index 1178b71b..31213d30 100644 --- a/rust/stackable-cockpit/src/engine/minikube/mod.rs +++ b/rust/stackable-cockpit/src/engine/minikube/mod.rs @@ -29,12 +29,12 @@ pub enum Error { } #[derive(Debug)] -pub struct MinikubeCluster { +pub struct Cluster { node_count: usize, name: String, } -impl MinikubeCluster { +impl Cluster { /// Create a new kind cluster. This will NOT yet create the cluster on the system, but instead will return a data /// structure representing the cluster. To actually create the cluster, the `create` method must be called. pub fn new(node_count: usize, name: Option) -> Self { diff --git a/rust/stackable-cockpit/src/helm.rs b/rust/stackable-cockpit/src/helm.rs index 6d7bf2a9..61356630 100644 --- a/rust/stackable-cockpit/src/helm.rs +++ b/rust/stackable-cockpit/src/helm.rs @@ -10,7 +10,7 @@ use crate::constants::{HELM_DEFAULT_CHART_VERSION, HELM_REPO_INDEX_FILE}; #[derive(Debug, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] -pub struct HelmRelease { +pub struct Release { pub name: String, pub version: String, pub namespace: String, @@ -23,24 +23,24 @@ pub struct HelmRelease { pub struct Chart { pub release_name: String, pub name: String, - pub repo: HelmChartRepo, + pub repo: ChartRepo, pub version: String, pub options: serde_yaml::Value, } #[derive(Debug, Deserialize)] -pub struct HelmChartRepo { +pub struct ChartRepo { pub name: String, pub url: String, } #[derive(Clone, Debug, Deserialize)] -pub struct HelmRepo { - pub entries: HashMap>, +pub struct Repository { + pub entries: HashMap>, } #[derive(Clone, Debug, Deserialize)] -pub struct HelmRepoEntry { +pub struct RepositoryEntry { pub name: String, pub version: String, } @@ -66,14 +66,14 @@ pub enum Error { ListReleases { error: String }, #[snafu(display("failed to install Helm release"))] - InstallRelease { source: HelmInstallReleaseError }, + InstallRelease { source: InstallReleaseError }, #[snafu(display("failed to uninstall Helm release: {error}"))] UninstallRelease { error: String }, } #[derive(Debug, Snafu)] -pub enum HelmInstallReleaseError { +pub enum InstallReleaseError { /// This error indicates that the Helm release was not found, instead of /// `check_release_exists` returning true. #[snafu(display("failed to find release {name}"))] @@ -97,7 +97,7 @@ pub enum HelmInstallReleaseError { } #[derive(Debug)] -pub enum HelmInstallReleaseStatus { +pub enum InstallReleaseStatus { /// Indicates that a release is already installed with a different version /// than requested. ReleaseAlreadyInstalledWithVersion { @@ -117,10 +117,10 @@ pub enum HelmInstallReleaseStatus { Installed(String), } -impl Display for HelmInstallReleaseStatus { +impl Display for InstallReleaseStatus { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { - HelmInstallReleaseStatus::ReleaseAlreadyInstalledWithVersion { + InstallReleaseStatus::ReleaseAlreadyInstalledWithVersion { release_name, current_version, requested_version, @@ -131,7 +131,7 @@ impl Display for HelmInstallReleaseStatus { release_name, current_version, requested_version ) } - HelmInstallReleaseStatus::ReleaseAlreadyInstalledUnspecified { + InstallReleaseStatus::ReleaseAlreadyInstalledUnspecified { release_name, current_version, } => { @@ -142,7 +142,7 @@ impl Display for HelmInstallReleaseStatus { current_version ) } - HelmInstallReleaseStatus::Installed(release_name) => { + InstallReleaseStatus::Installed(release_name) => { write!( f, "The release {} was successfully installed.", @@ -154,22 +154,22 @@ impl Display for HelmInstallReleaseStatus { } #[derive(Debug)] -pub enum HelmUninstallReleaseStatus { +pub enum UninstallReleaseStatus { NotInstalled(String), Uninstalled(String), } -impl Display for HelmUninstallReleaseStatus { +impl Display for UninstallReleaseStatus { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { - HelmUninstallReleaseStatus::NotInstalled(release_name) => { + UninstallReleaseStatus::NotInstalled(release_name) => { write!( f, "The release {} is not installed, skipping.", release_name ) } - HelmUninstallReleaseStatus::Uninstalled(release_name) => { + UninstallReleaseStatus::Uninstalled(release_name) => { write!( f, "The release {} was successfully uninstalled.", @@ -199,12 +199,12 @@ pub fn install_release_from_repo( values_yaml: Option<&str>, namespace: &str, suppress_output: bool, -) -> Result { +) -> Result { debug!("Install Helm release from repo"); if check_release_exists(release_name, namespace)? { let release = get_release(release_name, namespace)?.ok_or(Error::InstallRelease { - source: HelmInstallReleaseError::NoSuchRelease { + source: InstallReleaseError::NoSuchRelease { name: release_name.to_owned(), }, })?; @@ -214,16 +214,14 @@ pub fn install_release_from_repo( match chart_version { Some(chart_version) => { if chart_version == current_version { - return Ok( - HelmInstallReleaseStatus::ReleaseAlreadyInstalledWithVersion { - requested_version: chart_version.to_string(), - release_name: release_name.to_string(), - current_version, - }, - ); + return Ok(InstallReleaseStatus::ReleaseAlreadyInstalledWithVersion { + requested_version: chart_version.to_string(), + release_name: release_name.to_string(), + current_version, + }); } else { return Err(Error::InstallRelease { - source: HelmInstallReleaseError::ReleaseAlreadyInstalled { + source: InstallReleaseError::ReleaseAlreadyInstalled { requested_version: chart_version.into(), name: release_name.into(), current_version, @@ -232,12 +230,10 @@ pub fn install_release_from_repo( } } None => { - return Ok( - HelmInstallReleaseStatus::ReleaseAlreadyInstalledUnspecified { - release_name: release_name.to_string(), - current_version, - }, - ) + return Ok(InstallReleaseStatus::ReleaseAlreadyInstalledUnspecified { + release_name: release_name.to_string(), + current_version, + }) } } } @@ -259,9 +255,7 @@ pub fn install_release_from_repo( suppress_output, )?; - Ok(HelmInstallReleaseStatus::Installed( - release_name.to_string(), - )) + Ok(InstallReleaseStatus::Installed(release_name.to_string())) } fn install_release( @@ -288,7 +282,7 @@ fn install_release( ); return Err(Error::InstallRelease { - source: HelmInstallReleaseError::HelmWrapperError { error }, + source: InstallReleaseError::HelmWrapperError { error }, }); } @@ -301,7 +295,7 @@ pub fn uninstall_release( release_name: &str, namespace: &str, suppress_output: bool, -) -> Result { +) -> Result { debug!("Uninstall Helm release"); if check_release_exists(release_name, namespace)? { @@ -316,7 +310,7 @@ pub fn uninstall_release( return Err(Error::UninstallRelease { error: err }); } - return Ok(HelmUninstallReleaseStatus::Uninstalled( + return Ok(UninstallReleaseStatus::Uninstalled( release_name.to_string(), )); } @@ -326,7 +320,7 @@ pub fn uninstall_release( release_name ); - Ok(HelmUninstallReleaseStatus::NotInstalled( + Ok(UninstallReleaseStatus::NotInstalled( release_name.to_string(), )) } @@ -342,7 +336,7 @@ pub fn check_release_exists(release_name: &str, namespace: &str) -> Result Result, Error> { +pub fn list_releases(namespace: &str) -> Result, Error> { debug!("List Helm releases"); let result = helm_sys::list_helm_releases(namespace); @@ -361,7 +355,7 @@ pub fn list_releases(namespace: &str) -> Result, Error> { /// Returns a single Helm release by `release_name`. #[instrument] -pub fn get_release(release_name: &str, namespace: &str) -> Result, Error> { +pub fn get_release(release_name: &str, namespace: &str) -> Result, Error> { debug!("Get Helm release"); Ok(list_releases(namespace)? @@ -390,7 +384,7 @@ pub fn add_repo(repository_name: &str, repository_url: &str) -> Result<(), Error /// Retrieves the Helm index file from the repository URL. #[instrument] -pub async fn get_helm_index(repo_url: T) -> Result +pub async fn get_helm_index(repo_url: T) -> Result where T: AsRef + std::fmt::Debug, { diff --git a/rust/stackable-cockpit/src/platform/cluster/resource_request.rs b/rust/stackable-cockpit/src/platform/cluster/resource_request.rs index 4148898e..d7bda6a3 100644 --- a/rust/stackable-cockpit/src/platform/cluster/resource_request.rs +++ b/rust/stackable-cockpit/src/platform/cluster/resource_request.rs @@ -8,7 +8,7 @@ use serde::{Deserialize, Serialize}; use snafu::{ResultExt, Snafu}; use stackable_operator::{cpu::CpuQuantity, memory::MemoryQuantity}; -use crate::utils::k8s::{KubeClient, KubeClientError}; +use crate::utils::k8s::{Client, Error}; type Result = std::result::Result; @@ -44,10 +44,10 @@ impl Display for ResourceRequests { #[derive(Debug, Snafu)] pub enum ResourceRequestsError { #[snafu(display("failed to create kube client"))] - KubeClientError { source: KubeClientError }, + KubeClientError { source: Error }, #[snafu(display("failed to retrieve cluster info"))] - ClusterInfoError { source: KubeClientError }, + ClusterInfoError { source: Error }, #[snafu(display("failed to parse cpu resource requirements"))] ParseCpuResourceRequirements { @@ -92,7 +92,7 @@ impl ResourceRequests { /// resources to the available ones in the current cluster. `object_name` /// should be `stack` or `demo`. pub async fn validate_cluster_size(&self, object_name: &str) -> Result<()> { - let kube_client = KubeClient::new().await.context(KubeClientSnafu)?; + let kube_client = Client::new().await.context(KubeClientSnafu)?; let cluster_info = kube_client .get_cluster_info() .await diff --git a/rust/stackable-cockpit/src/platform/credentials.rs b/rust/stackable-cockpit/src/platform/credentials.rs index 9e38607f..35b84c77 100644 --- a/rust/stackable-cockpit/src/platform/credentials.rs +++ b/rust/stackable-cockpit/src/platform/credentials.rs @@ -4,14 +4,14 @@ use kube::{core::DynamicObject, ResourceExt}; use serde::Serialize; use snafu::{OptionExt, ResultExt, Snafu}; -use crate::utils::k8s::{KubeClient, KubeClientError}; +use crate::utils::k8s; pub type Result = std::result::Result; #[derive(Debug, Snafu)] pub enum Error { #[snafu(display("failed to fetch data from kubernetes api"))] - KubeClientFetchError { source: KubeClientError }, + KubeClientFetchError { source: k8s::Error }, #[snafu(display("no credentials secret found"))] NoSecret, @@ -33,8 +33,8 @@ impl Display for Credentials { /// in `secret_namespace`. The function returns [`Ok(None)`] if `username_key` /// and/or `password_key` are not found or the product does not provide /// any credentials. -pub async fn get_credentials( - kube_client: &KubeClient, +pub async fn get( + kube_client: &k8s::Client, product_name: &str, stacklet: &DynamicObject, ) -> Result> { diff --git a/rust/stackable-cockpit/src/platform/demo/spec.rs b/rust/stackable-cockpit/src/platform/demo/spec.rs index 3a8a7431..e634a982 100644 --- a/rust/stackable-cockpit/src/platform/demo/spec.rs +++ b/rust/stackable-cockpit/src/platform/demo/spec.rs @@ -13,7 +13,7 @@ use crate::{ stack, }, utils::params::{Parameter, RawParameter, RawParameterParseError}, - xfer::FileTransferClient, + xfer::Client, }; pub type RawDemoParameterParseError = RawParameterParseError; @@ -130,7 +130,7 @@ impl DemoSpec { product_namespace: &str, stack_parameters: &[String], demo_parameters: &[String], - transfer_client: &FileTransferClient, + transfer_client: &Client, skip_release: bool, ) -> Result<(), Error> { // Get the stack spec based on the name defined in the demo spec diff --git a/rust/stackable-cockpit/src/platform/namespace.rs b/rust/stackable-cockpit/src/platform/namespace.rs index 5e8ee3a8..cbf0665b 100644 --- a/rust/stackable-cockpit/src/platform/namespace.rs +++ b/rust/stackable-cockpit/src/platform/namespace.rs @@ -1,11 +1,11 @@ use snafu::{ResultExt, Snafu}; -use crate::utils::k8s::{KubeClient, KubeClientError}; +use crate::utils::k8s; #[derive(Debug, Snafu)] pub enum Error { #[snafu(display("failed to create kubernetes client"))] - KubeClientCreateError { source: KubeClientError }, + KubeClientCreateError { source: k8s::Error }, #[snafu(display("permission denied - try to create the namespace manually or choose an already existing one to which you have access to"))] PermissionDenied, @@ -14,16 +14,16 @@ pub enum Error { /// Creates a namespace with `name` if needed (not already present in the /// cluster). pub async fn create_if_needed(name: String) -> Result<(), Error> { - let client = KubeClient::new().await.context(KubeClientCreateSnafu)?; + let client = k8s::Client::new().await.context(KubeClientCreateSnafu)?; client .create_namespace_if_needed(name) .await .map_err(|err| match err { - KubeClientError::KubeError { source } => match source { + k8s::Error::KubeError { source } => match source { kube::Error::Api(err) if err.code == 401 => Error::PermissionDenied, _ => Error::KubeClientCreateError { - source: KubeClientError::KubeError { source }, + source: k8s::Error::KubeError { source }, }, }, _ => Error::KubeClientCreateError { source: err }, diff --git a/rust/stackable-cockpit/src/platform/operator/mod.rs b/rust/stackable-cockpit/src/platform/operator/mod.rs index 38ed6828..32fd095d 100644 --- a/rust/stackable-cockpit/src/platform/operator/mod.rs +++ b/rust/stackable-cockpit/src/platform/operator/mod.rs @@ -1,3 +1,268 @@ -mod spec; +use std::{fmt::Display, str::FromStr}; -pub use spec::*; +use semver::Version; +use snafu::{ResultExt, Snafu}; +use tracing::{info, instrument}; + +use crate::{ + constants::{HELM_REPO_NAME_DEV, HELM_REPO_NAME_STABLE, HELM_REPO_NAME_TEST}, + helm, + utils::operator_chart_name, +}; + +pub const VALID_OPERATORS: &[&str] = &[ + "airflow", + "commons", + "druid", + "hbase", + "hdfs", + "hive", + "kafka", + "listener", + "nifi", + "opa", + "secret", + "spark-k8s", + "superset", + "trino", + "zookeeper", +]; + +#[derive(Debug, Snafu)] +pub enum SpecParseError { + #[snafu(display("invalid equal sign count in operator spec, expected one"))] + InvalidEqualSignCount, + + #[snafu(display("failed to parse SemVer version"))] + ParseVersion { source: semver::Error }, + + #[snafu(display("the operator spec includes '=' but no version was specified"))] + MissingVersion, + + #[snafu(display("empty operator spec input"))] + EmptyInput, + + #[snafu(display("invalid operator name: '{name}'"))] + InvalidName { name: String }, +} + +/// OperatorSpec describes the format of an operator name with optional version +/// number. The string format is `(=)`. Valid values +/// are: `operator`, `operator=1.2.3` or `operator=1.2.3-rc1`. +#[derive(Clone, Debug)] +pub struct OperatorSpec { + pub version: Option, + pub name: String, +} + +impl Display for OperatorSpec { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!( + f, + "{}{}", + self.name, + match &self.version { + Some(v) => format!("={v}"), + None => "".into(), + } + ) + } +} + +impl FromStr for OperatorSpec { + type Err = SpecParseError; + + fn from_str(s: &str) -> Result { + let input = s.trim(); + + // Empty input is not allowed + if input.is_empty() { + return Err(SpecParseError::EmptyInput); + } + + // Split at each equal sign + let parts: Vec<&str> = input.split('=').collect(); + let len = parts.len(); + + // If there are more than 2 equal signs, return error + // because of invalid spec format + if len > 2 { + return Err(SpecParseError::InvalidEqualSignCount); + } + + // If there is only one part, the input didn't include + // the optional version identifier + if len == 1 { + return Ok(Self { + name: input.into(), + version: None, + }); + } + + // If there is an equal sign, but no version after + if parts[1].is_empty() { + return Err(SpecParseError::MissingVersion); + } + + if !VALID_OPERATORS.contains(&parts[0]) { + return Err(SpecParseError::InvalidName { + name: parts[0].to_string(), + }); + } + + // There are two parts, so an operator name and version + let version: Version = parts[1].parse().context(ParseVersionSnafu)?; + + Ok(Self { + name: parts[0].into(), + version: Some(version), + }) + } +} + +impl TryFrom for OperatorSpec { + type Error = SpecParseError; + + fn try_from(value: String) -> Result { + Self::from_str(&value) + } +} + +impl TryFrom<&str> for OperatorSpec { + type Error = SpecParseError; + + fn try_from(value: &str) -> Result { + Self::try_from(value.to_string()) + } +} + +impl OperatorSpec { + pub fn new(name: T, version: Option) -> Result + where + T: AsRef, + { + let name = name.as_ref(); + + if !VALID_OPERATORS.contains(&name) { + return Err(SpecParseError::InvalidName { + name: name.to_string(), + }); + } + + Ok(Self { + name: name.to_string(), + version, + }) + } + + /// Returns the name used by Helm + pub fn helm_name(&self) -> String { + operator_chart_name(&self.name) + } + + /// Returns the repo used by Helm based on the specified version + pub fn helm_repo_name(&self) -> String { + match &self.version { + Some(version) if version.pre.as_str() == "-nightly" => HELM_REPO_NAME_DEV, + Some(version) if version.pre.as_str() == "-dev" => HELM_REPO_NAME_DEV, + Some(version) if version.pre.as_str() == "-pr" => HELM_REPO_NAME_TEST, + Some(_) => HELM_REPO_NAME_STABLE, + None => HELM_REPO_NAME_DEV, + } + .into() + } + + /// Installs the operator using Helm. + #[instrument(skip_all)] + pub fn install(&self, namespace: &str) -> Result<(), helm::Error> { + info!("Installing operator {}", self); + + let version = self.version.as_ref().map(|v| v.to_string()); + let helm_repo = self.helm_repo_name(); + let helm_name = self.helm_name(); + + // Install using Helm + helm::install_release_from_repo( + &self.name, + &helm_name, + helm::ChartVersion { + chart_version: version.as_deref(), + chart_name: &helm_name, + repo_name: &helm_repo, + }, + None, + namespace, + true, + )?; + + Ok(()) + } + + /// Uninstalls the operator using Helm. + #[instrument] + pub fn uninstall(&self, namespace: T) -> Result<(), helm::Error> + where + T: AsRef + std::fmt::Debug, + { + match helm::uninstall_release(&self.helm_name(), namespace.as_ref(), true) { + Ok(status) => { + println!("{status}"); + Ok(()) + } + Err(err) => Err(err), + } + } +} + +#[cfg(test)] +mod test { + use semver::Version; + + use crate::platform::operator::{OperatorSpec, SpecParseError}; + + #[test] + fn simple_operator_spec() { + match OperatorSpec::try_from("operator") { + Ok(spec) => { + assert_eq!(spec.name, String::from("operator")); + assert_eq!(spec.version, None); + } + Err(err) => panic!("{err}"), + } + } + + #[test] + fn version_operator_spec() { + match OperatorSpec::try_from("zookeeper=1.2.3") { + Ok(spec) => { + assert_eq!(spec.name, String::from("zookeeper")); + assert_eq!(spec.version, Some(Version::new(1, 2, 3))); + } + Err(err) => panic!("{err}"), + } + } + + #[test] + fn empty_operator_spec() { + match OperatorSpec::try_from("") { + Ok(spec) => panic!("SHOULD FAIL: {spec}"), + Err(err) => assert!(matches!(err, SpecParseError::EmptyInput)), + } + } + + #[test] + fn empty_version_operator_spec() { + match OperatorSpec::try_from("operator=") { + Ok(spec) => panic!("SHOULD FAIL: {spec}"), + Err(err) => assert!(matches!(err, SpecParseError::MissingVersion)), + } + } + + #[test] + fn invalid_version_operator_spec() { + match OperatorSpec::try_from("operator=1.2.3=") { + Ok(spec) => panic!("SHOULD FAIL: {spec}"), + Err(err) => assert!(matches!(err, SpecParseError::InvalidEqualSignCount)), + } + } +} diff --git a/rust/stackable-cockpit/src/platform/operator/spec.rs b/rust/stackable-cockpit/src/platform/operator/spec.rs deleted file mode 100644 index 32fd095d..00000000 --- a/rust/stackable-cockpit/src/platform/operator/spec.rs +++ /dev/null @@ -1,268 +0,0 @@ -use std::{fmt::Display, str::FromStr}; - -use semver::Version; -use snafu::{ResultExt, Snafu}; -use tracing::{info, instrument}; - -use crate::{ - constants::{HELM_REPO_NAME_DEV, HELM_REPO_NAME_STABLE, HELM_REPO_NAME_TEST}, - helm, - utils::operator_chart_name, -}; - -pub const VALID_OPERATORS: &[&str] = &[ - "airflow", - "commons", - "druid", - "hbase", - "hdfs", - "hive", - "kafka", - "listener", - "nifi", - "opa", - "secret", - "spark-k8s", - "superset", - "trino", - "zookeeper", -]; - -#[derive(Debug, Snafu)] -pub enum SpecParseError { - #[snafu(display("invalid equal sign count in operator spec, expected one"))] - InvalidEqualSignCount, - - #[snafu(display("failed to parse SemVer version"))] - ParseVersion { source: semver::Error }, - - #[snafu(display("the operator spec includes '=' but no version was specified"))] - MissingVersion, - - #[snafu(display("empty operator spec input"))] - EmptyInput, - - #[snafu(display("invalid operator name: '{name}'"))] - InvalidName { name: String }, -} - -/// OperatorSpec describes the format of an operator name with optional version -/// number. The string format is `(=)`. Valid values -/// are: `operator`, `operator=1.2.3` or `operator=1.2.3-rc1`. -#[derive(Clone, Debug)] -pub struct OperatorSpec { - pub version: Option, - pub name: String, -} - -impl Display for OperatorSpec { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!( - f, - "{}{}", - self.name, - match &self.version { - Some(v) => format!("={v}"), - None => "".into(), - } - ) - } -} - -impl FromStr for OperatorSpec { - type Err = SpecParseError; - - fn from_str(s: &str) -> Result { - let input = s.trim(); - - // Empty input is not allowed - if input.is_empty() { - return Err(SpecParseError::EmptyInput); - } - - // Split at each equal sign - let parts: Vec<&str> = input.split('=').collect(); - let len = parts.len(); - - // If there are more than 2 equal signs, return error - // because of invalid spec format - if len > 2 { - return Err(SpecParseError::InvalidEqualSignCount); - } - - // If there is only one part, the input didn't include - // the optional version identifier - if len == 1 { - return Ok(Self { - name: input.into(), - version: None, - }); - } - - // If there is an equal sign, but no version after - if parts[1].is_empty() { - return Err(SpecParseError::MissingVersion); - } - - if !VALID_OPERATORS.contains(&parts[0]) { - return Err(SpecParseError::InvalidName { - name: parts[0].to_string(), - }); - } - - // There are two parts, so an operator name and version - let version: Version = parts[1].parse().context(ParseVersionSnafu)?; - - Ok(Self { - name: parts[0].into(), - version: Some(version), - }) - } -} - -impl TryFrom for OperatorSpec { - type Error = SpecParseError; - - fn try_from(value: String) -> Result { - Self::from_str(&value) - } -} - -impl TryFrom<&str> for OperatorSpec { - type Error = SpecParseError; - - fn try_from(value: &str) -> Result { - Self::try_from(value.to_string()) - } -} - -impl OperatorSpec { - pub fn new(name: T, version: Option) -> Result - where - T: AsRef, - { - let name = name.as_ref(); - - if !VALID_OPERATORS.contains(&name) { - return Err(SpecParseError::InvalidName { - name: name.to_string(), - }); - } - - Ok(Self { - name: name.to_string(), - version, - }) - } - - /// Returns the name used by Helm - pub fn helm_name(&self) -> String { - operator_chart_name(&self.name) - } - - /// Returns the repo used by Helm based on the specified version - pub fn helm_repo_name(&self) -> String { - match &self.version { - Some(version) if version.pre.as_str() == "-nightly" => HELM_REPO_NAME_DEV, - Some(version) if version.pre.as_str() == "-dev" => HELM_REPO_NAME_DEV, - Some(version) if version.pre.as_str() == "-pr" => HELM_REPO_NAME_TEST, - Some(_) => HELM_REPO_NAME_STABLE, - None => HELM_REPO_NAME_DEV, - } - .into() - } - - /// Installs the operator using Helm. - #[instrument(skip_all)] - pub fn install(&self, namespace: &str) -> Result<(), helm::Error> { - info!("Installing operator {}", self); - - let version = self.version.as_ref().map(|v| v.to_string()); - let helm_repo = self.helm_repo_name(); - let helm_name = self.helm_name(); - - // Install using Helm - helm::install_release_from_repo( - &self.name, - &helm_name, - helm::ChartVersion { - chart_version: version.as_deref(), - chart_name: &helm_name, - repo_name: &helm_repo, - }, - None, - namespace, - true, - )?; - - Ok(()) - } - - /// Uninstalls the operator using Helm. - #[instrument] - pub fn uninstall(&self, namespace: T) -> Result<(), helm::Error> - where - T: AsRef + std::fmt::Debug, - { - match helm::uninstall_release(&self.helm_name(), namespace.as_ref(), true) { - Ok(status) => { - println!("{status}"); - Ok(()) - } - Err(err) => Err(err), - } - } -} - -#[cfg(test)] -mod test { - use semver::Version; - - use crate::platform::operator::{OperatorSpec, SpecParseError}; - - #[test] - fn simple_operator_spec() { - match OperatorSpec::try_from("operator") { - Ok(spec) => { - assert_eq!(spec.name, String::from("operator")); - assert_eq!(spec.version, None); - } - Err(err) => panic!("{err}"), - } - } - - #[test] - fn version_operator_spec() { - match OperatorSpec::try_from("zookeeper=1.2.3") { - Ok(spec) => { - assert_eq!(spec.name, String::from("zookeeper")); - assert_eq!(spec.version, Some(Version::new(1, 2, 3))); - } - Err(err) => panic!("{err}"), - } - } - - #[test] - fn empty_operator_spec() { - match OperatorSpec::try_from("") { - Ok(spec) => panic!("SHOULD FAIL: {spec}"), - Err(err) => assert!(matches!(err, SpecParseError::EmptyInput)), - } - } - - #[test] - fn empty_version_operator_spec() { - match OperatorSpec::try_from("operator=") { - Ok(spec) => panic!("SHOULD FAIL: {spec}"), - Err(err) => assert!(matches!(err, SpecParseError::MissingVersion)), - } - } - - #[test] - fn invalid_version_operator_spec() { - match OperatorSpec::try_from("operator=1.2.3=") { - Ok(spec) => panic!("SHOULD FAIL: {spec}"), - Err(err) => assert!(matches!(err, SpecParseError::InvalidEqualSignCount)), - } - } -} diff --git a/rust/stackable-cockpit/src/platform/release/spec.rs b/rust/stackable-cockpit/src/platform/release/spec.rs index 9327837d..ba365338 100644 --- a/rust/stackable-cockpit/src/platform/release/spec.rs +++ b/rust/stackable-cockpit/src/platform/release/spec.rs @@ -11,17 +11,16 @@ use crate::{ platform::{operator, product}, }; +type Result = std::result::Result; + #[derive(Debug, Snafu)] -pub enum InstallError { +pub enum Error { #[snafu(display("failed to parse operator spec"))] OperatorSpecParse { source: operator::SpecParseError }, #[snafu(display("failed to install release using Helm"))] HelmInstallError { source: helm::Error }, -} -#[derive(Debug, Snafu)] -pub enum UninstallError { #[snafu(display("failed to uninstall release using Helm"))] HelmUninstallError { source: helm::Error }, } @@ -49,7 +48,7 @@ impl ReleaseSpec { include_products: &[String], exclude_products: &[String], namespace: &str, - ) -> Result<(), InstallError> { + ) -> Result<()> { info!("Installing release"); for (product_name, product) in self.filter_products(include_products, exclude_products) { @@ -66,7 +65,7 @@ impl ReleaseSpec { Ok(()) } - pub fn uninstall(&self, namespace: &str) -> Result<(), UninstallError> { + pub fn uninstall(&self, namespace: &str) -> Result<()> { for (product_name, _) in &self.products { helm::uninstall_release(product_name, namespace, true).context(HelmUninstallSnafu)?; } diff --git a/rust/stackable-cockpit/src/platform/service.rs b/rust/stackable-cockpit/src/platform/service.rs index 4f767a12..b503fb70 100644 --- a/rust/stackable-cockpit/src/platform/service.rs +++ b/rust/stackable-cockpit/src/platform/service.rs @@ -13,12 +13,12 @@ use kube::{api::ListParams, ResourceExt}; use snafu::{OptionExt, ResultExt, Snafu}; use tracing::{debug, warn}; -use crate::utils::k8s::{KubeClient, KubeClientError, ListParamsExt, ProductLabel}; +use crate::utils::k8s::{self, ListParamsExt}; #[derive(Debug, Snafu)] -pub enum ServiceError { +pub enum Error { #[snafu(display("failed to fetch data from kubernetes api"))] - KubeClientFetchError { source: KubeClientError }, + KubeClientFetchError { source: k8s::Error }, #[snafu(display("missing namespace for service '{service}'"))] MissingServiceNamespace { service: String }, @@ -39,14 +39,14 @@ pub enum ServiceError { NodeMissingInIpMapping { node_name: String }, } -pub async fn get_service_endpoints( - kube_client: &KubeClient, +pub async fn get_endpoints( + kube_client: &k8s::Client, product_name: &str, object_name: &str, object_namespace: &str, -) -> Result, ServiceError> { +) -> Result, Error> { let service_list_params = - ListParams::from_product(product_name, Some(object_name), ProductLabel::Name); + ListParams::from_product(product_name, Some(object_name), k8s::ProductLabel::Name); let services = kube_client .list_services(Some(object_namespace), &service_list_params) @@ -56,7 +56,7 @@ pub async fn get_service_endpoints( let mut endpoints = IndexMap::new(); for service in services { - match get_service_endpoint_urls(kube_client, &service, object_name).await { + match get_endpoint_urls(kube_client, &service, object_name).await { Ok(urls) => endpoints.extend(urls), Err(err) => warn!( "Failed to get endpoint_urls of service {service_name}: {err}", @@ -68,11 +68,11 @@ pub async fn get_service_endpoints( Ok(endpoints) } -pub async fn get_service_endpoint_urls( - kube_client: &KubeClient, +pub async fn get_endpoint_urls( + kube_client: &k8s::Client, service: &Service, referenced_object_name: &str, -) -> Result, ServiceError> { +) -> Result, Error> { let service_name = service.name_unchecked(); let service_namespace = service.namespace().context(MissingServiceNamespaceSnafu { @@ -85,7 +85,7 @@ pub async fn get_service_endpoint_urls( let endpoints = match service_spec.type_.as_deref() { Some("NodePort") => { - get_service_endpoint_urls_for_nodeport( + get_endpoint_urls_for_nodeport( kube_client, &service_name, service_spec, @@ -95,7 +95,7 @@ pub async fn get_service_endpoint_urls( .await? } Some("LoadBalancer") => { - get_service_endpoint_urls_for_loadbalancer( + get_endpoint_urls_for_loadbalancer( &service_name, service, service_spec, @@ -109,13 +109,13 @@ pub async fn get_service_endpoint_urls( Ok(endpoints) } -pub async fn get_service_endpoint_urls_for_nodeport( - kube_client: &KubeClient, +pub async fn get_endpoint_urls_for_nodeport( + kube_client: &k8s::Client, service_name: &str, service_spec: &ServiceSpec, service_namespace: &str, referenced_object_name: &str, -) -> Result, ServiceError> { +) -> Result, Error> { let endpoints = kube_client .get_endpoints(service_namespace, service_name) .await @@ -179,12 +179,12 @@ pub async fn get_service_endpoint_urls_for_nodeport( Ok(endpoints) } -pub async fn get_service_endpoint_urls_for_loadbalancer( +pub async fn get_endpoint_urls_for_loadbalancer( service_name: &str, service: &Service, service_spec: &ServiceSpec, referenced_object_name: &str, -) -> Result, ServiceError> { +) -> Result, Error> { let mut endpoints = IndexMap::new(); let lb_host = service @@ -223,7 +223,7 @@ pub async fn get_service_endpoint_urls_for_loadbalancer( Ok(endpoints) } -async fn get_node_ip(kube_client: &KubeClient, node_name: &str) -> Result { +async fn get_node_ip(kube_client: &k8s::Client, node_name: &str) -> Result { let node_name_ip_mapping = get_node_name_ip_mapping(kube_client).await?; match node_name_ip_mapping.get(node_name) { @@ -235,8 +235,8 @@ async fn get_node_ip(kube_client: &KubeClient, node_name: &str) -> Result Result, ServiceError> { + kube_client: &k8s::Client, +) -> Result, Error> { let nodes = kube_client .list_nodes() .await diff --git a/rust/stackable-cockpit/src/platform/stack/spec.rs b/rust/stackable-cockpit/src/platform/stack/spec.rs index 2ca806de..0fbf0ded 100644 --- a/rust/stackable-cockpit/src/platform/stack/spec.rs +++ b/rust/stackable-cockpit/src/platform/stack/spec.rs @@ -13,18 +13,18 @@ use crate::{ platform::{ cluster::{ResourceRequests, ResourceRequestsError}, demo::DemoParameter, - release::{InstallError, List}, + release, }, utils::{ - k8s::{KubeClient, KubeClientError}, + k8s, params::{ IntoParameters, IntoParametersError, Parameter, RawParameter, RawParameterParseError, }, path::{IntoPathOrUrl, PathOrUrlParseError}, }, xfer::{ + self, processor::{Processor, Template, Yaml}, - FileTransferClient, FileTransferError, }, }; @@ -46,7 +46,7 @@ pub enum Error { /// This error indicates that the release failed to install. #[snafu(display("failed to install release"))] - ReleaseInstallError { source: InstallError }, + ReleaseInstallError { source: release::Error }, /// This error indicates that the Helm wrapper failed to add the Helm /// repository. @@ -66,11 +66,11 @@ pub enum Error { /// This error indicates that the creation of a kube client failed. #[snafu(display("failed to create kubernetes client"))] - KubeClientCreateError { source: KubeClientError }, + KubeClientCreateError { source: k8s::Error }, /// This error indicates that the kube client failed to deloy manifests. #[snafu(display("failed to deploy manifests using the kube client"))] - ManifestDeployError { source: KubeClientError }, + ManifestDeployError { source: k8s::Error }, /// This error indicates that Helm chart options could not be serialized /// into YAML. @@ -89,7 +89,7 @@ pub enum Error { /// This error indicates that receiving remote content failed. #[snafu(display("failed to receive remote content"))] - TransferError { source: FileTransferError }, + TransferError { source: xfer::Error }, /// This error indicates that the stack doesn't support being installed in /// the provided namespace. @@ -179,7 +179,7 @@ impl StackSpec { #[instrument(skip(self, release_list))] pub async fn install_release( &self, - release_list: List, + release_list: release::List, operator_namespace: &str, product_namespace: &str, ) -> Result<(), Error> { @@ -205,7 +205,7 @@ impl StackSpec { &self, parameters: &[String], product_namespace: &str, - transfer_client: &FileTransferClient, + transfer_client: &xfer::Client, ) -> Result<(), Error> { info!("Installing stack manifests"); @@ -231,7 +231,7 @@ impl StackSpec { valid_demo_parameters: &[DemoParameter], demo_parameters: &[String], product_namespace: &str, - transfer_client: &FileTransferClient, + transfer_client: &xfer::Client, ) -> Result<(), Error> { info!("Installing demo manifests"); @@ -250,7 +250,7 @@ impl StackSpec { manifests: &Vec, parameters: &HashMap, product_namespace: &str, - transfer_client: &FileTransferClient, + transfer_client: &xfer::Client, ) -> Result<(), Error> { debug!("Installing demo / stack manifests"); @@ -317,7 +317,7 @@ impl StackSpec { .await .context(TransferSnafu)?; - let kube_client = KubeClient::new().await.context(KubeClientCreateSnafu)?; + let kube_client = k8s::Client::new().await.context(KubeClientCreateSnafu)?; kube_client .deploy_manifests(&manifests, product_namespace) diff --git a/rust/stackable-cockpit/src/platform/stacklet/grafana.rs b/rust/stackable-cockpit/src/platform/stacklet/grafana.rs index b899d546..c1408010 100644 --- a/rust/stackable-cockpit/src/platform/stacklet/grafana.rs +++ b/rust/stackable-cockpit/src/platform/stacklet/grafana.rs @@ -3,14 +3,14 @@ use snafu::ResultExt; use crate::{ platform::{ - service::get_service_endpoint_urls, + service::get_endpoint_urls, stacklet::{Error, KubeClientFetchSnafu, ServiceSnafu, Stacklet}, }, - utils::k8s::{KubeClient, ListParamsExt, ProductLabel}, + utils::k8s::{Client, ListParamsExt, ProductLabel}, }; pub(super) async fn list( - kube_client: &KubeClient, + kube_client: &Client, namespace: Option<&str>, ) -> Result, Error> { let mut stacklets = Vec::new(); @@ -23,7 +23,7 @@ pub(super) async fn list( for service in services { let service_name = service.name_any(); - let endpoints = get_service_endpoint_urls(kube_client, &service, &service_name) + let endpoints = get_endpoint_urls(kube_client, &service, &service_name) .await .context(ServiceSnafu)?; diff --git a/rust/stackable-cockpit/src/platform/stacklet/minio.rs b/rust/stackable-cockpit/src/platform/stacklet/minio.rs index fb9cef2d..84e0dfa0 100644 --- a/rust/stackable-cockpit/src/platform/stacklet/minio.rs +++ b/rust/stackable-cockpit/src/platform/stacklet/minio.rs @@ -3,14 +3,14 @@ use snafu::ResultExt; use crate::{ platform::{ - service::get_service_endpoint_urls, + service::get_endpoint_urls, stacklet::{Error, KubeClientFetchSnafu, ServiceSnafu, Stacklet}, }, - utils::k8s::KubeClient, + utils::k8s::Client, }; pub(super) async fn list( - kube_client: &KubeClient, + kube_client: &Client, namespace: Option<&str>, ) -> Result, Error> { let mut stacklets = Vec::new(); @@ -28,7 +28,7 @@ pub(super) async fn list( for service in console_services { let service_name = service.name_any(); - let endpoints = get_service_endpoint_urls(kube_client, service, &service_name) + let endpoints = get_endpoint_urls(kube_client, service, &service_name) .await .context(ServiceSnafu)?; diff --git a/rust/stackable-cockpit/src/platform/stacklet/mod.rs b/rust/stackable-cockpit/src/platform/stacklet/mod.rs index f017e2e2..f203495c 100644 --- a/rust/stackable-cockpit/src/platform/stacklet/mod.rs +++ b/rust/stackable-cockpit/src/platform/stacklet/mod.rs @@ -10,12 +10,9 @@ use utoipa::ToSchema; use crate::{ constants::PRODUCT_NAMES, - platform::{ - credentials, - service::{get_service_endpoints, ServiceError}, - }, + platform::{credentials, service}, utils::{ - k8s::{ConditionsExt, DisplayCondition, KubeClient, KubeClientError}, + k8s::{self, ConditionsExt}, string::Casing, }, }; @@ -43,16 +40,16 @@ pub struct Stacklet { pub endpoints: IndexMap, /// Multiple cluster conditions. - pub conditions: Vec, + pub conditions: Vec, } #[derive(Debug, Snafu)] pub enum Error { #[snafu(display("failed to create kubernetes client"))] - KubeClientCreateError { source: KubeClientError }, + KubeClientCreateError { source: k8s::Error }, #[snafu(display("failed to fetch data from the kubernetes api"))] - KubeClientFetchError { source: KubeClientError }, + KubeClientFetchError { source: k8s::Error }, #[snafu(display("no namespace set for custom resource '{crd_name}'"))] CustomCrdNamespaceError { crd_name: String }, @@ -61,7 +58,7 @@ pub enum Error { DeserializeConditionsError { source: serde_json::Error }, #[snafu(display("service error"))] - ServiceError { source: ServiceError }, + ServiceError { source: service::Error }, } /// Lists all installed stacklets. If `namespace` is [`None`], stacklets from ALL @@ -69,7 +66,7 @@ pub enum Error { /// in the specified namespace are returned. The `options` allow further /// customization of the returned information. pub async fn list_stacklets(namespace: Option<&str>) -> Result, Error> { - let kube_client = KubeClient::new().await.context(KubeClientCreateSnafu)?; + let kube_client = k8s::Client::new().await.context(KubeClientCreateSnafu)?; let mut stacklets = list_stackable_stacklets(&kube_client, namespace).await?; stacklets.extend(grafana::list(&kube_client, namespace).await?); @@ -85,7 +82,7 @@ pub async fn get_credentials_for_product( object_name: &str, product_name: &str, ) -> Result, Error> { - let kube_client = KubeClient::new().await.context(KubeClientCreateSnafu)?; + let kube_client = k8s::Client::new().await.context(KubeClientCreateSnafu)?; let product_gvk = gvk_from_product_name(product_name); let product_cluster = match kube_client @@ -102,20 +99,19 @@ pub async fn get_credentials_for_product( } }; - let credentials = - match credentials::get_credentials(&kube_client, product_name, &product_cluster).await { - Ok(credentials) => credentials, - Err(credentials::Error::NoSecret) => None, - Err(credentials::Error::KubeClientFetchError { source }) => { - return Err(Error::KubeClientFetchError { source }) - } - }; + let credentials = match credentials::get(&kube_client, product_name, &product_cluster).await { + Ok(credentials) => credentials, + Err(credentials::Error::NoSecret) => None, + Err(credentials::Error::KubeClientFetchError { source }) => { + return Err(Error::KubeClientFetchError { source }) + } + }; Ok(credentials) } async fn list_stackable_stacklets( - kube_client: &KubeClient, + kube_client: &k8s::Client, namespace: Option<&str>, ) -> Result, Error> { let product_list = build_products_gvk_list(PRODUCT_NAMES); @@ -152,7 +148,7 @@ async fn list_stackable_stacklets( }; let endpoints = - get_service_endpoints(kube_client, product_name, &object_name, &object_namespace) + service::get_endpoints(kube_client, product_name, &object_name, &object_namespace) .await .context(ServiceSnafu)?; diff --git a/rust/stackable-cockpit/src/platform/stacklet/opensearch.rs b/rust/stackable-cockpit/src/platform/stacklet/opensearch.rs index c604e316..d866bc63 100644 --- a/rust/stackable-cockpit/src/platform/stacklet/opensearch.rs +++ b/rust/stackable-cockpit/src/platform/stacklet/opensearch.rs @@ -3,14 +3,14 @@ use snafu::ResultExt; use crate::{ platform::{ - service::get_service_endpoint_urls, + service::get_endpoint_urls, stacklet::{Error, KubeClientFetchSnafu, ServiceSnafu, Stacklet}, }, - utils::k8s::{KubeClient, ListParamsExt, ProductLabel}, + utils::k8s::{Client, ListParamsExt, ProductLabel}, }; pub(super) async fn list( - kube_client: &KubeClient, + kube_client: &Client, namespace: Option<&str>, ) -> Result, Error> { let mut stacklets = Vec::new(); @@ -23,7 +23,7 @@ pub(super) async fn list( for service in services { let service_name = service.name_any(); - let endpoints = get_service_endpoint_urls(kube_client, &service, &service_name) + let endpoints = get_endpoint_urls(kube_client, &service, &service_name) .await .context(ServiceSnafu)?; diff --git a/rust/stackable-cockpit/src/platform/stacklet/prometheus.rs b/rust/stackable-cockpit/src/platform/stacklet/prometheus.rs index d39358d2..a0d3dcac 100644 --- a/rust/stackable-cockpit/src/platform/stacklet/prometheus.rs +++ b/rust/stackable-cockpit/src/platform/stacklet/prometheus.rs @@ -3,14 +3,14 @@ use snafu::ResultExt; use crate::{ platform::{ - service::get_service_endpoint_urls, + service::get_endpoint_urls, stacklet::{Error, KubeClientFetchSnafu, ServiceSnafu, Stacklet}, }, - utils::k8s::KubeClient, + utils::k8s::Client, }; pub(super) async fn list( - kube_client: &KubeClient, + kube_client: &Client, namespace: Option<&str>, ) -> Result, Error> { let mut stacklets = Vec::new(); @@ -24,7 +24,7 @@ pub(super) async fn list( for service in services { let service_name = service.name_any(); - let endpoints = get_service_endpoint_urls(kube_client, &service, &service_name) + let endpoints = get_endpoint_urls(kube_client, &service, &service_name) .await .context(ServiceSnafu)?; diff --git a/rust/stackable-cockpit/src/utils/k8s/client.rs b/rust/stackable-cockpit/src/utils/k8s/client.rs index 0566ce89..9a789b70 100644 --- a/rust/stackable-cockpit/src/utils/k8s/client.rs +++ b/rust/stackable-cockpit/src/utils/k8s/client.rs @@ -8,27 +8,24 @@ use kube::{ api::{ListParams, Patch, PatchParams, PostParams}, core::{DynamicObject, GroupVersionKind, ObjectList, ObjectMeta, TypeMeta}, discovery::Scope, - Api, Client, Discovery, ResourceExt, + Api, Discovery, ResourceExt, }; use serde::Deserialize; use snafu::{OptionExt, ResultExt, Snafu}; use crate::{ - platform::{ - cluster::{ClusterInfo, Error}, - credentials::Credentials, - }, + platform::{cluster, credentials::Credentials}, utils::k8s::ByteStringExt, }; #[cfg(doc)] use crate::utils::k8s::ListParamsExt; -pub type ListResult = Result, E>; -pub type Result = std::result::Result; +pub type ListResult = Result, E>; +pub type Result = std::result::Result; #[derive(Debug, Snafu)] -pub enum KubeClientError { +pub enum Error { #[snafu(display("kubernetes error"))] KubeError { source: kube::error::Error }, @@ -48,7 +45,7 @@ pub enum KubeClientError { MissingServiceNamespace { service: String }, #[snafu(display("failed to retrieve cluster information"))] - ClusterError { source: Error }, + ClusterError { source: cluster::Error }, #[snafu(display("invalid or empty secret data in '{secret_name}'"))] InvalidSecretData { secret_name: String }, @@ -60,16 +57,16 @@ pub enum KubeClientError { NoPasswordKey { secret_name: String }, } -pub struct KubeClient { - client: Client, +pub struct Client { + client: kube::Client, discovery: Discovery, } -impl KubeClient { +impl Client { /// Tries to create a new default Kubernetes client and immediately runs /// a discovery. pub async fn new() -> Result { - let client = Client::try_default().await.context(KubeSnafu)?; + let client = kube::Client::try_default().await.context(KubeSnafu)?; let discovery = Discovery::new(client.clone()) .run() .await @@ -128,7 +125,7 @@ impl KubeClient { &self, gvk: &GroupVersionKind, namespace: Option<&str>, - ) -> Result>, KubeClientError> { + ) -> Result>, Error> { let object_api_resource = match self.discovery.resolve_gvk(gvk) { Some((object_api_resource, _)) => object_api_resource, None => { @@ -156,7 +153,7 @@ impl KubeClient { namespace: &str, object_name: &str, gvk: &GroupVersionKind, - ) -> Result, KubeClientError> { + ) -> Result, Error> { let object_api_resource = match self.discovery.resolve_gvk(gvk) { Some((object_api_resource, _)) => object_api_resource, None => { @@ -318,9 +315,9 @@ impl KubeClient { /// current cluster. It should be noted that [`ClusterInfo`] contains data /// about allocatable resources. These values don't reflect currently /// available resources. - pub async fn get_cluster_info(&self) -> Result { + pub async fn get_cluster_info(&self) -> Result { let nodes = self.list_nodes().await?; - ClusterInfo::from_nodes(nodes).context(ClusterSnafu) + cluster::ClusterInfo::from_nodes(nodes).context(ClusterSnafu) } pub async fn get_endpoints(&self, namespace: &str, name: &str) -> Result { diff --git a/rust/stackable-cockpit/src/xfer/cache.rs b/rust/stackable-cockpit/src/xfer/cache.rs index ab1ea279..b027a88d 100644 --- a/rust/stackable-cockpit/src/xfer/cache.rs +++ b/rust/stackable-cockpit/src/xfer/cache.rs @@ -36,7 +36,7 @@ pub enum Error { #[derive(Debug)] pub struct Cache { pub(crate) auto_purge_interval: Duration, - pub(crate) backend: CacheBackend, + pub(crate) backend: Backend, pub(crate) max_age: Duration, } @@ -44,8 +44,8 @@ impl Cache { /// Returns wether the cache is enabled. pub fn is_enabled(&self) -> bool { match self.backend { - CacheBackend::Disk { .. } => true, - CacheBackend::Disabled => false, + Backend::Disk { .. } => true, + Backend::Disabled => false, } } @@ -55,13 +55,13 @@ impl Cache { /// read from within the cache base path. The status is indicated by /// [`CacheStatus`]. An error is returned when the cache was unable to read /// data from disk. - pub async fn retrieve(&self, file_url: &Url) -> Result> { + pub async fn retrieve(&self, file_url: &Url) -> Result> { match &self.backend { - CacheBackend::Disk { base_path } => { + Backend::Disk { base_path } => { let file_path = Self::file_path(base_path, file_url); if !file_path.is_file() { - return Ok(CacheStatus::Miss); + return Ok(Status::Miss); } let modified = file_path @@ -73,13 +73,13 @@ impl Cache { let elapsed = modified.elapsed().context(SystemTimeSnafu {})?; if elapsed > self.max_age { - return Ok(CacheStatus::Expired); + return Ok(Status::Expired); } let content = Self::read(file_path).await?; - Ok(CacheStatus::Hit(content)) + Ok(Status::Hit(content)) } - CacheBackend::Disabled => Ok(CacheStatus::Miss), + Backend::Disabled => Ok(Status::Miss), } } @@ -88,11 +88,11 @@ impl Cache { /// or the cache is disabled. pub async fn store(&self, file_url: &Url, file_content: &str) -> Result<()> { match &self.backend { - CacheBackend::Disk { base_path } => { + Backend::Disk { base_path } => { let file_path = Self::file_path(base_path, file_url); Self::write(file_path, file_content).await } - CacheBackend::Disabled => Ok(()), + Backend::Disabled => Ok(()), } } @@ -101,7 +101,7 @@ impl Cache { /// by the cache. pub async fn list(&self) -> Result> { match &self.backend { - CacheBackend::Disk { base_path } => { + Backend::Disk { base_path } => { let mut files = Vec::new(); let mut entries = fs::read_dir(base_path).await.context(CacheIoSnafu)?; @@ -119,7 +119,7 @@ impl Cache { Ok(files) } - CacheBackend::Disabled => Ok(vec![]), + Backend::Disabled => Ok(vec![]), } } @@ -127,7 +127,7 @@ impl Cache { /// recreating it. pub async fn purge(&self, delete_filter: DeleteFilter) -> Result<()> { match &self.backend { - CacheBackend::Disk { base_path } => { + Backend::Disk { base_path } => { let mut entries = fs::read_dir(base_path).await.context(CacheIoSnafu)?; while let Some(entry) = entries.next_entry().await.context(CacheIoSnafu)? { @@ -157,13 +157,13 @@ impl Cache { Ok(()) } - CacheBackend::Disabled => Ok(()), + Backend::Disabled => Ok(()), } } pub async fn auto_purge(&self) -> Result<()> { match &self.backend { - CacheBackend::Disk { base_path } => { + Backend::Disk { base_path } => { let cache_auto_purge_filepath = base_path.join(CACHE_LAST_AUTO_PURGE_FILEPATH); // Read and covert timestamp @@ -189,11 +189,11 @@ impl Cache { Ok(()) } - CacheBackend::Disabled => Ok(()), + Backend::Disabled => Ok(()), } } - fn new(backend: CacheBackend, max_age: Duration, auto_purge_interval: Duration) -> Self { + fn new(backend: Backend, max_age: Duration, auto_purge_interval: Duration) -> Self { Self { auto_purge_interval, backend, @@ -225,21 +225,21 @@ impl Cache { } } -pub enum CacheStatus { +pub enum Status { Hit(T), Expired, Miss, } #[derive(Debug, Clone)] -pub struct CacheSettings { +pub struct Settings { pub auto_purge_interval: Duration, - pub backend: CacheBackend, + pub backend: Backend, pub max_age: Duration, } -impl From for CacheSettings { - fn from(backend: CacheBackend) -> Self { +impl From for Settings { + fn from(backend: Backend) -> Self { Self { auto_purge_interval: DEFAULT_AUTO_PURGE_INTERVAL, max_age: DEFAULT_CACHE_MAX_AGE, @@ -248,16 +248,16 @@ impl From for CacheSettings { } } -impl CacheSettings { +impl Settings { pub fn disk(base_path: impl Into) -> Self { - CacheBackend::Disk { + Backend::Disk { base_path: base_path.into(), } .into() } pub fn disabled() -> Self { - CacheBackend::Disabled.into() + Backend::Disabled.into() } /// Creates a new [`Cache`] instance with the provided `settings`. It also @@ -265,7 +265,7 @@ impl CacheSettings { /// needed for operation are created. pub async fn try_into_cache(self) -> Result { match &self.backend { - CacheBackend::Disk { base_path } => { + Backend::Disk { base_path } => { fs::create_dir_all(base_path).await.context(CacheIoSnafu)?; Ok(Cache::new( @@ -274,7 +274,7 @@ impl CacheSettings { self.auto_purge_interval, )) } - CacheBackend::Disabled => Ok(Cache::new( + Backend::Disabled => Ok(Cache::new( self.backend, self.max_age, self.auto_purge_interval, @@ -284,7 +284,7 @@ impl CacheSettings { } #[derive(Debug, Clone)] -pub enum CacheBackend { +pub enum Backend { Disk { base_path: PathBuf }, Disabled, } diff --git a/rust/stackable-cockpit/src/xfer/mod.rs b/rust/stackable-cockpit/src/xfer/mod.rs index 855ebfb3..15f28cb3 100644 --- a/rust/stackable-cockpit/src/xfer/mod.rs +++ b/rust/stackable-cockpit/src/xfer/mod.rs @@ -10,15 +10,15 @@ pub mod processor; use crate::{ utils::path::PathOrUrl, xfer::{ - cache::{Cache, CacheSettings, CacheStatus}, + cache::{Cache, Settings, Status}, processor::{Processor, ProcessorError}, }, }; -type Result = core::result::Result; +type Result = core::result::Result; #[derive(Debug, Snafu)] -pub enum FileTransferError { +pub enum Error { #[snafu(display("failed to read local file"))] ReadLocalFile { source: std::io::Error }, @@ -42,14 +42,14 @@ pub enum FileTransferError { } #[derive(Debug)] -pub struct FileTransferClient { +pub struct Client { pub(crate) client: reqwest::Client, pub(crate) cache: Cache, } -impl FileTransferClient { +impl Client { /// Creates a new [`FileTransferClient`] with caching capabilities. - pub async fn new(cache_settings: CacheSettings) -> Result { + pub async fn new(cache_settings: Settings) -> Result { let cache = cache_settings .try_into_cache() .await @@ -90,8 +90,8 @@ impl FileTransferClient { /// or is expired. async fn get_from_cache_or_remote(&self, url: &Url) -> Result { match self.cache.retrieve(url).await.context(CacheRetrieveSnafu)? { - CacheStatus::Hit(content) => Ok(content), - CacheStatus::Expired | CacheStatus::Miss => { + Status::Hit(content) => Ok(content), + Status::Expired | Status::Miss => { let content = self.get_from_remote(url).await?; self.cache .store(url, &content) diff --git a/rust/stackablectl/src/args/cluster.rs b/rust/stackablectl/src/args/cluster.rs index 7845bb10..66c1fb22 100644 --- a/rust/stackablectl/src/args/cluster.rs +++ b/rust/stackablectl/src/args/cluster.rs @@ -3,10 +3,7 @@ use snafu::{ensure, ResultExt, Snafu}; use stackable_cockpit::{ constants::DEFAULT_LOCAL_CLUSTER_NAME, - engine::{ - kind::{self, KindCluster}, - minikube::{self, MinikubeCluster}, - }, + engine::{kind, minikube}, }; #[derive(Debug, Snafu)] @@ -90,7 +87,7 @@ impl CommonClusterArgs { match cluster_type { ClusterType::Kind => { let kind_cluster = - KindCluster::new(self.cluster_nodes, self.cluster_cp_nodes, name); + kind::Cluster::new(self.cluster_nodes, self.cluster_cp_nodes, name); kind_cluster .create_if_not_exists() @@ -98,7 +95,7 @@ impl CommonClusterArgs { .context(KindClusterSnafu) } ClusterType::Minikube => { - let minikube_cluster = MinikubeCluster::new(self.cluster_nodes, name); + let minikube_cluster = minikube::Cluster::new(self.cluster_nodes, name); minikube_cluster .create_if_not_exists() diff --git a/rust/stackablectl/src/cli/mod.rs b/rust/stackablectl/src/cli/mod.rs index 6cde08e7..0934b14a 100644 --- a/rust/stackablectl/src/cli/mod.rs +++ b/rust/stackablectl/src/cli/mod.rs @@ -12,7 +12,7 @@ use stackable_cockpit::{ utils::path::{ IntoPathOrUrl, IntoPathsOrUrls, ParsePathsOrUrls, PathOrUrl, PathOrUrlParseError, }, - xfer::{cache::CacheSettings, FileTransferClient}, + xfer::{cache::Settings, Client}, }; use crate::{ @@ -98,7 +98,7 @@ impl Cli { Ok(files) } - pub async fn get_demo_list(&self, transfer_client: &FileTransferClient) -> List { + pub async fn get_demo_list(&self, transfer_client: &Client) -> List { let files = self.get_demo_files().unwrap(); List::build(&files, transfer_client).await.unwrap() } @@ -146,9 +146,9 @@ impl Cli { } #[instrument] - pub fn cache_settings(&self) -> Result { + pub fn cache_settings(&self) -> Result { if self.no_cache { - Ok(CacheSettings::disabled()) + Ok(Settings::disabled()) } else { let project_dir = ProjectDirs::from( USER_DIR_QUALIFIER, @@ -157,7 +157,7 @@ impl Cli { ) .ok_or(CacheSettingsError::UserDir)?; - Ok(CacheSettings::disk(project_dir.cache_dir())) + Ok(Settings::disk(project_dir.cache_dir())) } } diff --git a/rust/stackablectl/src/cmds/demo.rs b/rust/stackablectl/src/cmds/demo.rs index 562d39dc..6f5d0b76 100644 --- a/rust/stackablectl/src/cmds/demo.rs +++ b/rust/stackablectl/src/cmds/demo.rs @@ -11,7 +11,7 @@ use stackable_cockpit::{ constants::{DEFAULT_OPERATOR_NAMESPACE, DEFAULT_PRODUCT_NAMESPACE}, platform::{demo, namespace, release, stack}, utils::path::PathOrUrlParseError, - xfer::{cache::Cache, FileTransferClient, FileTransferError}, + xfer::{cache::Cache, Client, Error}, }; use crate::{ @@ -132,7 +132,7 @@ pub enum CmdError { CommonClusterArgsError { source: CommonClusterArgsError }, #[snafu(display("file transfer error"))] - TransferError { source: FileTransferError }, + TransferError { source: Error }, #[snafu(display("failed to create namespace '{namespace}'"))] NamespaceError { @@ -146,7 +146,7 @@ impl DemoArgs { pub async fn run(&self, cli: &Cli, cache: Cache) -> Result { debug!("Handle demo args"); - let transfer_client = FileTransferClient::new_with(cache); + let transfer_client = Client::new_with(cache); // Build demo list based on the (default) remote demo file, and additional files provided by the // STACKABLE_DEMO_FILES env variable or the --demo-files CLI argument. @@ -261,7 +261,7 @@ async fn install_cmd( args: &DemoInstallArgs, cli: &Cli, list: demo::List, - transfer_client: &FileTransferClient, + transfer_client: &Client, ) -> Result { info!("Installing demo {}", args.demo_name); diff --git a/rust/stackablectl/src/cmds/operator.rs b/rust/stackablectl/src/cmds/operator.rs index 6e3813f6..3ac388b0 100644 --- a/rust/stackablectl/src/cmds/operator.rs +++ b/rust/stackablectl/src/cmds/operator.rs @@ -15,7 +15,7 @@ use stackable_cockpit::{ constants::{ DEFAULT_OPERATOR_NAMESPACE, HELM_REPO_NAME_DEV, HELM_REPO_NAME_STABLE, HELM_REPO_NAME_TEST, }, - helm::{self, HelmRelease, HelmRepo}, + helm::{self, Release, Repository}, platform::{namespace, operator}, utils, }; @@ -353,7 +353,7 @@ fn uninstall_cmd(args: &OperatorUninstallArgs, cli: &Cli) -> Result Result { debug!("Listing installed operators"); - type ReleaseList = IndexMap; + type ReleaseList = IndexMap; let installed: ReleaseList = helm::list_releases(&args.operator_namespace) .context(HelmSnafu)? @@ -417,7 +417,7 @@ fn installed_cmd(args: &OperatorInstalledArgs, cli: &Cli) -> Result() -> Result, CmdError> { +async fn build_helm_index_file_list<'a>() -> Result, CmdError> { debug!("Building Helm index file list"); let mut helm_index_files = HashMap::new(); @@ -445,7 +445,7 @@ async fn build_helm_index_file_list<'a>() -> Result, /// by stable, test and dev lines based on the list of Helm repo index files. #[instrument] fn build_versions_list( - helm_index_files: &HashMap<&str, HelmRepo>, + helm_index_files: &HashMap<&str, Repository>, ) -> Result, CmdError> { debug!("Building versions list"); @@ -468,7 +468,7 @@ fn build_versions_list( #[instrument] fn build_versions_list_for_operator( operator_name: T, - helm_index_files: &HashMap<&str, HelmRepo>, + helm_index_files: &HashMap<&str, Repository>, ) -> Result where T: AsRef + std::fmt::Debug, @@ -493,7 +493,7 @@ where #[instrument] fn list_operator_versions_from_repo( operator_name: T, - helm_repo: &HelmRepo, + helm_repo: &Repository, ) -> Result, CmdError> where T: AsRef + std::fmt::Debug, diff --git a/rust/stackablectl/src/cmds/release.rs b/rust/stackablectl/src/cmds/release.rs index 64c6e523..8b7f305b 100644 --- a/rust/stackablectl/src/cmds/release.rs +++ b/rust/stackablectl/src/cmds/release.rs @@ -9,12 +9,9 @@ use tracing::{debug, info, instrument}; use stackable_cockpit::{ common::list, constants::DEFAULT_OPERATOR_NAMESPACE, - platform::{ - namespace::{self, Error}, - release::{InstallError, List, UninstallError}, - }, + platform::{namespace, release}, utils::path::PathOrUrlParseError, - xfer::{cache::Cache, FileTransferClient, FileTransferError}, + xfer::{cache::Cache, Client, Error}, }; use crate::{ @@ -110,30 +107,33 @@ pub enum CmdError { ListError { source: list::Error }, #[snafu(display("release install error"))] - ReleaseInstallError { source: InstallError }, + ReleaseInstallError { source: release::Error }, #[snafu(display("release uninstall error"))] - ReleaseUninstallError { source: UninstallError }, + ReleaseUninstallError { source: release::Error }, #[snafu(display("cluster argument error"))] CommonClusterArgsError { source: CommonClusterArgsError }, #[snafu(display("transfer error"))] - TransferError { source: FileTransferError }, + TransferError { source: Error }, #[snafu(display("failed to create namespace '{namespace}'"))] - NamespaceError { source: Error, namespace: String }, + NamespaceError { + source: namespace::Error, + namespace: String, + }, } impl ReleaseArgs { pub async fn run(&self, cli: &Cli, cache: Cache) -> Result { debug!("Handle release args"); - let transfer_client = FileTransferClient::new_with(cache); + let transfer_client = Client::new_with(cache); let files = cli.get_release_files().context(PathOrUrlParseSnafu)?; - let release_list = List::build(&files, &transfer_client) + let release_list = release::List::build(&files, &transfer_client) .await .context(ListSnafu)?; @@ -154,7 +154,7 @@ impl ReleaseArgs { async fn list_cmd( args: &ReleaseListArgs, cli: &Cli, - release_list: List, + release_list: release::List, ) -> Result { info!("Listing releases"); @@ -204,7 +204,7 @@ async fn list_cmd( async fn describe_cmd( args: &ReleaseDescribeArgs, cli: &Cli, - release_list: List, + release_list: release::List, ) -> Result { info!("Describing release"); @@ -260,7 +260,7 @@ async fn describe_cmd( async fn install_cmd( args: &ReleaseInstallArgs, cli: &Cli, - release_list: List, + release_list: release::List, ) -> Result { info!("Installing release"); @@ -310,7 +310,7 @@ async fn install_cmd( async fn uninstall_cmd( args: &ReleaseUninstallArgs, cli: &Cli, - release_list: List, + release_list: release::List, ) -> Result { info!("Installing release"); diff --git a/rust/stackablectl/src/cmds/stack.rs b/rust/stackablectl/src/cmds/stack.rs index e1b17efc..3cf2e6df 100644 --- a/rust/stackablectl/src/cmds/stack.rs +++ b/rust/stackablectl/src/cmds/stack.rs @@ -11,7 +11,7 @@ use stackable_cockpit::{ constants::{DEFAULT_OPERATOR_NAMESPACE, DEFAULT_PRODUCT_NAMESPACE}, platform::{namespace, release, stack}, utils::path::PathOrUrlParseError, - xfer::{cache::Cache, FileTransferClient, FileTransferError}, + xfer::{cache::Cache, Client, Error}, }; use crate::{ @@ -119,7 +119,7 @@ pub enum CmdError { CommonClusterArgsError { source: CommonClusterArgsError }, #[snafu(display("transfer error"))] - TransferError { source: FileTransferError }, + TransferError { source: Error }, #[snafu(display("failed to create namespace '{namespace}'"))] NamespaceError { @@ -132,7 +132,7 @@ impl StackArgs { pub async fn run(&self, cli: &Cli, cache: Cache) -> Result { debug!("Handle stack args"); - let transfer_client = FileTransferClient::new_with(cache); + let transfer_client = Client::new_with(cache); let files = cli.get_stack_files().context(PathOrUrlParseSnafu)?; let stack_list = stack::List::build(&files, &transfer_client) @@ -253,7 +253,7 @@ async fn install_cmd( args: &StackInstallArgs, cli: &Cli, stack_list: stack::List, - transfer_client: &FileTransferClient, + transfer_client: &Client, ) -> Result { info!("Installing stack {}", args.stack_name); diff --git a/web/src/api/schema.d.ts b/web/src/api/schema.d.ts index ac8d6907..f3bdb6ce 100644 --- a/web/src/api/schema.d.ts +++ b/web/src/api/schema.d.ts @@ -134,7 +134,7 @@ export interface components { SessionToken: string; Stacklet: { /** @description Multiple cluster conditions. */ - conditions: components["schemas"]["DisplayCondition"][]; + conditions: components["schemas"]["k8s.DisplayCondition"][]; /** * @description Endpoint addresses the product is reachable at. * The key is the service name (e.g. `web-ui`), the value is the URL. From 558affdfed338fc5605b9b721701eef5cca08aec Mon Sep 17 00:00:00 2001 From: Techassi Date: Mon, 20 Nov 2023 15:58:40 +0100 Subject: [PATCH 27/40] Remove progress spinner --- Cargo.lock | 40 ------------------- Cargo.toml | 1 - rust/stackable-cockpit/src/engine/kind/mod.rs | 2 - rust/stackablectl/Cargo.toml | 1 - rust/stackablectl/src/cmds/demo.rs | 6 --- rust/stackablectl/src/cmds/release.rs | 5 --- rust/stackablectl/src/cmds/stack.rs | 7 ---- rust/stackablectl/src/output/mod.rs | 25 +----------- 8 files changed, 1 insertion(+), 86 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cf96d013..c05a43b2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -489,17 +489,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" -[[package]] -name = "colored" -version = "2.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2674ec482fbc38012cf31e6c42ba0177b431a0cb6f15fe40efa5aab1bda516f6" -dependencies = [ - "is-terminal", - "lazy_static", - "windows-sys 0.48.0", -] - [[package]] name = "comfy-table" version = "7.1.0" @@ -1302,17 +1291,6 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" -[[package]] -name = "is-terminal" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" -dependencies = [ - "hermit-abi", - "rustix", - "windows-sys 0.48.0", -] - [[package]] name = "itoa" version = "1.0.9" @@ -1807,12 +1785,6 @@ dependencies = [ "regex", ] -[[package]] -name = "paste" -version = "1.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" - [[package]] name = "peeking_take_while" version = "0.1.2" @@ -2615,17 +2587,6 @@ version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" -[[package]] -name = "spinoff" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20aa2ed67fbb202e7b716ff8bfc6571dd9301617767380197d701c31124e88f6" -dependencies = [ - "colored", - "once_cell", - "paste", -] - [[package]] name = "stackable-cockpit" version = "0.0.0-dev" @@ -2746,7 +2707,6 @@ dependencies = [ "serde_json", "serde_yaml", "snafu", - "spinoff", "stackable-cockpit", "tera", "tokio", diff --git a/Cargo.toml b/Cargo.toml index 102970d9..33fde6f5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,7 +43,6 @@ serde_json = "1.0" serde_yaml = "0.9" sha2 = "0.10" snafu = "0.7" -spinoff = "0.8.0" stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "0.55.0" } tera = "1.18" tokio = { version = "1.29.0", features = ["rt-multi-thread", "macros", "fs", "process"] } diff --git a/rust/stackable-cockpit/src/engine/kind/mod.rs b/rust/stackable-cockpit/src/engine/kind/mod.rs index 99e24de5..117b4787 100644 --- a/rust/stackable-cockpit/src/engine/kind/mod.rs +++ b/rust/stackable-cockpit/src/engine/kind/mod.rs @@ -86,8 +86,6 @@ impl Cluster { .args(["create", "cluster"]) .args(["--name", self.name.as_str()]) .args(["--config", "-"]) - .stdout(Stdio::null()) - .stderr(Stdio::null()) .stdin(Stdio::piped()) .spawn() .context(CommandFailedToStartSnafu)?; diff --git a/rust/stackablectl/Cargo.toml b/rust/stackablectl/Cargo.toml index 2422543e..9a4adae1 100644 --- a/rust/stackablectl/Cargo.toml +++ b/rust/stackablectl/Cargo.toml @@ -27,7 +27,6 @@ serde_json.workspace = true serde_yaml.workspace = true serde.workspace = true snafu.workspace = true -spinoff.workspace = true tera.workspace = true tokio.workspace = true tracing-subscriber.workspace = true diff --git a/rust/stackablectl/src/cmds/demo.rs b/rust/stackablectl/src/cmds/demo.rs index 6f5d0b76..90c25047 100644 --- a/rust/stackablectl/src/cmds/demo.rs +++ b/rust/stackablectl/src/cmds/demo.rs @@ -267,7 +267,6 @@ async fn install_cmd( // Init result output and progress output let mut output = cli.result(); - output.enable_progress(format!("Installing demo '{}'", args.demo_name)); let demo_spec = list.get(&args.demo_name).ok_or(CmdError::NoSuchDemo { name: args.demo_name.clone(), @@ -286,7 +285,6 @@ async fn install_cmd( .context(ListSnafu)?; // Install local cluster if needed - output.set_progress_message("Creating local cluster"); args.local_cluster .install_if_needed(None) .await @@ -305,7 +303,6 @@ async fn install_cmd( .unwrap_or(DEFAULT_PRODUCT_NAMESPACE.into()); if !args.skip_release { - output.set_progress_message("Creating operator namespace"); namespace::create_if_needed(operator_namespace.clone()) .await .context(NamespaceSnafu { @@ -313,14 +310,12 @@ async fn install_cmd( })?; } - output.set_progress_message("Creating product namespace"); namespace::create_if_needed(product_namespace.clone()) .await .context(NamespaceSnafu { namespace: product_namespace.clone(), })?; - output.set_progress_message("Installing demo manifests"); demo_spec .install( stack_list, @@ -358,6 +353,5 @@ async fn install_cmd( .with_command_hint(stacklet_cmd, "display the installed stacklets") .with_output(format!("Installed demo '{}'", args.demo_name)); - output.finish_progress("Done"); Ok(output.render()) } diff --git a/rust/stackablectl/src/cmds/release.rs b/rust/stackablectl/src/cmds/release.rs index 8b7f305b..ef4cbc0a 100644 --- a/rust/stackablectl/src/cmds/release.rs +++ b/rust/stackablectl/src/cmds/release.rs @@ -267,24 +267,20 @@ async fn install_cmd( match release_list.get(&args.release) { Some(release) => { let mut output = cli.result(); - output.enable_progress(format!("Installing release '{}'", args.release)); // Install local cluster if needed - output.set_progress_message("Installing local cluster"); args.local_cluster .install_if_needed(None) .await .context(CommonClusterArgsSnafu)?; // Create operator namespace if needed - output.set_progress_message("Creating operator namespace"); namespace::create_if_needed(args.operator_namespace.clone()) .await .context(NamespaceSnafu { namespace: args.operator_namespace.clone(), })?; - output.set_progress_message("Installing release manifests"); release .install( &args.included_products, @@ -300,7 +296,6 @@ async fn install_cmd( ) .with_output(format!("Installed release '{}'", args.release)); - output.finish_progress("Done"); Ok(output.render()) } None => Ok("No such release".into()), diff --git a/rust/stackablectl/src/cmds/stack.rs b/rust/stackablectl/src/cmds/stack.rs index 3cf2e6df..b4286d9b 100644 --- a/rust/stackablectl/src/cmds/stack.rs +++ b/rust/stackablectl/src/cmds/stack.rs @@ -278,10 +278,8 @@ async fn install_cmd( match stack_list.get(&args.stack_name) { Some(stack_spec) => { let mut output = cli.result(); - output.enable_progress(format!("Installing stack '{}'", args.stack_name)); // Install local cluster if needed - output.set_progress_message("Creating local cluster"); args.local_cluster .install_if_needed(None) .await @@ -295,14 +293,12 @@ async fn install_cmd( // Install release if not opted out if !args.skip_release { - output.set_progress_message("Creating operator namespace"); namespace::create_if_needed(operator_namespace.clone()) .await .context(NamespaceSnafu { namespace: operator_namespace.clone(), })?; - output.set_progress_message("Installing release manifests"); stack_spec .install_release(release_list, &operator_namespace, &product_namespace) .await @@ -312,7 +308,6 @@ async fn install_cmd( } // Create product namespace if needed - output.set_progress_message("Creating product namespace"); namespace::create_if_needed(product_namespace.clone()) .await .context(NamespaceSnafu { @@ -320,7 +315,6 @@ async fn install_cmd( })?; // Install stack - output.set_progress_message("Installing stack manifests"); stack_spec .install_stack_manifests( &args.stack_parameters, @@ -353,7 +347,6 @@ async fn install_cmd( .with_command_hint(stacklet_cmd, "display the installed stacklets") .with_output(format!("Installed stack '{}'", args.stack_name)); - output.finish_progress("Done"); Ok(output.render()) } None => Ok("No such stack".into()), diff --git a/rust/stackablectl/src/output/mod.rs b/rust/stackablectl/src/output/mod.rs index 70a71ad4..83fc32d6 100644 --- a/rust/stackablectl/src/output/mod.rs +++ b/rust/stackablectl/src/output/mod.rs @@ -4,7 +4,6 @@ use std::{ }; use snafu::{ResultExt, Snafu}; -use spinoff::{spinners, Color, Spinner}; use tera::Tera; mod error; @@ -93,7 +92,6 @@ pub struct Output where C: ContextExt, { - progress: Option, renderer: Tera, context: C, } @@ -107,28 +105,7 @@ where let no_color = use_colored_output(!no_color); context.set_no_color(no_color); - Ok(Self { - progress: None, - renderer, - context, - }) - } - - pub fn enable_progress(&mut self, initial_message: String) { - self.progress - .get_or_insert(Spinner::new(spinners::Dots, initial_message, Color::Green)); - } - - pub fn set_progress_message(&mut self, message: impl Into) { - if let Some(progress) = self.progress.as_mut() { - progress.update_text(message.into()) - } - } - - pub fn finish_progress(&mut self, message: impl AsRef) { - if let Some(progress) = self.progress.as_mut() { - progress.success(message.as_ref()) - } + Ok(Self { renderer, context }) } pub fn render(self) -> String { From 4d8c29f9a9a2b8cd3b2c08c1c12ac7e437e399a8 Mon Sep 17 00:00:00 2001 From: Techassi Date: Mon, 20 Nov 2023 16:09:27 +0100 Subject: [PATCH 28/40] Fix rustdoc errors --- rust/stackable-cockpit/src/utils/k8s/client.rs | 8 ++++---- rust/stackable-cockpit/src/xfer/cache.rs | 2 +- rust/stackable-cockpit/src/xfer/mod.rs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/rust/stackable-cockpit/src/utils/k8s/client.rs b/rust/stackable-cockpit/src/utils/k8s/client.rs index 9a789b70..8e609f95 100644 --- a/rust/stackable-cockpit/src/utils/k8s/client.rs +++ b/rust/stackable-cockpit/src/utils/k8s/client.rs @@ -311,10 +311,10 @@ impl Client { Ok(()) } - /// Retrieves [`ClusterInfo`] which contains resource information for the - /// current cluster. It should be noted that [`ClusterInfo`] contains data - /// about allocatable resources. These values don't reflect currently - /// available resources. + /// Retrieves [`ClusterInfo`][cluster::ClusterInfo] which contains resource + /// information for the current cluster. It should be noted that + /// [`ClusterInfo`][cluster::ClusterInfo] contains data about allocatable + /// resources. These values don't reflect currently available resources. pub async fn get_cluster_info(&self) -> Result { let nodes = self.list_nodes().await?; cluster::ClusterInfo::from_nodes(nodes).context(ClusterSnafu) diff --git a/rust/stackable-cockpit/src/xfer/cache.rs b/rust/stackable-cockpit/src/xfer/cache.rs index b027a88d..69f06621 100644 --- a/rust/stackable-cockpit/src/xfer/cache.rs +++ b/rust/stackable-cockpit/src/xfer/cache.rs @@ -53,7 +53,7 @@ impl Cache { /// the `file_name` should only contain the file name and extension without /// any path segments prefixed. The cache internally makes sure the file is /// read from within the cache base path. The status is indicated by - /// [`CacheStatus`]. An error is returned when the cache was unable to read + /// [`Status`]. An error is returned when the cache was unable to read /// data from disk. pub async fn retrieve(&self, file_url: &Url) -> Result> { match &self.backend { diff --git a/rust/stackable-cockpit/src/xfer/mod.rs b/rust/stackable-cockpit/src/xfer/mod.rs index 15f28cb3..03af5ffb 100644 --- a/rust/stackable-cockpit/src/xfer/mod.rs +++ b/rust/stackable-cockpit/src/xfer/mod.rs @@ -48,7 +48,7 @@ pub struct Client { } impl Client { - /// Creates a new [`FileTransferClient`] with caching capabilities. + /// Creates a new [`Client`] with caching capabilities. pub async fn new(cache_settings: Settings) -> Result { let cache = cache_settings .try_into_cache() From a121178738391392a80697857b6efddfc89ca611 Mon Sep 17 00:00:00 2001 From: Techassi Date: Tue, 21 Nov 2023 12:03:52 +0100 Subject: [PATCH 29/40] Remove color support --- Cargo.lock | 22 ---------------------- Cargo.toml | 1 - rust/stackablectl/Cargo.toml | 1 - rust/stackablectl/src/cli/mod.rs | 4 ++-- rust/stackablectl/src/cmds/stacklet.rs | 7 +++---- rust/stackablectl/src/output/mod.rs | 12 ++---------- rust/stackablectl/src/output/result.rs | 15 +++------------ 7 files changed, 10 insertions(+), 52 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c05a43b2..332ed13d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -462,27 +462,6 @@ dependencies = [ "roff", ] -[[package]] -name = "color-print" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a858372ff14bab9b1b30ea504f2a4bc534582aee3e42ba2d41d2a7baba63d5d" -dependencies = [ - "color-print-proc-macro", -] - -[[package]] -name = "color-print-proc-macro" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57e37866456a721d0a404439a1adae37a31be4e0055590d053dfe6981e05003f" -dependencies = [ - "nom", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "colorchoice" version = "1.0.0" @@ -2694,7 +2673,6 @@ version = "1.0.0-rc3" dependencies = [ "clap", "clap_complete", - "color-print", "comfy-table", "directories", "dotenvy", diff --git a/Cargo.toml b/Cargo.toml index 33fde6f5..077e4484 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,6 @@ bindgen = "0.68.1" cc = "1.0.83" clap = { version = "4.2.1", features = ["derive", "env"] } clap_complete = "4.2" -color-print = "0.3.5" comfy-table = { version = "7.0", features = ["custom_styling"] } directories = "5.0" dotenvy = "0.15" diff --git a/rust/stackablectl/Cargo.toml b/rust/stackablectl/Cargo.toml index 9a4adae1..3811963d 100644 --- a/rust/stackablectl/Cargo.toml +++ b/rust/stackablectl/Cargo.toml @@ -14,7 +14,6 @@ stackable-cockpit = { path = "../stackable-cockpit", features = ["openapi"] } clap_complete.workspace = true clap.workspace = true -color-print.workspace = true comfy-table.workspace = true directories.workspace = true dotenvy.workspace = true diff --git a/rust/stackablectl/src/cli/mod.rs b/rust/stackablectl/src/cli/mod.rs index 0934b14a..8bc57f2e 100644 --- a/rust/stackablectl/src/cli/mod.rs +++ b/rust/stackablectl/src/cli/mod.rs @@ -196,11 +196,11 @@ impl Cli { // Output utility functions pub fn result(&self) -> Output { - Output::new(ResultContext::default(), false).expect("Failed to create output renderer") + Output::new(ResultContext::default(), true).expect("Failed to create output renderer") } pub fn error(&self) -> Output { - Output::new(ErrorContext::default(), false).expect("Failed to create output renderer") + Output::new(ErrorContext::default(), true).expect("Failed to create output renderer") } } diff --git a/rust/stackablectl/src/cmds/stacklet.rs b/rust/stackablectl/src/cmds/stacklet.rs index 98fabfec..3bbaa2b1 100644 --- a/rust/stackablectl/src/cmds/stacklet.rs +++ b/rust/stackablectl/src/cmds/stacklet.rs @@ -262,8 +262,7 @@ fn render_condition_error( ) -> Option { if !is_good.unwrap_or(true) { let message = message.unwrap_or("-".into()); - let error = color_print::cformat!("[{}]: {}", error_index, message); - return Some(error); + return Some(format!("[{}]: {}", error_index, message)); } None @@ -275,9 +274,9 @@ fn color_condition(condition: &str, is_good: Option, error_index: usize) - match is_good { Some(is_good) => { if is_good { - color_print::cformat!("{}", condition) + condition.to_owned() } else { - color_print::cformat!("{}: See [{}]", condition, error_index) + format!("{}: See [{}]", condition, error_index) } } None => condition.to_owned(), diff --git a/rust/stackablectl/src/output/mod.rs b/rust/stackablectl/src/output/mod.rs index 83fc32d6..6c9790d1 100644 --- a/rust/stackablectl/src/output/mod.rs +++ b/rust/stackablectl/src/output/mod.rs @@ -52,11 +52,7 @@ where let mut report = String::new(); // Print top most error - write!( - report, - "{}", - color_print::cformat!("An unrecoverable error occured: {}\n\n", self) - )?; + write!(report, "An unrecoverable error occured: {}\n\n", self)?; writeln!( report, "Caused by these errors (recent errors listed first):" @@ -74,11 +70,7 @@ where &source_string }; - writeln!( - report, - "{}", - color_print::cformat!(" {}: {}", index, cleaned) - )?; + writeln!(report, " {}: {}", index, cleaned)?; error = source; index += 1; diff --git a/rust/stackablectl/src/output/result.rs b/rust/stackablectl/src/output/result.rs index b5654219..9d166014 100644 --- a/rust/stackablectl/src/output/result.rs +++ b/rust/stackablectl/src/output/result.rs @@ -54,21 +54,12 @@ impl ResultContext { command: impl Into, description: impl Into, ) -> &mut Self { - // let hint = if self.no_color { - // format!("Use \"{}\" to {}.", command.into(), description.into()) - // } else { - // color_print::cformat!( - // "Use \"{}\" to {}.", - // command.into(), - // description.into() - // ) - // }; - - self.command_hints.push(color_print::cformat!( - "Use \"{}\" to {}.", + self.command_hints.push(format!( + "Use \"{}\" to {}.", command.into(), description.into() )); + self } } From d05d3dfd9742968173fd69776ef7980d8c1c2e27 Mon Sep 17 00:00:00 2001 From: Techassi Date: Mon, 27 Nov 2023 14:58:33 +0100 Subject: [PATCH 30/40] Bump operator-rs version --- Cargo.lock | 203 ++++++++++++++++++++++++++++++++++++----------------- Cargo.toml | 2 +- 2 files changed, 139 insertions(+), 66 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 332ed13d..73522213 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -599,38 +599,14 @@ dependencies = [ "typenum", ] -[[package]] -name = "darling" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850" -dependencies = [ - "darling_core 0.14.4", - "darling_macro 0.14.4", -] - [[package]] name = "darling" version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" dependencies = [ - "darling_core 0.20.3", - "darling_macro 0.20.3", -] - -[[package]] -name = "darling_core" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn 1.0.109", + "darling_core", + "darling_macro", ] [[package]] @@ -647,24 +623,13 @@ dependencies = [ "syn 2.0.39", ] -[[package]] -name = "darling_macro" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" -dependencies = [ - "darling_core 0.14.4", - "quote", - "syn 1.0.109", -] - [[package]] name = "darling_macro" version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ - "darling_core 0.20.3", + "darling_core", "quote", "syn 2.0.39", ] @@ -743,6 +708,20 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" +[[package]] +name = "dockerfile-parser" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75799314f5fa405629a365a1f97d80f81edd17f22a0fc9c8ddb3ad191ad8dc08" +dependencies = [ + "enquote", + "lazy_static", + "pest", + "pest_derive", + "regex", + "snafu 0.6.10", +] + [[package]] name = "dotenvy" version = "0.15.7" @@ -776,6 +755,15 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "enquote" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06c36cb11dbde389f4096111698d8b567c0720e3452fd5ac3e6b4e47e1939932" +dependencies = [ + "thiserror", +] + [[package]] name = "equivalent" version = "1.0.1" @@ -1044,7 +1032,7 @@ version = "0.0.0-dev" dependencies = [ "bindgen", "cc", - "snafu", + "snafu 0.7.5", ] [[package]] @@ -1341,8 +1329,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8647c2211a9b480d910b155d573602c52cd5f646acecb06a03d594865dc4784" dependencies = [ "k8s-openapi", - "kube-client", - "kube-core", + "kube-client 0.86.0", + "kube-core 0.86.0", +] + +[[package]] +name = "kube" +version = "0.87.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e34392aea935145070dcd5b39a6dea689ac6534d7d117461316c3d157b1d0fc3" +dependencies = [ + "k8s-openapi", + "kube-client 0.87.1", + "kube-core 0.87.1", "kube-derive", "kube-runtime", ] @@ -1366,7 +1365,43 @@ dependencies = [ "hyper-timeout", "jsonpath_lib", "k8s-openapi", - "kube-core", + "kube-core 0.86.0", + "pem", + "pin-project", + "rustls", + "rustls-pemfile", + "secrecy", + "serde", + "serde_json", + "serde_yaml", + "thiserror", + "tokio", + "tokio-util", + "tower", + "tower-http", + "tracing", +] + +[[package]] +name = "kube-client" +version = "0.87.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7266548b9269d9fa19022620d706697e64f312fb2ba31b93e6986453fcc82c92" +dependencies = [ + "base64 0.21.5", + "bytes", + "chrono", + "either", + "futures", + "home", + "http", + "http-body", + "hyper", + "hyper-rustls", + "hyper-timeout", + "jsonpath_lib", + "k8s-openapi", + "kube-core 0.87.1", "pem", "pin-project", "rustls", @@ -1388,6 +1423,22 @@ name = "kube-core" version = "0.86.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7608a0cd05dfa36167d2da982bb70f17feb5450f73ec601f6d428bbcf991c5b9" +dependencies = [ + "chrono", + "form_urlencoded", + "http", + "k8s-openapi", + "once_cell", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "kube-core" +version = "0.87.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8321c315b96b59f59ef6b33f604b84b905ab8f9ff114a4f909d934c520227b1" dependencies = [ "chrono", "form_urlencoded", @@ -1403,22 +1454,22 @@ dependencies = [ [[package]] name = "kube-derive" -version = "0.86.0" +version = "0.87.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8dd623cf49cd632da4727a70e05d9cb948d5ea1098a1af49b1fd3bc9ec60b3c" +checksum = "d54591e1f37fc329d412c0fdaced010cc1305b546a39f283fc51700f8fb49421" dependencies = [ - "darling 0.14.4", + "darling", "proc-macro2", "quote", "serde_json", - "syn 1.0.109", + "syn 2.0.39", ] [[package]] name = "kube-runtime" -version = "0.86.0" +version = "0.87.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fde2bd0b2d248be72f30c658b728f87e84c68495bec2c689dff7a3479eb29afd" +checksum = "e511e2c1a368d9d4bf6e70db58197e535d818df355b5a2007a8aeb17a370a8ba" dependencies = [ "ahash", "async-trait", @@ -1428,7 +1479,7 @@ dependencies = [ "hashbrown 0.14.2", "json-patch", "k8s-openapi", - "kube-client", + "kube-client 0.87.1", "parking_lot", "pin-project", "serde", @@ -1952,8 +2003,8 @@ dependencies = [ [[package]] name = "product-config" -version = "0.5.0" -source = "git+https://github.com/stackabletech/product-config.git?tag=0.5.0#439869d9e6a72fb6d912f6e494649a2f74f41d25" +version = "0.6.0" +source = "git+https://github.com/stackabletech/product-config.git?tag=0.6.0#ad2c3ea6a291e415d978eb4271fb309e75861ef0" dependencies = [ "fancy-regex", "java-properties", @@ -1962,7 +2013,7 @@ dependencies = [ "serde", "serde_json", "serde_yaml", - "thiserror", + "snafu 0.7.5", "xml-rs", ] @@ -2518,6 +2569,16 @@ version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" +[[package]] +name = "snafu" +version = "0.6.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eab12d3c261b2308b0d80c26fffb58d17eba81a4be97890101f416b478c79ca7" +dependencies = [ + "doc-comment", + "snafu-derive 0.6.10", +] + [[package]] name = "snafu" version = "0.7.5" @@ -2525,7 +2586,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4de37ad025c587a29e8f3f5605c00f70b98715ef90b9061a815b9e59e9042d6" dependencies = [ "doc-comment", - "snafu-derive", + "snafu-derive 0.7.5", +] + +[[package]] +name = "snafu-derive" +version = "0.6.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1508efa03c362e23817f96cde18abed596a25219a8b2c66e8db33c03543d315b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", ] [[package]] @@ -2574,7 +2646,7 @@ dependencies = [ "helm-sys", "indexmap 2.1.0", "k8s-openapi", - "kube", + "kube 0.86.0", "rand", "reqwest", "semver", @@ -2582,7 +2654,7 @@ dependencies = [ "serde_json", "serde_yaml", "sha2", - "snafu", + "snafu 0.7.5", "stackable-operator", "tera", "tokio", @@ -2610,7 +2682,7 @@ dependencies = [ "futures", "k8s-openapi", "serde", - "snafu", + "snafu 0.7.5", "stackable-cockpit", "stackable-cockpit-web", "tokio", @@ -2624,18 +2696,19 @@ dependencies = [ [[package]] name = "stackable-operator" -version = "0.55.0" -source = "git+https://github.com/stackabletech/operator-rs.git?tag=0.55.0#bfbc23d3819f815413cb4135e0835acd76aecf97" +version = "0.56.1" +source = "git+https://github.com/stackabletech/operator-rs.git?tag=0.56.1#beeb39436024fa5f61d840402c26ee56fc5fbd29" dependencies = [ "chrono", "clap", "const_format", "derivative", + "dockerfile-parser", "either", "futures", "json-patch", "k8s-openapi", - "kube", + "kube 0.87.1", "lazy_static", "opentelemetry", "opentelemetry-jaeger", @@ -2646,7 +2719,7 @@ dependencies = [ "serde", "serde_json", "serde_yaml", - "snafu", + "snafu 0.7.5", "stackable-operator-derive", "strum", "thiserror", @@ -2658,10 +2731,10 @@ dependencies = [ [[package]] name = "stackable-operator-derive" -version = "0.55.0" -source = "git+https://github.com/stackabletech/operator-rs.git?tag=0.55.0#bfbc23d3819f815413cb4135e0835acd76aecf97" +version = "0.56.1" +source = "git+https://github.com/stackabletech/operator-rs.git?tag=0.56.1#beeb39436024fa5f61d840402c26ee56fc5fbd29" dependencies = [ - "darling 0.20.3", + "darling", "proc-macro2", "quote", "syn 2.0.39", @@ -2684,7 +2757,7 @@ dependencies = [ "serde", "serde_json", "serde_yaml", - "snafu", + "snafu 0.7.5", "stackable-cockpit", "tera", "tokio", @@ -3599,7 +3672,7 @@ dependencies = [ "once_cell", "regex", "serde_json", - "snafu", + "snafu 0.7.5", "stackable-cockpitd", "stackablectl", "tera", diff --git a/Cargo.toml b/Cargo.toml index 077e4484..f335a8af 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,7 +42,7 @@ serde_json = "1.0" serde_yaml = "0.9" sha2 = "0.10" snafu = "0.7" -stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "0.55.0" } +stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "0.56.1" } tera = "1.18" tokio = { version = "1.29.0", features = ["rt-multi-thread", "macros", "fs", "process"] } tower-http = "0.4" From 4cffd743ab6967069927449686aa5f8d236f44a3 Mon Sep 17 00:00:00 2001 From: Techassi Date: Mon, 27 Nov 2023 15:03:31 +0100 Subject: [PATCH 31/40] Apply suggestions Co-authored-by: Malte Sander --- rust/stackable-cockpit/src/platform/cluster/resource_request.rs | 2 +- rust/stackable-cockpit/src/platform/credentials.rs | 2 +- rust/stackable-cockpit/src/platform/service.rs | 2 +- rust/stackablectl/src/cmds/release.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rust/stackable-cockpit/src/platform/cluster/resource_request.rs b/rust/stackable-cockpit/src/platform/cluster/resource_request.rs index d7bda6a3..71fcca9a 100644 --- a/rust/stackable-cockpit/src/platform/cluster/resource_request.rs +++ b/rust/stackable-cockpit/src/platform/cluster/resource_request.rs @@ -68,7 +68,7 @@ pub enum ResourceRequestsError { #[derive(Debug, Snafu)] pub enum ResourceRequestsValidationError { #[snafu(display( - "The {object_name} requires {} CPU cores, but there are only {} CPU cores available in the cluster", + "The {object_name} requires {} CPU core(s), but there are only {} CPU core(s) available in the cluster", required.as_cpu_count(), available.as_cpu_count() ))] InsufficientCpu { diff --git a/rust/stackable-cockpit/src/platform/credentials.rs b/rust/stackable-cockpit/src/platform/credentials.rs index 35b84c77..d880fb0a 100644 --- a/rust/stackable-cockpit/src/platform/credentials.rs +++ b/rust/stackable-cockpit/src/platform/credentials.rs @@ -10,7 +10,7 @@ pub type Result = std::result::Result; #[derive(Debug, Snafu)] pub enum Error { - #[snafu(display("failed to fetch data from kubernetes api"))] + #[snafu(display("failed to fetch data from kubernetes API"))] KubeClientFetchError { source: k8s::Error }, #[snafu(display("no credentials secret found"))] diff --git a/rust/stackable-cockpit/src/platform/service.rs b/rust/stackable-cockpit/src/platform/service.rs index b503fb70..5b8fadc5 100644 --- a/rust/stackable-cockpit/src/platform/service.rs +++ b/rust/stackable-cockpit/src/platform/service.rs @@ -17,7 +17,7 @@ use crate::utils::k8s::{self, ListParamsExt}; #[derive(Debug, Snafu)] pub enum Error { - #[snafu(display("failed to fetch data from kubernetes api"))] + #[snafu(display("failed to fetch data from kubernetes API"))] KubeClientFetchError { source: k8s::Error }, #[snafu(display("missing namespace for service '{service}'"))] diff --git a/rust/stackablectl/src/cmds/release.rs b/rust/stackablectl/src/cmds/release.rs index ef4cbc0a..808251b8 100644 --- a/rust/stackablectl/src/cmds/release.rs +++ b/rust/stackablectl/src/cmds/release.rs @@ -242,7 +242,7 @@ async fn describe_cmd( result .with_command_hint( format!("stackablectl release install {}", args.release), - "install the demo", + "install the release", ) .with_command_hint("stackablectl release list", "list all available releases") .with_output(table.to_string()); From 5ee3012d05c861d1c8776546f4136c2dd0334c79 Mon Sep 17 00:00:00 2001 From: Techassi Date: Mon, 27 Nov 2023 15:08:05 +0100 Subject: [PATCH 32/40] Remove unwrap, use expect --- rust/stackablectl/src/output/error.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/rust/stackablectl/src/output/error.rs b/rust/stackablectl/src/output/error.rs index a70d3b35..ecc84097 100644 --- a/rust/stackablectl/src/output/error.rs +++ b/rust/stackablectl/src/output/error.rs @@ -37,8 +37,12 @@ impl ContextExt for ErrorContext { impl ErrorContext { pub fn with_error_report(&mut self, error: impl ErrorReport) -> &mut Self { - // TODO (Techassi): Remove unwrap - self.error_report = error.into_error_report().unwrap(); + // We use expect here because we want to render the error report. If + // this fails, there is no point in catching an error while trying to + // render a different error. + self.error_report = error + .into_error_report() + .expect("failed to render error report"); self } From eb1df7f81783bccfad4fa6628225a221280e1fc1 Mon Sep 17 00:00:00 2001 From: Techassi Date: Mon, 27 Nov 2023 15:29:55 +0100 Subject: [PATCH 33/40] Update doc comment --- rust/stackablectl/src/cmds/stacklet.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust/stackablectl/src/cmds/stacklet.rs b/rust/stackablectl/src/cmds/stacklet.rs index 3bbaa2b1..3f80c8af 100644 --- a/rust/stackablectl/src/cmds/stacklet.rs +++ b/rust/stackablectl/src/cmds/stacklet.rs @@ -268,8 +268,8 @@ fn render_condition_error( None } -/// Colors a single condition (green or red) and additionally adds an error -/// index to the output. +// TODO (Techassi): Add back color support +/// Adds an error index to the output. fn color_condition(condition: &str, is_good: Option, error_index: usize) -> String { match is_good { Some(is_good) => { From ac8a5a0565ce5ea0ca68d9ace99cf3183daee8ed Mon Sep 17 00:00:00 2001 From: Techassi Date: Mon, 27 Nov 2023 15:34:24 +0100 Subject: [PATCH 34/40] Bump kube-rs --- Cargo.lock | 97 ++++++++---------------------------------------------- Cargo.toml | 2 +- 2 files changed, 15 insertions(+), 84 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 73522213..5d97b9b3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -201,12 +201,6 @@ dependencies = [ "rustc-demangle", ] -[[package]] -name = "base64" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ea22880d78093b0cbe17c89f64a7d457941e65759157ec6cb31a31d652b05e5" - [[package]] name = "base64" version = "0.21.5" @@ -219,7 +213,7 @@ version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28d1c9c15093eb224f0baa400f38fcd713fc1391a6f1c389d886beef146d60a3" dependencies = [ - "base64 0.21.5", + "base64", "blowfish", "getrandom", "subtle", @@ -1002,7 +996,7 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06683b93020a07e3dbcf5f8c0f6d40080d725bea7936fc01ad345c01b97dc270" dependencies = [ - "base64 0.21.5", + "base64", "bytes", "headers-core", "http", @@ -1313,7 +1307,7 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edc3606fd16aca7989db2f84bb25684d0270c6d6fa1dbcd0025af7b4130523a6" dependencies = [ - "base64 0.21.5", + "base64", "bytes", "chrono", "schemars", @@ -1322,17 +1316,6 @@ dependencies = [ "serde_json", ] -[[package]] -name = "kube" -version = "0.86.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8647c2211a9b480d910b155d573602c52cd5f646acecb06a03d594865dc4784" -dependencies = [ - "k8s-openapi", - "kube-client 0.86.0", - "kube-core 0.86.0", -] - [[package]] name = "kube" version = "0.87.1" @@ -1340,55 +1323,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e34392aea935145070dcd5b39a6dea689ac6534d7d117461316c3d157b1d0fc3" dependencies = [ "k8s-openapi", - "kube-client 0.87.1", - "kube-core 0.87.1", + "kube-client", + "kube-core", "kube-derive", "kube-runtime", ] -[[package]] -name = "kube-client" -version = "0.86.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af8952521f3e8ce11920229e5f2965fef70525aecd9efc7b65e39bf9e2c6f66d" -dependencies = [ - "base64 0.20.0", - "bytes", - "chrono", - "either", - "futures", - "home", - "http", - "http-body", - "hyper", - "hyper-rustls", - "hyper-timeout", - "jsonpath_lib", - "k8s-openapi", - "kube-core 0.86.0", - "pem", - "pin-project", - "rustls", - "rustls-pemfile", - "secrecy", - "serde", - "serde_json", - "serde_yaml", - "thiserror", - "tokio", - "tokio-util", - "tower", - "tower-http", - "tracing", -] - [[package]] name = "kube-client" version = "0.87.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7266548b9269d9fa19022620d706697e64f312fb2ba31b93e6986453fcc82c92" dependencies = [ - "base64 0.21.5", + "base64", "bytes", "chrono", "either", @@ -1401,7 +1348,7 @@ dependencies = [ "hyper-timeout", "jsonpath_lib", "k8s-openapi", - "kube-core 0.87.1", + "kube-core", "pem", "pin-project", "rustls", @@ -1418,22 +1365,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "kube-core" -version = "0.86.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7608a0cd05dfa36167d2da982bb70f17feb5450f73ec601f6d428bbcf991c5b9" -dependencies = [ - "chrono", - "form_urlencoded", - "http", - "k8s-openapi", - "once_cell", - "serde", - "serde_json", - "thiserror", -] - [[package]] name = "kube-core" version = "0.87.1" @@ -1479,7 +1410,7 @@ dependencies = [ "hashbrown 0.14.2", "json-patch", "k8s-openapi", - "kube-client 0.87.1", + "kube-client", "parking_lot", "pin-project", "serde", @@ -1827,7 +1758,7 @@ version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3163d2912b7c3b52d651a055f2c7eec9ba5cd22d26ef75b8dd3a59980b185923" dependencies = [ - "base64 0.21.5", + "base64", "serde", ] @@ -2126,7 +2057,7 @@ version = "0.11.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" dependencies = [ - "base64 0.21.5", + "base64", "bytes", "encoding_rs", "futures-core", @@ -2270,7 +2201,7 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" dependencies = [ - "base64 0.21.5", + "base64", ] [[package]] @@ -2646,7 +2577,7 @@ dependencies = [ "helm-sys", "indexmap 2.1.0", "k8s-openapi", - "kube 0.86.0", + "kube", "rand", "reqwest", "semver", @@ -2708,7 +2639,7 @@ dependencies = [ "futures", "json-patch", "k8s-openapi", - "kube 0.87.1", + "kube", "lazy_static", "opentelemetry", "opentelemetry-jaeger", @@ -3035,7 +2966,7 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61c5bb1d698276a2443e5ecfabc1008bf15a36c12e6a7176e7bf089ea9131140" dependencies = [ - "base64 0.21.5", + "base64", "bitflags 2.4.1", "bytes", "futures-core", diff --git a/Cargo.toml b/Cargo.toml index f335a8af..1a6b5ab5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,7 @@ dotenvy = "0.15" futures = "0.3" indexmap = { version = "2.0", features = ["serde"] } k8s-openapi = { version = "0.20", default-features = false, features = ["v1_28"] } -kube = { version = "0.86", default-features = false, features = ["client", "rustls-tls"] } +kube = { version = "0.87", default-features = false, features = ["client", "rustls-tls"] } lazy_static = "1.4" once_cell = "1.18" phf = "0.11" From 821c56aad80df0c455eeb21243aaa49590f93e31 Mon Sep 17 00:00:00 2001 From: Techassi Date: Mon, 27 Nov 2023 15:39:02 +0100 Subject: [PATCH 35/40] Add `hello-world` operator --- rust/stackable-cockpit/src/platform/operator/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/rust/stackable-cockpit/src/platform/operator/mod.rs b/rust/stackable-cockpit/src/platform/operator/mod.rs index 32fd095d..fc4c98bb 100644 --- a/rust/stackable-cockpit/src/platform/operator/mod.rs +++ b/rust/stackable-cockpit/src/platform/operator/mod.rs @@ -16,6 +16,7 @@ pub const VALID_OPERATORS: &[&str] = &[ "druid", "hbase", "hdfs", + "hello-world", "hive", "kafka", "listener", From c5a97314c66806312d67d14e0ac525b459515c93 Mon Sep 17 00:00:00 2001 From: Techassi Date: Mon, 27 Nov 2023 17:01:31 +0100 Subject: [PATCH 36/40] Switch to ensure macro --- .../src/platform/operator/mod.rs | 26 +++++++------------ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/rust/stackable-cockpit/src/platform/operator/mod.rs b/rust/stackable-cockpit/src/platform/operator/mod.rs index fc4c98bb..ba11fcfe 100644 --- a/rust/stackable-cockpit/src/platform/operator/mod.rs +++ b/rust/stackable-cockpit/src/platform/operator/mod.rs @@ -1,7 +1,7 @@ use std::{fmt::Display, str::FromStr}; use semver::Version; -use snafu::{ResultExt, Snafu}; +use snafu::{ensure, ResultExt, Snafu}; use tracing::{info, instrument}; use crate::{ @@ -77,9 +77,7 @@ impl FromStr for OperatorSpec { let input = s.trim(); // Empty input is not allowed - if input.is_empty() { - return Err(SpecParseError::EmptyInput); - } + ensure!(!input.is_empty(), EmptyInputSnafu); // Split at each equal sign let parts: Vec<&str> = input.split('=').collect(); @@ -87,9 +85,13 @@ impl FromStr for OperatorSpec { // If there are more than 2 equal signs, return error // because of invalid spec format - if len > 2 { - return Err(SpecParseError::InvalidEqualSignCount); - } + ensure!(len <= 2, InvalidEqualSignCountSnafu); + + // Check if the provided operator name is in the list of valid operators + ensure!( + VALID_OPERATORS.contains(&parts[0]), + InvalidNameSnafu { name: parts[0] } + ); // If there is only one part, the input didn't include // the optional version identifier @@ -101,15 +103,7 @@ impl FromStr for OperatorSpec { } // If there is an equal sign, but no version after - if parts[1].is_empty() { - return Err(SpecParseError::MissingVersion); - } - - if !VALID_OPERATORS.contains(&parts[0]) { - return Err(SpecParseError::InvalidName { - name: parts[0].to_string(), - }); - } + ensure!(!parts[1].is_empty(), MissingVersionSnafu); // There are two parts, so an operator name and version let version: Version = parts[1].parse().context(ParseVersionSnafu)?; From a26bf8375cf4a1302f7f066fc6b00bbc438fbc3b Mon Sep 17 00:00:00 2001 From: Techassi Date: Tue, 28 Nov 2023 09:20:56 +0100 Subject: [PATCH 37/40] Fix cargo-deny error --- deny.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/deny.toml b/deny.toml index 66040b62..238ae1cc 100644 --- a/deny.toml +++ b/deny.toml @@ -24,15 +24,17 @@ default = "deny" confidence-threshold = 1.0 allow = [ "Apache-2.0", + "BSD-2-Clause", "BSD-3-Clause", "CC0-1.0", "ISC", "LicenseRef-ring", "LicenseRef-webpki", "MIT", + "MPL-2.0", "Unicode-DFS-2016", "Zlib", - "MPL-2.0", + "Unlicense", ] private = { ignore = true } From da3bdad1440e5a9a83986ef5e87de2762728db51 Mon Sep 17 00:00:00 2001 From: Techassi Date: Tue, 28 Nov 2023 09:31:10 +0100 Subject: [PATCH 38/40] Fix failing unit tests --- rust/stackable-cockpit/src/platform/operator/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rust/stackable-cockpit/src/platform/operator/mod.rs b/rust/stackable-cockpit/src/platform/operator/mod.rs index ba11fcfe..67fd5494 100644 --- a/rust/stackable-cockpit/src/platform/operator/mod.rs +++ b/rust/stackable-cockpit/src/platform/operator/mod.rs @@ -217,9 +217,9 @@ mod test { #[test] fn simple_operator_spec() { - match OperatorSpec::try_from("operator") { + match OperatorSpec::try_from("airflow") { Ok(spec) => { - assert_eq!(spec.name, String::from("operator")); + assert_eq!(spec.name, String::from("airflow")); assert_eq!(spec.version, None); } Err(err) => panic!("{err}"), @@ -247,7 +247,7 @@ mod test { #[test] fn empty_version_operator_spec() { - match OperatorSpec::try_from("operator=") { + match OperatorSpec::try_from("airflow=") { Ok(spec) => panic!("SHOULD FAIL: {spec}"), Err(err) => assert!(matches!(err, SpecParseError::MissingVersion)), } @@ -255,7 +255,7 @@ mod test { #[test] fn invalid_version_operator_spec() { - match OperatorSpec::try_from("operator=1.2.3=") { + match OperatorSpec::try_from("airflow=1.2.3=") { Ok(spec) => panic!("SHOULD FAIL: {spec}"), Err(err) => assert!(matches!(err, SpecParseError::InvalidEqualSignCount)), } From a050a379974fde3efc797c7b230be59042430438 Mon Sep 17 00:00:00 2001 From: Techassi Date: Tue, 28 Nov 2023 10:23:21 +0100 Subject: [PATCH 39/40] Update error variants --- rust/stackable-cockpit/src/engine/kind/mod.rs | 10 +-- .../src/engine/minikube/mod.rs | 10 +-- rust/stackable-cockpit/src/helm.rs | 4 +- .../src/platform/cluster/resource_request.rs | 6 +- .../src/platform/credentials.rs | 2 +- .../src/platform/demo/spec.rs | 2 +- .../src/platform/namespace.rs | 10 +-- .../src/platform/release/spec.rs | 4 +- .../stackable-cockpit/src/platform/service.rs | 2 +- .../src/platform/stack/spec.rs | 28 ++++---- .../src/platform/stacklet/grafana.rs | 4 +- .../src/platform/stacklet/minio.rs | 4 +- .../src/platform/stacklet/mod.rs | 18 ++--- .../src/platform/stacklet/opensearch.rs | 4 +- .../src/platform/stacklet/prometheus.rs | 4 +- .../stackable-cockpit/src/utils/k8s/client.rs | 68 +++++++++++++------ rust/stackable-cockpit/src/utils/params.rs | 4 +- rust/stackable-cockpit/src/utils/path.rs | 2 +- rust/stackable-cockpit/src/xfer/cache.rs | 56 ++++++++------- rust/stackable-cockpit/src/xfer/processor.rs | 6 +- rust/stackablectl/src/args/cluster.rs | 8 +-- rust/stackablectl/src/cmds/cache.rs | 15 ++-- rust/stackablectl/src/cmds/completions.rs | 6 +- rust/stackablectl/src/cmds/demo.rs | 47 ++++++------- rust/stackablectl/src/cmds/operator.rs | 52 ++++++-------- rust/stackablectl/src/cmds/release.rs | 47 ++++++------- rust/stackablectl/src/cmds/stack.rs | 51 +++++++------- rust/stackablectl/src/cmds/stacklet.rs | 18 ++--- rust/stackablectl/src/output/mod.rs | 7 +- 29 files changed, 260 insertions(+), 239 deletions(-) diff --git a/rust/stackable-cockpit/src/engine/kind/mod.rs b/rust/stackable-cockpit/src/engine/kind/mod.rs index 117b4787..ef4f73d8 100644 --- a/rust/stackable-cockpit/src/engine/kind/mod.rs +++ b/rust/stackable-cockpit/src/engine/kind/mod.rs @@ -35,10 +35,10 @@ pub enum Error { CommandErroredOut { error: String }, #[snafu(display("missing required binary: {binary}"))] - MissingBinaryError { binary: String }, + MissingBinary { binary: String }, #[snafu(display("failed to determine if Docker is running"))] - DockerError { source: docker::Error }, + DockerCheckCommand { source: docker::Error }, #[snafu(display("failed to covert kind config to YAML"))] ConfigSerialization { source: serde_yaml::Error }, @@ -71,11 +71,13 @@ impl Cluster { // Check if required binaries are present if let Some(binary) = binaries_present_with_name(&["docker", "kind"]) { - return Err(Error::MissingBinaryError { binary }); + return Err(Error::MissingBinary { binary }); } // Check if Docker is running - check_if_docker_is_running().await.context(DockerSnafu)?; + check_if_docker_is_running() + .await + .context(DockerCheckCommandSnafu)?; debug!("Creating kind cluster config"); let config = Config::new(self.node_count, self.cp_node_count); diff --git a/rust/stackable-cockpit/src/engine/minikube/mod.rs b/rust/stackable-cockpit/src/engine/minikube/mod.rs index 31213d30..c92b795e 100644 --- a/rust/stackable-cockpit/src/engine/minikube/mod.rs +++ b/rust/stackable-cockpit/src/engine/minikube/mod.rs @@ -22,10 +22,10 @@ pub enum Error { MissingBinary { binary: String }, #[snafu(display("failed to execute minikube command"))] - CommandError { source: std::io::Error }, + MinikubeCommand { source: std::io::Error }, #[snafu(display("failed to determine if Docker is running"))] - DockerError { source: docker::Error }, + DockerCheckCommand { source: docker::Error }, } #[derive(Debug)] @@ -55,7 +55,9 @@ impl Cluster { } // Check if Docker is running - check_if_docker_is_running().await.context(DockerSnafu)?; + check_if_docker_is_running() + .await + .context(DockerCheckCommandSnafu)?; // Create local cluster via minikube debug!("Creating minikube cluster"); @@ -66,7 +68,7 @@ impl Cluster { .args(["-p", self.name.as_str()]) .status() .await - .context(CommandSnafu)?; + .context(MinikubeCommandSnafu)?; Ok(()) } diff --git a/rust/stackable-cockpit/src/helm.rs b/rust/stackable-cockpit/src/helm.rs index 61356630..2333260a 100644 --- a/rust/stackable-cockpit/src/helm.rs +++ b/rust/stackable-cockpit/src/helm.rs @@ -93,7 +93,7 @@ pub enum InstallReleaseError { /// is not typed, as the error is a plain string coming directly from the /// FFI bindings. #[snafu(display("helm error: {error}"))] - HelmWrapperError { error: String }, + HelmWrapper { error: String }, } #[derive(Debug)] @@ -282,7 +282,7 @@ fn install_release( ); return Err(Error::InstallRelease { - source: InstallReleaseError::HelmWrapperError { error }, + source: InstallReleaseError::HelmWrapper { error }, }); } diff --git a/rust/stackable-cockpit/src/platform/cluster/resource_request.rs b/rust/stackable-cockpit/src/platform/cluster/resource_request.rs index 71fcca9a..873b4792 100644 --- a/rust/stackable-cockpit/src/platform/cluster/resource_request.rs +++ b/rust/stackable-cockpit/src/platform/cluster/resource_request.rs @@ -44,10 +44,10 @@ impl Display for ResourceRequests { #[derive(Debug, Snafu)] pub enum ResourceRequestsError { #[snafu(display("failed to create kube client"))] - KubeClientError { source: Error }, + KubeClientCreate { source: Error }, #[snafu(display("failed to retrieve cluster info"))] - ClusterInfoError { source: Error }, + ClusterInfo { source: Error }, #[snafu(display("failed to parse cpu resource requirements"))] ParseCpuResourceRequirements { @@ -92,7 +92,7 @@ impl ResourceRequests { /// resources to the available ones in the current cluster. `object_name` /// should be `stack` or `demo`. pub async fn validate_cluster_size(&self, object_name: &str) -> Result<()> { - let kube_client = Client::new().await.context(KubeClientSnafu)?; + let kube_client = Client::new().await.context(KubeClientCreateSnafu)?; let cluster_info = kube_client .get_cluster_info() .await diff --git a/rust/stackable-cockpit/src/platform/credentials.rs b/rust/stackable-cockpit/src/platform/credentials.rs index d880fb0a..01bbd503 100644 --- a/rust/stackable-cockpit/src/platform/credentials.rs +++ b/rust/stackable-cockpit/src/platform/credentials.rs @@ -11,7 +11,7 @@ pub type Result = std::result::Result; #[derive(Debug, Snafu)] pub enum Error { #[snafu(display("failed to fetch data from kubernetes API"))] - KubeClientFetchError { source: k8s::Error }, + KubeClientFetch { source: k8s::Error }, #[snafu(display("no credentials secret found"))] NoSecret, diff --git a/rust/stackable-cockpit/src/platform/demo/spec.rs b/rust/stackable-cockpit/src/platform/demo/spec.rs index e634a982..1b55e505 100644 --- a/rust/stackable-cockpit/src/platform/demo/spec.rs +++ b/rust/stackable-cockpit/src/platform/demo/spec.rs @@ -38,7 +38,7 @@ pub enum Error { InstallDemoManifests { source: stack::Error }, #[snafu(display("demo resource requests error"), context(false))] - DemoResourceRequestsError { source: ResourceRequestsError }, + DemoResourceRequests { source: ResourceRequestsError }, #[snafu(display("cannot install demo in namespace '{requested}', only '{}' supported", supported.join(", ")))] UnsupportedNamespace { diff --git a/rust/stackable-cockpit/src/platform/namespace.rs b/rust/stackable-cockpit/src/platform/namespace.rs index cbf0665b..5060f3f0 100644 --- a/rust/stackable-cockpit/src/platform/namespace.rs +++ b/rust/stackable-cockpit/src/platform/namespace.rs @@ -5,7 +5,7 @@ use crate::utils::k8s; #[derive(Debug, Snafu)] pub enum Error { #[snafu(display("failed to create kubernetes client"))] - KubeClientCreateError { source: k8s::Error }, + KubeClientCreate { source: k8s::Error }, #[snafu(display("permission denied - try to create the namespace manually or choose an already existing one to which you have access to"))] PermissionDenied, @@ -20,12 +20,12 @@ pub async fn create_if_needed(name: String) -> Result<(), Error> { .create_namespace_if_needed(name) .await .map_err(|err| match err { - k8s::Error::KubeError { source } => match source { + k8s::Error::KubeClientCreate { source } => match source { kube::Error::Api(err) if err.code == 401 => Error::PermissionDenied, - _ => Error::KubeClientCreateError { - source: k8s::Error::KubeError { source }, + _ => Error::KubeClientCreate { + source: k8s::Error::KubeClientCreate { source }, }, }, - _ => Error::KubeClientCreateError { source: err }, + _ => Error::KubeClientCreate { source: err }, }) } diff --git a/rust/stackable-cockpit/src/platform/release/spec.rs b/rust/stackable-cockpit/src/platform/release/spec.rs index ba365338..5b3343f6 100644 --- a/rust/stackable-cockpit/src/platform/release/spec.rs +++ b/rust/stackable-cockpit/src/platform/release/spec.rs @@ -19,10 +19,10 @@ pub enum Error { OperatorSpecParse { source: operator::SpecParseError }, #[snafu(display("failed to install release using Helm"))] - HelmInstallError { source: helm::Error }, + HelmInstall { source: helm::Error }, #[snafu(display("failed to uninstall release using Helm"))] - HelmUninstallError { source: helm::Error }, + HelmUninstall { source: helm::Error }, } #[derive(Clone, Debug, Deserialize, Serialize)] diff --git a/rust/stackable-cockpit/src/platform/service.rs b/rust/stackable-cockpit/src/platform/service.rs index 5b8fadc5..99a41840 100644 --- a/rust/stackable-cockpit/src/platform/service.rs +++ b/rust/stackable-cockpit/src/platform/service.rs @@ -18,7 +18,7 @@ use crate::utils::k8s::{self, ListParamsExt}; #[derive(Debug, Snafu)] pub enum Error { #[snafu(display("failed to fetch data from kubernetes API"))] - KubeClientFetchError { source: k8s::Error }, + KubeClientFetch { source: k8s::Error }, #[snafu(display("missing namespace for service '{service}'"))] MissingServiceNamespace { service: String }, diff --git a/rust/stackable-cockpit/src/platform/stack/spec.rs b/rust/stackable-cockpit/src/platform/stack/spec.rs index 0fbf0ded..0ea0450a 100644 --- a/rust/stackable-cockpit/src/platform/stack/spec.rs +++ b/rust/stackable-cockpit/src/platform/stack/spec.rs @@ -37,7 +37,7 @@ pub enum Error { /// This error indicates that parsing a string into stack / demo parameters /// failed. #[snafu(display("failed to parse demo / stack parameters"))] - ParameterError { source: IntoParametersError }, + ParameterParse { source: IntoParametersError }, /// This error indicates that the requested release doesn't exist in the /// loaded list of releases. @@ -46,12 +46,12 @@ pub enum Error { /// This error indicates that the release failed to install. #[snafu(display("failed to install release"))] - ReleaseInstallError { source: release::Error }, + ReleaseInstall { source: release::Error }, /// This error indicates that the Helm wrapper failed to add the Helm /// repository. #[snafu(display("failed to add Helm repository {repo_name}"))] - HelmAddRepositoryError { + HelmAddRepository { source: helm::Error, repo_name: String, }, @@ -59,37 +59,37 @@ pub enum Error { /// This error indicates that the Hlm wrapper failed to install the Helm /// release. #[snafu(display("failed to install Helm release {release_name}"))] - HelmInstallReleaseError { + HelmInstallRelease { release_name: String, source: helm::Error, }, /// This error indicates that the creation of a kube client failed. #[snafu(display("failed to create kubernetes client"))] - KubeClientCreateError { source: k8s::Error }, + KubeClientCreate { source: k8s::Error }, /// This error indicates that the kube client failed to deloy manifests. #[snafu(display("failed to deploy manifests using the kube client"))] - ManifestDeployError { source: k8s::Error }, + ManifestDeploy { source: k8s::Error }, /// This error indicates that Helm chart options could not be serialized /// into YAML. #[snafu(display("failed to serialize Helm chart options"))] - SerializeOptionsError { source: serde_yaml::Error }, + SerializeOptions { source: serde_yaml::Error }, #[snafu(display("stack resource requests error"), context(false))] - StackResourceRequestsError { source: ResourceRequestsError }, + StackResourceRequests { source: ResourceRequestsError }, /// This error indicates that parsing a string into a path or URL failed. #[snafu(display("failed to parse '{path_or_url}' as path/url"))] - PathOrUrlParseError { + PathOrUrlParse { source: PathOrUrlParseError, path_or_url: String, }, /// This error indicates that receiving remote content failed. #[snafu(display("failed to receive remote content"))] - TransferError { source: xfer::Error }, + FileTransfer { source: xfer::Error }, /// This error indicates that the stack doesn't support being installed in /// the provided namespace. @@ -212,7 +212,7 @@ impl StackSpec { let parameters = parameters .to_owned() .into_params(&self.parameters) - .context(ParameterSnafu)?; + .context(ParameterParseSnafu)?; Self::install_manifests( &self.manifests, @@ -238,7 +238,7 @@ impl StackSpec { let parameters = demo_parameters .to_owned() .into_params(valid_demo_parameters) - .context(ParameterSnafu)?; + .context(ParameterParseSnafu)?; Self::install_manifests(manifests, ¶meters, product_namespace, transfer_client).await?; Ok(()) @@ -267,7 +267,7 @@ impl StackSpec { let helm_chart: helm::Chart = transfer_client .get(&helm_file, &Template::new(parameters).then(Yaml::new())) .await - .context(TransferSnafu)?; + .context(FileTransferSnafu)?; info!( "Installing Helm chart {} ({})", @@ -315,7 +315,7 @@ impl StackSpec { let manifests = transfer_client .get(&path_or_url, &Template::new(parameters)) .await - .context(TransferSnafu)?; + .context(FileTransferSnafu)?; let kube_client = k8s::Client::new().await.context(KubeClientCreateSnafu)?; diff --git a/rust/stackable-cockpit/src/platform/stacklet/grafana.rs b/rust/stackable-cockpit/src/platform/stacklet/grafana.rs index c1408010..e77eef8b 100644 --- a/rust/stackable-cockpit/src/platform/stacklet/grafana.rs +++ b/rust/stackable-cockpit/src/platform/stacklet/grafana.rs @@ -4,7 +4,7 @@ use snafu::ResultExt; use crate::{ platform::{ service::get_endpoint_urls, - stacklet::{Error, KubeClientFetchSnafu, ServiceSnafu, Stacklet}, + stacklet::{Error, KubeClientFetchSnafu, ServiceFetchSnafu, Stacklet}, }, utils::k8s::{Client, ListParamsExt, ProductLabel}, }; @@ -25,7 +25,7 @@ pub(super) async fn list( let service_name = service.name_any(); let endpoints = get_endpoint_urls(kube_client, &service, &service_name) .await - .context(ServiceSnafu)?; + .context(ServiceFetchSnafu)?; stacklets.push(Stacklet { conditions: Vec::new(), diff --git a/rust/stackable-cockpit/src/platform/stacklet/minio.rs b/rust/stackable-cockpit/src/platform/stacklet/minio.rs index 84e0dfa0..749fcc07 100644 --- a/rust/stackable-cockpit/src/platform/stacklet/minio.rs +++ b/rust/stackable-cockpit/src/platform/stacklet/minio.rs @@ -4,7 +4,7 @@ use snafu::ResultExt; use crate::{ platform::{ service::get_endpoint_urls, - stacklet::{Error, KubeClientFetchSnafu, ServiceSnafu, Stacklet}, + stacklet::{Error, KubeClientFetchSnafu, ServiceFetchSnafu, Stacklet}, }, utils::k8s::Client, }; @@ -30,7 +30,7 @@ pub(super) async fn list( let service_name = service.name_any(); let endpoints = get_endpoint_urls(kube_client, service, &service_name) .await - .context(ServiceSnafu)?; + .context(ServiceFetchSnafu)?; stacklets.push(Stacklet { product: "minio".to_string(), diff --git a/rust/stackable-cockpit/src/platform/stacklet/mod.rs b/rust/stackable-cockpit/src/platform/stacklet/mod.rs index f203495c..95c67547 100644 --- a/rust/stackable-cockpit/src/platform/stacklet/mod.rs +++ b/rust/stackable-cockpit/src/platform/stacklet/mod.rs @@ -46,19 +46,19 @@ pub struct Stacklet { #[derive(Debug, Snafu)] pub enum Error { #[snafu(display("failed to create kubernetes client"))] - KubeClientCreateError { source: k8s::Error }, + KubeClientCreate { source: k8s::Error }, #[snafu(display("failed to fetch data from the kubernetes api"))] - KubeClientFetchError { source: k8s::Error }, + KubeClientFetch { source: k8s::Error }, #[snafu(display("no namespace set for custom resource '{crd_name}'"))] - CustomCrdNamespaceError { crd_name: String }, + CustomCrdNamespace { crd_name: String }, #[snafu(display("failed to deserialize cluster conditions from JSON"))] - DeserializeConditionsError { source: serde_json::Error }, + DeserializeConditions { source: serde_json::Error }, - #[snafu(display("service error"))] - ServiceError { source: service::Error }, + #[snafu(display("failed to receive service information"))] + ServiceFetch { source: service::Error }, } /// Lists all installed stacklets. If `namespace` is [`None`], stacklets from ALL @@ -102,8 +102,8 @@ pub async fn get_credentials_for_product( let credentials = match credentials::get(&kube_client, product_name, &product_cluster).await { Ok(credentials) => credentials, Err(credentials::Error::NoSecret) => None, - Err(credentials::Error::KubeClientFetchError { source }) => { - return Err(Error::KubeClientFetchError { source }) + Err(credentials::Error::KubeClientFetch { source }) => { + return Err(Error::KubeClientFetch { source }) } }; @@ -150,7 +150,7 @@ async fn list_stackable_stacklets( let endpoints = service::get_endpoints(kube_client, product_name, &object_name, &object_namespace) .await - .context(ServiceSnafu)?; + .context(ServiceFetchSnafu)?; stacklets.push(Stacklet { namespace: Some(object_namespace), diff --git a/rust/stackable-cockpit/src/platform/stacklet/opensearch.rs b/rust/stackable-cockpit/src/platform/stacklet/opensearch.rs index d866bc63..5a65ec49 100644 --- a/rust/stackable-cockpit/src/platform/stacklet/opensearch.rs +++ b/rust/stackable-cockpit/src/platform/stacklet/opensearch.rs @@ -4,7 +4,7 @@ use snafu::ResultExt; use crate::{ platform::{ service::get_endpoint_urls, - stacklet::{Error, KubeClientFetchSnafu, ServiceSnafu, Stacklet}, + stacklet::{Error, KubeClientFetchSnafu, ServiceFetchSnafu, Stacklet}, }, utils::k8s::{Client, ListParamsExt, ProductLabel}, }; @@ -25,7 +25,7 @@ pub(super) async fn list( let service_name = service.name_any(); let endpoints = get_endpoint_urls(kube_client, &service, &service_name) .await - .context(ServiceSnafu)?; + .context(ServiceFetchSnafu)?; // TODO: Add "Logs view" extra info from old stackablectl once "Extra info" field is supported. // see https://github.com/stackabletech/stackablectl/blob/eda45945cfcf5c6581cf1b88c782d98fada8065f/src/services/opensearch.rs#L41 diff --git a/rust/stackable-cockpit/src/platform/stacklet/prometheus.rs b/rust/stackable-cockpit/src/platform/stacklet/prometheus.rs index a0d3dcac..cd8a2560 100644 --- a/rust/stackable-cockpit/src/platform/stacklet/prometheus.rs +++ b/rust/stackable-cockpit/src/platform/stacklet/prometheus.rs @@ -4,7 +4,7 @@ use snafu::ResultExt; use crate::{ platform::{ service::get_endpoint_urls, - stacklet::{Error, KubeClientFetchSnafu, ServiceSnafu, Stacklet}, + stacklet::{Error, KubeClientFetchSnafu, ServiceFetchSnafu, Stacklet}, }, utils::k8s::Client, }; @@ -26,7 +26,7 @@ pub(super) async fn list( let service_name = service.name_any(); let endpoints = get_endpoint_urls(kube_client, &service, &service_name) .await - .context(ServiceSnafu)?; + .context(ServiceFetchSnafu)?; stacklets.push(Stacklet { product: "prometheus".to_string(), diff --git a/rust/stackable-cockpit/src/utils/k8s/client.rs b/rust/stackable-cockpit/src/utils/k8s/client.rs index 8e609f95..70c172ca 100644 --- a/rust/stackable-cockpit/src/utils/k8s/client.rs +++ b/rust/stackable-cockpit/src/utils/k8s/client.rs @@ -26,26 +26,32 @@ pub type Result = std::result::Result; #[derive(Debug, Snafu)] pub enum Error { - #[snafu(display("kubernetes error"))] - KubeError { source: kube::error::Error }, + #[snafu(display("failed to create kubernetes client"))] + KubeClientCreate { source: kube::error::Error }, + + #[snafu(display("failed to fetch data from kubernetes API"))] + KubeClientFetch { source: kube::error::Error }, + + #[snafu(display("failed to patch/create kubernetes object"))] + KubeClientPatch { source: kube::error::Error }, #[snafu(display("failed to deserialize YAML data"))] - DeserializeYamlError { source: serde_yaml::Error }, + DeserializeYaml { source: serde_yaml::Error }, #[snafu(display("failed to deploy manifest because type of object {object:?} is not set"))] - ObjectTypeError { object: DynamicObject }, + ObjectType { object: DynamicObject }, #[snafu(display("failed to deploy manifest because GVK {gvk:?} cannot be resolved"))] - DiscoveryError { gvk: GroupVersionKind }, + DiscoveryResolve { gvk: GroupVersionKind }, #[snafu(display("failed to convert byte string into UTF-8 string"))] - ByteStringConvertError { source: FromUtf8Error }, + ByteStringConvert { source: FromUtf8Error }, #[snafu(display("missing namespace for service '{service}'"))] MissingServiceNamespace { service: String }, #[snafu(display("failed to retrieve cluster information"))] - ClusterError { source: cluster::Error }, + ClusterInformation { source: cluster::Error }, #[snafu(display("invalid or empty secret data in '{secret_name}'"))] InvalidSecretData { secret_name: String }, @@ -66,11 +72,14 @@ impl Client { /// Tries to create a new default Kubernetes client and immediately runs /// a discovery. pub async fn new() -> Result { - let client = kube::Client::try_default().await.context(KubeSnafu)?; + let client = kube::Client::try_default() + .await + .context(KubeClientCreateSnafu)?; + let discovery = Discovery::new(client.clone()) .run() .await - .context(KubeSnafu)?; + .context(KubeClientFetchSnafu)?; Ok(Self { client, discovery }) } @@ -93,7 +102,7 @@ impl Client { let (resource, capabilities) = self .discovery .resolve_gvk(&gvk) - .ok_or(DiscoverySnafu { gvk }.build())?; + .ok_or(DiscoveryResolveSnafu { gvk }.build())?; let api: Api = match capabilities.scope { Scope::Cluster => { @@ -111,7 +120,7 @@ impl Client { &Patch::Apply(object), ) .await - .context(KubeSnafu)?; + .context(KubeClientPatchSnafu)?; } Ok(()) @@ -143,7 +152,7 @@ impl Client { let objects = object_api .list(&ListParams::default()) .await - .context(KubeSnafu)?; + .context(KubeClientFetchSnafu)?; Ok(Some(objects)) } @@ -162,7 +171,9 @@ impl Client { }; let api = Api::namespaced_with(self.client.clone(), namespace, &object_api_resource); - Ok(Some(api.get(object_name).await.context(KubeSnafu)?)) + Ok(Some( + api.get(object_name).await.context(KubeClientFetchSnafu)?, + )) } /// Lists [`Service`]s by matching labels. The services can be matched by @@ -179,7 +190,11 @@ impl Client { None => Api::all(self.client.clone()), }; - let services = service_api.list(list_params).await.context(KubeSnafu)?; + let services = service_api + .list(list_params) + .await + .context(KubeClientFetchSnafu)?; + Ok(services) } @@ -196,7 +211,10 @@ impl Client { ) -> Result { let secret_api: Api = Api::namespaced(self.client.clone(), secret_namespace); - let secret = secret_api.get(secret_name).await.context(KubeSnafu)?; + let secret = secret_api + .get(secret_name) + .await + .context(KubeClientFetchSnafu)?; let secret_name = secret.name_any(); let secret_data = secret.data.context(InvalidSecretDataSnafu { @@ -233,7 +251,10 @@ impl Client { None => Api::all(self.client.clone()), }; - let deployments = deployment_api.list(list_params).await.context(KubeSnafu)?; + let deployments = deployment_api + .list(list_params) + .await + .context(KubeClientFetchSnafu)?; Ok(deployments) } @@ -254,7 +275,7 @@ impl Client { let stateful_sets = stateful_set_api .list(list_params) .await - .context(KubeSnafu)?; + .context(KubeClientFetchSnafu)?; Ok(stateful_sets) } @@ -265,7 +286,7 @@ impl Client { let nodes = node_api .list(&ListParams::default()) .await - .context(KubeSnafu)?; + .context(KubeClientFetchSnafu)?; Ok(nodes) } @@ -274,7 +295,10 @@ impl Client { /// exist, this method returns [`None`]. pub async fn get_namespace(&self, name: &str) -> Result> { let namespace_api: Api = Api::all(self.client.clone()); - namespace_api.get_opt(name).await.context(KubeSnafu) + namespace_api + .get_opt(name) + .await + .context(KubeClientFetchSnafu) } /// Creates a [`Namespace`] with `name` in the cluster. This method will @@ -297,7 +321,7 @@ impl Client { }, ) .await - .context(KubeSnafu)?; + .context(KubeClientPatchSnafu)?; Ok(()) } @@ -317,12 +341,12 @@ impl Client { /// resources. These values don't reflect currently available resources. pub async fn get_cluster_info(&self) -> Result { let nodes = self.list_nodes().await?; - cluster::ClusterInfo::from_nodes(nodes).context(ClusterSnafu) + cluster::ClusterInfo::from_nodes(nodes).context(ClusterInformationSnafu) } pub async fn get_endpoints(&self, namespace: &str, name: &str) -> Result { let endpoints_api: Api = Api::namespaced(self.client.clone(), namespace); - endpoints_api.get(name).await.context(KubeSnafu) + endpoints_api.get(name).await.context(KubeClientFetchSnafu) } /// Extracts the [`GroupVersionKind`] from [`TypeMeta`]. diff --git a/rust/stackable-cockpit/src/utils/params.rs b/rust/stackable-cockpit/src/utils/params.rs index 112ca018..2fb70070 100644 --- a/rust/stackable-cockpit/src/utils/params.rs +++ b/rust/stackable-cockpit/src/utils/params.rs @@ -33,7 +33,7 @@ pub struct Parameter { #[derive(Debug, Snafu, PartialEq)] pub enum IntoParametersError { #[snafu(display("failed to parse raw parameter"))] - ParseError { source: RawParameterParseError }, + RawParse { source: RawParameterParseError }, #[snafu(display("invalid parameter '{parameter}', expected one of {expected}"))] InvalidParameter { parameter: String, expected: String }, @@ -47,7 +47,7 @@ pub trait IntoParameters: Sized + IntoRawParameters { where T: AsRef<[Parameter]>, { - let raw_parameters = self.into_raw_params().context(ParseSnafu)?; + let raw_parameters = self.into_raw_params().context(RawParseSnafu)?; let parameters = valid_parameters.as_ref(); let mut parameters: HashMap = parameters diff --git a/rust/stackable-cockpit/src/utils/path.rs b/rust/stackable-cockpit/src/utils/path.rs index 331f1538..f71493e5 100644 --- a/rust/stackable-cockpit/src/utils/path.rs +++ b/rust/stackable-cockpit/src/utils/path.rs @@ -12,7 +12,7 @@ pub enum PathOrUrl { #[derive(Debug, Snafu)] pub enum PathOrUrlParseError { #[snafu(display("failed to parse URL"))] - UrlParseError { source: ParseError }, + UrlParse { source: ParseError }, } pub trait IntoPathOrUrl: Sized { diff --git a/rust/stackable-cockpit/src/xfer/cache.rs b/rust/stackable-cockpit/src/xfer/cache.rs index 69f06621..b76cc681 100644 --- a/rust/stackable-cockpit/src/xfer/cache.rs +++ b/rust/stackable-cockpit/src/xfer/cache.rs @@ -20,14 +20,23 @@ pub type Result = std::result::Result; #[derive(Debug, Snafu)] pub enum Error { - #[snafu(display("filesystem io error"))] - CacheIoError { source: io::Error }, + #[snafu(display("failed to rereive filesystem metadata"))] + IoMetadata { source: io::Error }, + + #[snafu(display("failed to read from filesystem"))] + IoRead { source: io::Error }, + + #[snafu(display("failed to write to filesystem"))] + IoWrite { source: io::Error }, + + #[snafu(display("failed to delete file from filesystem"))] + IoDelete { source: io::Error }, #[snafu(display("system time error"))] - SystemTimeError { source: SystemTimeError }, + SystemTime { source: SystemTimeError }, #[snafu(display("failed to parse last auto-purge timestamp from file"))] - ParseIntError { source: ParseIntError }, + ParsePurgeTimestamp { source: ParseIntError }, #[snafu(display("tried to write file with disabled cache"))] WriteDisabled, @@ -66,9 +75,9 @@ impl Cache { let modified = file_path .metadata() - .context(CacheIoSnafu {})? + .context(IoMetadataSnafu)? .modified() - .context(CacheIoSnafu {})?; + .context(IoMetadataSnafu)?; let elapsed = modified.elapsed().context(SystemTimeSnafu {})?; @@ -104,17 +113,17 @@ impl Cache { Backend::Disk { base_path } => { let mut files = Vec::new(); - let mut entries = fs::read_dir(base_path).await.context(CacheIoSnafu)?; + let mut entries = fs::read_dir(base_path).await.context(IoReadSnafu)?; - while let Some(entry) = entries.next_entry().await.context(CacheIoSnafu)? { - let metadata = entry.metadata().await.context(CacheIoSnafu)?; + while let Some(entry) = entries.next_entry().await.context(IoReadSnafu)? { + let metadata = entry.metadata().await.context(IoMetadataSnafu)?; // Skip protected files if is_protected_file(entry.file_name()) { continue; } - files.push((entry.path(), metadata.modified().context(CacheIoSnafu)?)) + files.push((entry.path(), metadata.modified().context(IoMetadataSnafu)?)) } Ok(files) @@ -128,10 +137,10 @@ impl Cache { pub async fn purge(&self, delete_filter: DeleteFilter) -> Result<()> { match &self.backend { Backend::Disk { base_path } => { - let mut entries = fs::read_dir(base_path).await.context(CacheIoSnafu)?; + let mut entries = fs::read_dir(base_path).await.context(IoReadSnafu)?; - while let Some(entry) = entries.next_entry().await.context(CacheIoSnafu)? { - let metadata = entry.metadata().await.context(CacheIoSnafu)?; + while let Some(entry) = entries.next_entry().await.context(IoReadSnafu)? { + let metadata = entry.metadata().await.context(IoMetadataSnafu)?; let should_delete_file = match delete_filter { // Skip protected files @@ -143,7 +152,7 @@ impl Cache { DeleteFilter::OnlyExpired => { metadata .modified() - .context(CacheIoSnafu)? + .context(IoMetadataSnafu)? .elapsed() .context(SystemTimeSnafu)? > self.max_age @@ -151,7 +160,7 @@ impl Cache { }; if should_delete_file { - fs::remove_file(entry.path()).await.context(CacheIoSnafu)?; + fs::remove_file(entry.path()).await.context(IoDeleteSnafu)?; } } @@ -168,11 +177,12 @@ impl Cache { // Read and covert timestamp let last_purged_at = match fs::read_to_string(&cache_auto_purge_filepath).await { - Ok(timestamp) => Some( - UNIX_EPOCH + Duration::from_secs(timestamp.parse().context(ParseIntSnafu)?), - ), + Ok(timestamp) => { + let ts = timestamp.parse().context(ParsePurgeTimestampSnafu)?; + Some(UNIX_EPOCH + Duration::from_secs(ts)) + } Err(err) if err.kind() == std::io::ErrorKind::NotFound => None, - Err(err) => return Err(err).context(CacheIoSnafu), + Err(err) => return Err(err).context(IoReadSnafu), }; // If the auto purge interval elapsed, run purge and write @@ -202,13 +212,13 @@ impl Cache { } async fn read(file_path: PathBuf) -> Result { - fs::read_to_string(file_path).await.context(CacheIoSnafu {}) + fs::read_to_string(file_path).await.context(IoReadSnafu) } async fn write(file_path: PathBuf, file_content: &str) -> Result<()> { fs::write(file_path, file_content) .await - .context(CacheIoSnafu {}) + .context(IoWriteSnafu {}) } fn file_path(base_path: &Path, file_url: &Url) -> PathBuf { @@ -266,7 +276,7 @@ impl Settings { pub async fn try_into_cache(self) -> Result { match &self.backend { Backend::Disk { base_path } => { - fs::create_dir_all(base_path).await.context(CacheIoSnafu)?; + fs::create_dir_all(base_path).await.context(IoWriteSnafu)?; Ok(Cache::new( self.backend, @@ -305,7 +315,7 @@ async fn write_cache_auto_purge_file(path: &Path) -> Result<()> { .as_bytes(), ) .await - .context(CacheIoSnafu) + .context(IoWriteSnafu) } fn is_protected_file(filename: OsString) -> bool { diff --git a/rust/stackable-cockpit/src/xfer/processor.rs b/rust/stackable-cockpit/src/xfer/processor.rs index 02e68ff0..e6b0252e 100644 --- a/rust/stackable-cockpit/src/xfer/processor.rs +++ b/rust/stackable-cockpit/src/xfer/processor.rs @@ -10,10 +10,10 @@ pub type Result = std::result::Result; #[derive(Debug, Snafu)] pub enum ProcessorError { #[snafu(display("failed to deserialize YAML content"))] - DeserializeYamlError { source: serde_yaml::Error }, + DeserializeYaml { source: serde_yaml::Error }, #[snafu(display("failed to render templated content"))] - TemplatingError { source: tera::Error }, + RenderTemplate { source: tera::Error }, } pub trait Processor: Sized { @@ -96,7 +96,7 @@ impl<'a> Processor for Template<'a> { type Output = String; fn process(&self, input: Self::Input) -> Result { - templating::render(&input, self.0).context(TemplatingSnafu) + templating::render(&input, self.0).context(RenderTemplateSnafu) } } diff --git a/rust/stackablectl/src/args/cluster.rs b/rust/stackablectl/src/args/cluster.rs index 66c1fb22..aa332ef5 100644 --- a/rust/stackablectl/src/args/cluster.rs +++ b/rust/stackablectl/src/args/cluster.rs @@ -9,10 +9,10 @@ use stackable_cockpit::{ #[derive(Debug, Snafu)] pub enum CommonClusterArgsError { #[snafu(display("failed to create kind cluster"))] - KindClusterError { source: kind::Error }, + KindClusterCreate { source: kind::Error }, #[snafu(display("minikube cluster error"))] - MinikubeClusterError { source: minikube::Error }, + MinikubeClusterCreate { source: minikube::Error }, #[snafu(display( "invalid total node count - at least two nodes in total are needed to run a local cluster" @@ -92,7 +92,7 @@ impl CommonClusterArgs { kind_cluster .create_if_not_exists() .await - .context(KindClusterSnafu) + .context(KindClusterCreateSnafu) } ClusterType::Minikube => { let minikube_cluster = minikube::Cluster::new(self.cluster_nodes, name); @@ -100,7 +100,7 @@ impl CommonClusterArgs { minikube_cluster .create_if_not_exists() .await - .context(MinikubeClusterSnafu) + .context(MinikubeClusterCreateSnafu) } } } diff --git a/rust/stackablectl/src/cmds/cache.rs b/rust/stackablectl/src/cmds/cache.rs index b345555f..3827d449 100644 --- a/rust/stackablectl/src/cmds/cache.rs +++ b/rust/stackablectl/src/cmds/cache.rs @@ -34,8 +34,11 @@ pub struct CacheCleanArgs { #[derive(Debug, Snafu)] pub enum CmdError { - #[snafu(display("failed to read from cache"))] - CacheError { source: cache::Error }, + #[snafu(display("failed to list cached files"))] + ListCachedFiles { source: cache::Error }, + + #[snafu(display("failed to purge cached files"))] + PurgeCachedFiles { source: cache::Error }, } impl CacheArgs { @@ -51,7 +54,7 @@ impl CacheArgs { async fn list_cmd(cache: Cache, cli: &Cli) -> Result { info!("Listing cached files"); - let files = cache.list().await.context(CacheSnafu)?; + let files = cache.list().await.context(ListCachedFilesSnafu)?; if files.is_empty() { return Ok("No cached files".into()); @@ -93,6 +96,10 @@ async fn clean_cmd(args: &CacheCleanArgs, cache: Cache) -> Result Result { let mut buf = Vec::new(); generate(shell, &mut cmd, "stackablectl", &mut buf); - String::from_utf8(buf).context(StringSnafu) + String::from_utf8(buf).context(StringConvertSnafu) } diff --git a/rust/stackablectl/src/cmds/demo.rs b/rust/stackablectl/src/cmds/demo.rs index 90c25047..9e02e3b3 100644 --- a/rust/stackablectl/src/cmds/demo.rs +++ b/rust/stackablectl/src/cmds/demo.rs @@ -11,7 +11,7 @@ use stackable_cockpit::{ constants::{DEFAULT_OPERATOR_NAMESPACE, DEFAULT_PRODUCT_NAMESPACE}, platform::{demo, namespace, release, stack}, utils::path::PathOrUrlParseError, - xfer::{cache::Cache, Client, Error}, + xfer::{cache::Cache, Client}, }; use crate::{ @@ -107,11 +107,11 @@ pub struct DemoUninstallArgs {} #[derive(Debug, Snafu)] pub enum CmdError { - #[snafu(display("unable to format YAML output"))] - YamlOutputFormatError { source: serde_yaml::Error }, + #[snafu(display("failed to serialize YAML output"))] + SerializeYamlOutput { source: serde_yaml::Error }, - #[snafu(display("unable to format JSON output"))] - JsonOutputFormatError { source: serde_json::Error }, + #[snafu(display("failed to serialize JSON output"))] + SerializeJsonOutput { source: serde_json::Error }, #[snafu(display("no demo with name '{name}'"))] NoSuchDemo { name: String }, @@ -119,23 +119,20 @@ pub enum CmdError { #[snafu(display("no stack with name '{name}'"))] NoSuchStack { name: String }, - #[snafu(display("list error"))] - ListError { source: list::Error }, + #[snafu(display("failed to build demo/stack/release list"))] + BuildList { source: list::Error }, - #[snafu(display("demo error"))] - DemoError { source: demo::Error }, + #[snafu(display("failed to install demo"))] + DemoInstall { source: demo::Error }, #[snafu(display("path/url parse error"))] - PathOrUrlParseError { source: PathOrUrlParseError }, + PathOrUrlParse { source: PathOrUrlParseError }, #[snafu(display("cluster argument error"))] - CommonClusterArgsError { source: CommonClusterArgsError }, - - #[snafu(display("file transfer error"))] - TransferError { source: Error }, + CommonClusterArgs { source: CommonClusterArgsError }, #[snafu(display("failed to create namespace '{namespace}'"))] - NamespaceError { + NamespaceCreate { source: namespace::Error, namespace: String, }, @@ -154,7 +151,7 @@ impl DemoArgs { let list = demo::List::build(&files, &transfer_client) .await - .context(ListSnafu)?; + .context(BuildListSnafu)?; match &self.subcommand { DemoCommands::List(args) => list_cmd(args, cli, list).await, @@ -203,8 +200,8 @@ async fn list_cmd(args: &DemoListArgs, cli: &Cli, list: demo::List) -> Result serde_json::to_string(&list.inner()).context(JsonOutputFormatSnafu), - OutputType::Yaml => serde_yaml::to_string(&list.inner()).context(YamlOutputFormatSnafu), + OutputType::Json => serde_json::to_string(&list.inner()).context(SerializeJsonOutputSnafu), + OutputType::Yaml => serde_yaml::to_string(&list.inner()).context(SerializeYamlOutputSnafu), } } @@ -250,8 +247,8 @@ async fn describe_cmd( Ok(result.render()) } - OutputType::Json => serde_json::to_string(&demo).context(JsonOutputFormatSnafu), - OutputType::Yaml => serde_yaml::to_string(&demo).context(YamlOutputFormatSnafu), + OutputType::Json => serde_json::to_string(&demo).context(SerializeJsonOutputSnafu), + OutputType::Yaml => serde_yaml::to_string(&demo).context(SerializeYamlOutputSnafu), } } @@ -276,13 +273,13 @@ async fn install_cmd( let files = cli.get_stack_files().context(PathOrUrlParseSnafu)?; let stack_list = stack::List::build(&files, transfer_client) .await - .context(ListSnafu)?; + .context(BuildListSnafu)?; let files = cli.get_release_files().context(PathOrUrlParseSnafu)?; let release_list = release::List::build(&files, transfer_client) .await - .context(ListSnafu)?; + .context(BuildListSnafu)?; // Install local cluster if needed args.local_cluster @@ -305,14 +302,14 @@ async fn install_cmd( if !args.skip_release { namespace::create_if_needed(operator_namespace.clone()) .await - .context(NamespaceSnafu { + .context(NamespaceCreateSnafu { namespace: operator_namespace.clone(), })?; } namespace::create_if_needed(product_namespace.clone()) .await - .context(NamespaceSnafu { + .context(NamespaceCreateSnafu { namespace: product_namespace.clone(), })?; @@ -328,7 +325,7 @@ async fn install_cmd( args.skip_release, ) .await - .context(DemoSnafu)?; + .context(DemoInstallSnafu)?; let operator_cmd = format!( "stackablectl operator installed{}", diff --git a/rust/stackablectl/src/cmds/operator.rs b/rust/stackablectl/src/cmds/operator.rs index 3ac388b0..5d9ea575 100644 --- a/rust/stackablectl/src/cmds/operator.rs +++ b/rust/stackablectl/src/cmds/operator.rs @@ -120,29 +120,26 @@ pub struct OperatorInstalledArgs { #[derive(Debug, Snafu)] pub enum CmdError { - #[snafu(display("invalid repo name"))] - InvalidRepoNameError { source: InvalidRepoNameError }, + #[snafu(display("invalid repository name"))] + InvalidRepoName { source: InvalidRepoNameError }, - #[snafu(display("unknown repo name: {name}"))] - UnknownRepoNameError { name: String }, + #[snafu(display("unknown repository name '{name}'"))] + UnknownRepoName { name: String }, #[snafu(display("Helm error"))] HelmError { source: helm::Error }, #[snafu(display("cluster argument error"))] - CommonClusterArgsError { source: CommonClusterArgsError }, + CommonClusterArgs { source: CommonClusterArgsError }, - #[snafu(display("semver parse error"))] - SemVerParseError { source: semver::Error }, + #[snafu(display("failed to serialize YAML output"))] + SerializeYamlOutput { source: serde_yaml::Error }, - #[snafu(display("unable to format YAML output"))] - YamlOutputFormatError { source: serde_yaml::Error }, - - #[snafu(display("unable to format JSON output"))] - JsonOutputFormatError { source: serde_json::Error }, + #[snafu(display("failed to serialize JSON output"))] + SerializeJsonOutput { source: serde_json::Error }, #[snafu(display("failed to create namespace '{namespace}'"))] - NamespaceError { + NamespaceCreate { source: namespace::Error, namespace: String, }, @@ -213,12 +210,8 @@ async fn list_cmd(args: &OperatorListArgs, cli: &Cli) -> Result { - Ok(serde_json::to_string(&versions_list).context(JsonOutputFormatSnafu)?) - } - OutputType::Yaml => { - Ok(serde_yaml::to_string(&versions_list).context(YamlOutputFormatSnafu)?) - } + OutputType::Json => serde_json::to_string(&versions_list).context(SerializeJsonOutputSnafu), + OutputType::Yaml => serde_yaml::to_string(&versions_list).context(SerializeYamlOutputSnafu), } } @@ -270,8 +263,8 @@ async fn describe_cmd(args: &OperatorDescribeArgs, cli: &Cli) -> Result serde_json::to_string(&versions_list).context(JsonOutputFormatSnafu), - OutputType::Yaml => serde_yaml::to_string(&versions_list).context(YamlOutputFormatSnafu), + OutputType::Json => serde_json::to_string(&versions_list).context(SerializeJsonOutputSnafu), + OutputType::Yaml => serde_yaml::to_string(&versions_list).context(SerializeYamlOutputSnafu), } } @@ -286,17 +279,16 @@ async fn install_cmd(args: &OperatorInstallArgs, cli: &Cli) -> Result println!("Installed {} operator", operator), - Err(err) => { - return Err(CmdError::HelmError { source: err }); - } - }; + operator + .install(&args.operator_namespace) + .context(HelmSnafu)?; + + println!("Installed {} operator", operator); } let mut result = cli.result(); @@ -410,8 +402,8 @@ fn installed_cmd(args: &OperatorInstalledArgs, cli: &Cli) -> Result Ok(serde_json::to_string(&installed).context(JsonOutputFormatSnafu)?), - OutputType::Yaml => Ok(serde_yaml::to_string(&installed).context(YamlOutputFormatSnafu)?), + OutputType::Json => serde_json::to_string(&installed).context(SerializeJsonOutputSnafu), + OutputType::Yaml => serde_yaml::to_string(&installed).context(SerializeYamlOutputSnafu), } } diff --git a/rust/stackablectl/src/cmds/release.rs b/rust/stackablectl/src/cmds/release.rs index 808251b8..2c62bfa2 100644 --- a/rust/stackablectl/src/cmds/release.rs +++ b/rust/stackablectl/src/cmds/release.rs @@ -11,7 +11,7 @@ use stackable_cockpit::{ constants::DEFAULT_OPERATOR_NAMESPACE, platform::{namespace, release}, utils::path::PathOrUrlParseError, - xfer::{cache::Cache, Client, Error}, + xfer::{cache::Cache, Client}, }; use crate::{ @@ -94,32 +94,29 @@ pub struct ReleaseUninstallArgs { #[derive(Debug, Snafu)] pub enum CmdError { - #[snafu(display("unable to format YAML output"))] - YamlOutputFormatError { source: serde_yaml::Error }, + #[snafu(display("failed to serialize YAML output"))] + SerializeYamlOutput { source: serde_yaml::Error }, - #[snafu(display("unable to format JSON output"))] - JsonOutputFormatError { source: serde_json::Error }, + #[snafu(display("failed to serialize JSON output"))] + SerializeJsonOutput { source: serde_json::Error }, - #[snafu(display("path/url parse error"))] - PathOrUrlParseError { source: PathOrUrlParseError }, + #[snafu(display("failed to parse path/url"))] + PathOrUrlParse { source: PathOrUrlParseError }, - #[snafu(display("list error"))] - ListError { source: list::Error }, + #[snafu(display("failed to build release list"))] + BuildList { source: list::Error }, - #[snafu(display("release install error"))] - ReleaseInstallError { source: release::Error }, + #[snafu(display("failed to install release"))] + ReleaseInstall { source: release::Error }, - #[snafu(display("release uninstall error"))] - ReleaseUninstallError { source: release::Error }, + #[snafu(display("failed to uninstall release"))] + ReleaseUninstall { source: release::Error }, #[snafu(display("cluster argument error"))] - CommonClusterArgsError { source: CommonClusterArgsError }, - - #[snafu(display("transfer error"))] - TransferError { source: Error }, + CommonClusterArgs { source: CommonClusterArgsError }, #[snafu(display("failed to create namespace '{namespace}'"))] - NamespaceError { + NamespaceCreate { source: namespace::Error, namespace: String, }, @@ -130,12 +127,10 @@ impl ReleaseArgs { debug!("Handle release args"); let transfer_client = Client::new_with(cache); - let files = cli.get_release_files().context(PathOrUrlParseSnafu)?; - let release_list = release::List::build(&files, &transfer_client) .await - .context(ListSnafu)?; + .context(BuildListSnafu)?; if release_list.inner().is_empty() { return Ok("No releases".into()); @@ -195,8 +190,8 @@ async fn list_cmd( Ok(result.render()) } - OutputType::Json => serde_json::to_string(&release_list).context(JsonOutputFormatSnafu), - OutputType::Yaml => serde_yaml::to_string(&release_list).context(YamlOutputFormatSnafu), + OutputType::Json => serde_json::to_string(&release_list).context(SerializeJsonOutputSnafu), + OutputType::Yaml => serde_yaml::to_string(&release_list).context(SerializeYamlOutputSnafu), } } @@ -249,8 +244,8 @@ async fn describe_cmd( Ok(result.render()) } - OutputType::Json => serde_json::to_string(&release).context(JsonOutputFormatSnafu), - OutputType::Yaml => serde_yaml::to_string(&release).context(YamlOutputFormatSnafu), + OutputType::Json => serde_json::to_string(&release).context(SerializeJsonOutputSnafu), + OutputType::Yaml => serde_yaml::to_string(&release).context(SerializeYamlOutputSnafu), }, None => Ok("No such release".into()), } @@ -277,7 +272,7 @@ async fn install_cmd( // Create operator namespace if needed namespace::create_if_needed(args.operator_namespace.clone()) .await - .context(NamespaceSnafu { + .context(NamespaceCreateSnafu { namespace: args.operator_namespace.clone(), })?; diff --git a/rust/stackablectl/src/cmds/stack.rs b/rust/stackablectl/src/cmds/stack.rs index b4286d9b..ee59b852 100644 --- a/rust/stackablectl/src/cmds/stack.rs +++ b/rust/stackablectl/src/cmds/stack.rs @@ -11,7 +11,7 @@ use stackable_cockpit::{ constants::{DEFAULT_OPERATOR_NAMESPACE, DEFAULT_PRODUCT_NAMESPACE}, platform::{namespace, release, stack}, utils::path::PathOrUrlParseError, - xfer::{cache::Cache, Client, Error}, + xfer::{cache::Cache, Client}, }; use crate::{ @@ -101,28 +101,25 @@ Use \"stackablectl stack describe \" to list available parameters for eac #[derive(Debug, Snafu)] pub enum CmdError { #[snafu(display("path/url parse error"))] - PathOrUrlParseError { source: PathOrUrlParseError }, + PathOrUrlParse { source: PathOrUrlParseError }, - #[snafu(display("unable to format YAML output"))] - YamlOutputFormatError { source: serde_yaml::Error }, + #[snafu(display("failed to serialize YAML output"))] + SerializeYamlOutput { source: serde_yaml::Error }, - #[snafu(display("unable to format JSON output"))] - JsonOutputFormatError { source: serde_json::Error }, + #[snafu(display("failed to serialize JSON output"))] + SerializeJsonOutput { source: serde_json::Error }, - #[snafu(display("stack error"))] - StackError { source: stack::Error }, + #[snafu(display("failed to install stack"))] + StackInstall { source: stack::Error }, - #[snafu(display("list error"))] - ListError { source: list::Error }, + #[snafu(display("failed to build stack/release list"))] + BuildList { source: list::Error }, #[snafu(display("cluster argument error"))] - CommonClusterArgsError { source: CommonClusterArgsError }, - - #[snafu(display("transfer error"))] - TransferError { source: Error }, + CommonClusterArgs { source: CommonClusterArgsError }, #[snafu(display("failed to create namespace '{namespace}'"))] - NamespaceError { + NamespaceCreate { source: namespace::Error, namespace: String, }, @@ -134,10 +131,9 @@ impl StackArgs { let transfer_client = Client::new_with(cache); let files = cli.get_stack_files().context(PathOrUrlParseSnafu)?; - let stack_list = stack::List::build(&files, &transfer_client) .await - .context(ListSnafu)?; + .context(BuildListSnafu)?; match &self.subcommand { StackCommands::List(args) => list_cmd(args, cli, stack_list), @@ -186,8 +182,8 @@ fn list_cmd(args: &StackListArgs, cli: &Cli, stack_list: stack::List) -> Result< Ok(result.render()) } - OutputType::Json => serde_json::to_string(&stack_list).context(JsonOutputFormatSnafu {}), - OutputType::Yaml => serde_yaml::to_string(&stack_list).context(YamlOutputFormatSnafu {}), + OutputType::Json => serde_json::to_string(&stack_list).context(SerializeJsonOutputSnafu), + OutputType::Yaml => serde_yaml::to_string(&stack_list).context(SerializeYamlOutputSnafu), } } @@ -241,8 +237,8 @@ fn describe_cmd( Ok(result.render()) } - OutputType::Json => serde_json::to_string(&stack).context(JsonOutputFormatSnafu {}), - OutputType::Yaml => serde_yaml::to_string(&stack).context(YamlOutputFormatSnafu {}), + OutputType::Json => serde_json::to_string(&stack).context(SerializeJsonOutputSnafu), + OutputType::Yaml => serde_yaml::to_string(&stack).context(SerializeYamlOutputSnafu), }, None => Ok("No such stack".into()), } @@ -258,10 +254,9 @@ async fn install_cmd( info!("Installing stack {}", args.stack_name); let files = cli.get_release_files().context(PathOrUrlParseSnafu)?; - let release_list = release::List::build(&files, transfer_client) .await - .context(ListSnafu)?; + .context(BuildListSnafu)?; let product_namespace = args .namespaces @@ -289,20 +284,20 @@ async fn install_cmd( stack_spec .check_prerequisites(&product_namespace) .await - .context(StackSnafu)?; + .context(StackInstallSnafu)?; // Install release if not opted out if !args.skip_release { namespace::create_if_needed(operator_namespace.clone()) .await - .context(NamespaceSnafu { + .context(NamespaceCreateSnafu { namespace: operator_namespace.clone(), })?; stack_spec .install_release(release_list, &operator_namespace, &product_namespace) .await - .context(StackSnafu)?; + .context(StackInstallSnafu)?; } else { info!("Skipping release installation during stack installation process"); } @@ -310,7 +305,7 @@ async fn install_cmd( // Create product namespace if needed namespace::create_if_needed(product_namespace.clone()) .await - .context(NamespaceSnafu { + .context(NamespaceCreateSnafu { namespace: product_namespace.clone(), })?; @@ -322,7 +317,7 @@ async fn install_cmd( transfer_client, ) .await - .context(StackSnafu)?; + .context(StackInstallSnafu)?; let operator_cmd = format!( "stackablectl operator installed{}", diff --git a/rust/stackablectl/src/cmds/stacklet.rs b/rust/stackablectl/src/cmds/stacklet.rs index 3f80c8af..7f71ec97 100644 --- a/rust/stackablectl/src/cmds/stacklet.rs +++ b/rust/stackablectl/src/cmds/stacklet.rs @@ -8,7 +8,7 @@ use tracing::{info, instrument}; use stackable_cockpit::{ constants::DEFAULT_PRODUCT_NAMESPACE, - platform::stacklet::{get_credentials_for_product, list_stacklets, Error}, + platform::stacklet::{self, get_credentials_for_product, list_stacklets}, utils::k8s::DisplayCondition, }; @@ -66,16 +66,16 @@ pub struct StackletListArgs { #[derive(Debug, Snafu)] pub enum CmdError { #[snafu(display("failed to list stacklets"))] - StackletListError { source: Error }, + StackletList { source: stacklet::Error }, #[snafu(display("failed to retrieve credentials for stacklet"))] - StackletCredentialsError { source: Error }, + StackletCredentials { source: stacklet::Error }, - #[snafu(display("unable to format YAML output"))] - YamlOutputFormatError { source: serde_yaml::Error }, + #[snafu(display("failed to serialize YAML output"))] + SerializeYamlOutput { source: serde_yaml::Error }, - #[snafu(display("unable to format JSON output"))] - JsonOutputFormatError { source: serde_json::Error }, + #[snafu(display("failed to serialize JSON output"))] + SerializeJsonOutput { source: serde_json::Error }, } impl StackletArgs { @@ -185,8 +185,8 @@ async fn list_cmd(args: &StackletListArgs, cli: &Cli) -> Result serde_json::to_string(&stacklets).context(JsonOutputFormatSnafu), - OutputType::Yaml => serde_yaml::to_string(&stacklets).context(YamlOutputFormatSnafu), + OutputType::Json => serde_json::to_string(&stacklets).context(SerializeJsonOutputSnafu), + OutputType::Yaml => serde_yaml::to_string(&stacklets).context(SerializeYamlOutputSnafu), } } diff --git a/rust/stackablectl/src/output/mod.rs b/rust/stackablectl/src/output/mod.rs index 6c9790d1..528f628b 100644 --- a/rust/stackablectl/src/output/mod.rs +++ b/rust/stackablectl/src/output/mod.rs @@ -19,10 +19,7 @@ pub type Result = std::result::Result; #[derive(Debug, Snafu)] pub enum Error { #[snafu(display("failed to create output renderer"))] - CreationError { source: tera::Error }, - - #[snafu(display("failed to render console output"))] - RenderError { source: tera::Error }, + CreateRenderer { source: tera::Error }, } #[derive(Debug)] @@ -123,7 +120,7 @@ where ("result", include_str!("templates/result.tpl")), ("error", include_str!("templates/error.tpl")), ]) - .context(CreationSnafu)?; + .context(CreateRendererSnafu)?; Ok(renderer) } From 4d2fc29aa228e887fc3e60f1d7f68544506bf9af Mon Sep 17 00:00:00 2001 From: Techassi Date: Tue, 28 Nov 2023 11:19:53 +0100 Subject: [PATCH 40/40] Switch verious terms to Title Case --- .../stackable-cockpit/src/engine/docker/mod.rs | 4 ++-- .../src/engine/minikube/mod.rs | 18 +++++++++--------- .../src/platform/credentials.rs | 2 +- .../src/platform/namespace.rs | 2 +- rust/stackable-cockpit/src/platform/service.rs | 2 +- .../src/platform/stack/spec.rs | 2 +- .../src/platform/stacklet/mod.rs | 4 ++-- rust/stackable-cockpit/src/utils/k8s/client.rs | 6 +++--- rust/stackablectl/src/args/cluster.rs | 4 ++-- 9 files changed, 22 insertions(+), 22 deletions(-) diff --git a/rust/stackable-cockpit/src/engine/docker/mod.rs b/rust/stackable-cockpit/src/engine/docker/mod.rs index 19893d94..1a7e515e 100644 --- a/rust/stackable-cockpit/src/engine/docker/mod.rs +++ b/rust/stackable-cockpit/src/engine/docker/mod.rs @@ -8,10 +8,10 @@ type Result = std::result::Result; #[derive(Debug, Snafu)] pub enum Error { - #[snafu(display("failed to start docker command"))] + #[snafu(display("failed to start Docker command"))] CommandFailedToStart { source: std::io::Error }, - #[snafu(display("failed to run docker command"))] + #[snafu(display("failed to run Docker command"))] CommandFailedToRun { source: std::io::Error }, #[snafu(display("it seems like Docker is not running on this system"))] diff --git a/rust/stackable-cockpit/src/engine/minikube/mod.rs b/rust/stackable-cockpit/src/engine/minikube/mod.rs index c92b795e..e1b4827e 100644 --- a/rust/stackable-cockpit/src/engine/minikube/mod.rs +++ b/rust/stackable-cockpit/src/engine/minikube/mod.rs @@ -11,7 +11,7 @@ use crate::{ #[derive(Debug, Snafu)] pub enum Error { #[snafu(display( - "failed to determine if a minikube cluster named '{cluster_name}' already exists" + "failed to determine if a Minikube cluster named '{cluster_name}' already exists" ))] CheckCluster { source: std::io::Error, @@ -21,7 +21,7 @@ pub enum Error { #[snafu(display("missing required binary: {binary}"))] MissingBinary { binary: String }, - #[snafu(display("failed to execute minikube command"))] + #[snafu(display("failed to execute Minikube command"))] MinikubeCommand { source: std::io::Error }, #[snafu(display("failed to determine if Docker is running"))] @@ -44,10 +44,10 @@ impl Cluster { } } - /// Create a new local cluster by calling the minikube binary + /// Create a new local cluster by calling the Minikube binary #[instrument] pub async fn create(&self) -> Result<(), Error> { - info!("Creating local cluster using minikube"); + info!("Creating local cluster using Minikube"); // Check if required binaries are present if let Some(binary) = binaries_present_with_name(&["docker", "minikube"]) { @@ -59,8 +59,8 @@ impl Cluster { .await .context(DockerCheckCommandSnafu)?; - // Create local cluster via minikube - debug!("Creating minikube cluster"); + // Create local cluster via Minikube + debug!("Creating Minikube cluster"); Command::new("minikube") .arg("start") .args(["--driver", "docker"]) @@ -73,10 +73,10 @@ impl Cluster { Ok(()) } - /// Creates a minikube cluster if it doesn't exist already. + /// Creates a Minikube cluster if it doesn't exist already. #[instrument] pub async fn create_if_not_exists(&self) -> Result<(), Error> { - info!("Creating cluster if it doesn't exist using minikube"); + info!("Creating cluster if it doesn't exist using Minikube"); if Self::check_if_cluster_exists(&self.name).await? { return Ok(()); @@ -98,7 +98,7 @@ impl Cluster { /// Check if a kind cluster with the provided name already exists. #[instrument] async fn check_if_cluster_exists(cluster_name: &str) -> Result { - debug!("Checking if minikube cluster exists"); + debug!("Checking if Minikube cluster exists"); let output = Command::new("minikube") .arg("status") diff --git a/rust/stackable-cockpit/src/platform/credentials.rs b/rust/stackable-cockpit/src/platform/credentials.rs index 01bbd503..67bb9cb0 100644 --- a/rust/stackable-cockpit/src/platform/credentials.rs +++ b/rust/stackable-cockpit/src/platform/credentials.rs @@ -10,7 +10,7 @@ pub type Result = std::result::Result; #[derive(Debug, Snafu)] pub enum Error { - #[snafu(display("failed to fetch data from kubernetes API"))] + #[snafu(display("failed to fetch data from Kubernetes API"))] KubeClientFetch { source: k8s::Error }, #[snafu(display("no credentials secret found"))] diff --git a/rust/stackable-cockpit/src/platform/namespace.rs b/rust/stackable-cockpit/src/platform/namespace.rs index 5060f3f0..46e632a0 100644 --- a/rust/stackable-cockpit/src/platform/namespace.rs +++ b/rust/stackable-cockpit/src/platform/namespace.rs @@ -4,7 +4,7 @@ use crate::utils::k8s; #[derive(Debug, Snafu)] pub enum Error { - #[snafu(display("failed to create kubernetes client"))] + #[snafu(display("failed to create Kubernetes client"))] KubeClientCreate { source: k8s::Error }, #[snafu(display("permission denied - try to create the namespace manually or choose an already existing one to which you have access to"))] diff --git a/rust/stackable-cockpit/src/platform/service.rs b/rust/stackable-cockpit/src/platform/service.rs index 99a41840..cabd1055 100644 --- a/rust/stackable-cockpit/src/platform/service.rs +++ b/rust/stackable-cockpit/src/platform/service.rs @@ -17,7 +17,7 @@ use crate::utils::k8s::{self, ListParamsExt}; #[derive(Debug, Snafu)] pub enum Error { - #[snafu(display("failed to fetch data from kubernetes API"))] + #[snafu(display("failed to fetch data from Kubernetes API"))] KubeClientFetch { source: k8s::Error }, #[snafu(display("missing namespace for service '{service}'"))] diff --git a/rust/stackable-cockpit/src/platform/stack/spec.rs b/rust/stackable-cockpit/src/platform/stack/spec.rs index 0ea0450a..483c1022 100644 --- a/rust/stackable-cockpit/src/platform/stack/spec.rs +++ b/rust/stackable-cockpit/src/platform/stack/spec.rs @@ -65,7 +65,7 @@ pub enum Error { }, /// This error indicates that the creation of a kube client failed. - #[snafu(display("failed to create kubernetes client"))] + #[snafu(display("failed to create Kubernetes client"))] KubeClientCreate { source: k8s::Error }, /// This error indicates that the kube client failed to deloy manifests. diff --git a/rust/stackable-cockpit/src/platform/stacklet/mod.rs b/rust/stackable-cockpit/src/platform/stacklet/mod.rs index 95c67547..eaaacf98 100644 --- a/rust/stackable-cockpit/src/platform/stacklet/mod.rs +++ b/rust/stackable-cockpit/src/platform/stacklet/mod.rs @@ -45,10 +45,10 @@ pub struct Stacklet { #[derive(Debug, Snafu)] pub enum Error { - #[snafu(display("failed to create kubernetes client"))] + #[snafu(display("failed to create Kubernetes client"))] KubeClientCreate { source: k8s::Error }, - #[snafu(display("failed to fetch data from the kubernetes api"))] + #[snafu(display("failed to fetch data from the Kubernetes API"))] KubeClientFetch { source: k8s::Error }, #[snafu(display("no namespace set for custom resource '{crd_name}'"))] diff --git a/rust/stackable-cockpit/src/utils/k8s/client.rs b/rust/stackable-cockpit/src/utils/k8s/client.rs index 70c172ca..2218e9b3 100644 --- a/rust/stackable-cockpit/src/utils/k8s/client.rs +++ b/rust/stackable-cockpit/src/utils/k8s/client.rs @@ -26,13 +26,13 @@ pub type Result = std::result::Result; #[derive(Debug, Snafu)] pub enum Error { - #[snafu(display("failed to create kubernetes client"))] + #[snafu(display("failed to create Kubernetes client"))] KubeClientCreate { source: kube::error::Error }, - #[snafu(display("failed to fetch data from kubernetes API"))] + #[snafu(display("failed to fetch data from Kubernetes API"))] KubeClientFetch { source: kube::error::Error }, - #[snafu(display("failed to patch/create kubernetes object"))] + #[snafu(display("failed to patch/create Kubernetes object"))] KubeClientPatch { source: kube::error::Error }, #[snafu(display("failed to deserialize YAML data"))] diff --git a/rust/stackablectl/src/args/cluster.rs b/rust/stackablectl/src/args/cluster.rs index aa332ef5..f7bf3f75 100644 --- a/rust/stackablectl/src/args/cluster.rs +++ b/rust/stackablectl/src/args/cluster.rs @@ -8,10 +8,10 @@ use stackable_cockpit::{ #[derive(Debug, Snafu)] pub enum CommonClusterArgsError { - #[snafu(display("failed to create kind cluster"))] + #[snafu(display("failed to create Kind cluster"))] KindClusterCreate { source: kind::Error }, - #[snafu(display("minikube cluster error"))] + #[snafu(display("failed to create Minikube cluster"))] MinikubeClusterCreate { source: minikube::Error }, #[snafu(display(