From 4c539e54769490ef1a66758d9a7cc7f45d85ea76 Mon Sep 17 00:00:00 2001 From: Sebastian Bernauer Date: Mon, 25 Aug 2025 10:31:53 +0200 Subject: [PATCH 1/5] feat!: Add CommonStackableCliArgs struct --- crates/stackable-operator/CHANGELOG.md | 10 ++++++++++ crates/stackable-operator/src/cli.rs | 17 ++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/crates/stackable-operator/CHANGELOG.md b/crates/stackable-operator/CHANGELOG.md index a9ba07d55..e166a6cba 100644 --- a/crates/stackable-operator/CHANGELOG.md +++ b/crates/stackable-operator/CHANGELOG.md @@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +### Added + +- Add a `CommonStackableCliArgs` struct, which can be used for non-operator Stackable tools ([#10XX]). + +### Changed + +- BREAKING: The `telemetry` and `cluster_info` fields of `ProductOperatorRun` have moved below the `common` field ([#10XX]). + +[#10XX]: https://github.com/stackabletech/operator-rs/pull/10XX + ## [0.95.0] - 2025-08-21 ### Added diff --git a/crates/stackable-operator/src/cli.rs b/crates/stackable-operator/src/cli.rs index bfaa1704f..ee3a97782 100644 --- a/crates/stackable-operator/src/cli.rs +++ b/crates/stackable-operator/src/cli.rs @@ -230,6 +230,12 @@ pub enum Command { #[derive(clap::Parser, Debug, PartialEq, Eq)] #[command(long_about = "")] pub struct ProductOperatorRun { + #[command(flatten)] + pub common: CommonStackableCliArgs, + + #[command(flatten)] + pub operator_environment: OperatorEnvironmentOptions, + /// Provides the path to a product-config file #[arg(long, short = 'p', value_name = "FILE", default_value = "", env)] pub product_config: ProductConfigPath, @@ -237,10 +243,15 @@ pub struct ProductOperatorRun { /// Provides a specific namespace to watch (instead of watching all namespaces) #[arg(long, env, default_value = "")] pub watch_namespace: WatchNamespace, +} - #[command(flatten)] - pub operator_environment: OperatorEnvironmentOptions, - +/// All the CLI arguments that all (or at least most) Stackable applications use. +/// +/// [`ProductOperatorRun`] is intended for operators, but it has fields that are not needed for +/// utilities such as `user-info-fetcher` or `opa-bundle-builder`. So this struct offers a limited +/// set, that should be shared across all Stackable tools running in Kubernetes. +#[derive(clap::Parser, Debug, PartialEq, Eq)] +pub struct CommonStackableCliArgs { #[command(flatten)] pub telemetry: TelemetryOptions, From 2de4765643f3ec98ea628fa2880d1f2c877f1632 Mon Sep 17 00:00:00 2001 From: Sebastian Bernauer Date: Mon, 25 Aug 2025 10:45:06 +0200 Subject: [PATCH 2/5] fix docs --- crates/stackable-operator/src/cli.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/crates/stackable-operator/src/cli.rs b/crates/stackable-operator/src/cli.rs index ee3a97782..30a122ca3 100644 --- a/crates/stackable-operator/src/cli.rs +++ b/crates/stackable-operator/src/cli.rs @@ -163,7 +163,7 @@ pub enum Command { /// Can be embedded into an extended argument set: /// /// ```rust -/// # use stackable_operator::cli::{Command, OperatorEnvironmentOptions, ProductOperatorRun, ProductConfigPath}; +/// # use stackable_operator::cli::{Command, CommonStackableCliArgs, OperatorEnvironmentOptions, ProductOperatorRun, ProductConfigPath}; /// # use stackable_operator::{namespace::WatchNamespace, utils::cluster_info::KubernetesClusterInfoOptions}; /// # use stackable_telemetry::tracing::TelemetryOptions; /// use clap::Parser; @@ -195,13 +195,15 @@ pub enum Command { /// assert_eq!(opts, Command::Run(Run { /// name: "foo".to_string(), /// common: ProductOperatorRun { +/// common: CommonStackableCliArgs { +/// telemetry: TelemetryOptions::default(), +/// cluster_info: KubernetesClusterInfoOptions { +/// kubernetes_cluster_domain: None, +/// kubernetes_node_name: "baz".to_string(), +/// }, +/// }, /// product_config: ProductConfigPath::from("bar".as_ref()), /// watch_namespace: WatchNamespace::One("foobar".to_string()), -/// telemetry: TelemetryOptions::default(), -/// cluster_info: KubernetesClusterInfoOptions { -/// kubernetes_cluster_domain: None, -/// kubernetes_node_name: "baz".to_string(), -/// }, /// operator_environment: OperatorEnvironmentOptions { /// operator_namespace: "stackable-operators".to_string(), /// operator_service_name: "foo-operator".to_string(), From 6d112d2ca0325089e9c7043e6d6b478fc7a0e6ef Mon Sep 17 00:00:00 2001 From: Sebastian Bernauer Date: Mon, 25 Aug 2025 10:48:46 +0200 Subject: [PATCH 3/5] typo --- crates/stackable-operator/src/cli.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/stackable-operator/src/cli.rs b/crates/stackable-operator/src/cli.rs index 30a122ca3..6df039da7 100644 --- a/crates/stackable-operator/src/cli.rs +++ b/crates/stackable-operator/src/cli.rs @@ -251,7 +251,7 @@ pub struct ProductOperatorRun { /// /// [`ProductOperatorRun`] is intended for operators, but it has fields that are not needed for /// utilities such as `user-info-fetcher` or `opa-bundle-builder`. So this struct offers a limited -/// set, that should be shared across all Stackable tools running in Kubernetes. +/// set, that should be shared across all Stackable tools running on Kubernetes. #[derive(clap::Parser, Debug, PartialEq, Eq)] pub struct CommonStackableCliArgs { #[command(flatten)] From 2c57374deedc3d6af8ab4f8d723b68350c110cf2 Mon Sep 17 00:00:00 2001 From: Sebastian Bernauer Date: Mon, 25 Aug 2025 10:58:15 +0200 Subject: [PATCH 4/5] Rename to CommonOptions --- crates/stackable-operator/CHANGELOG.md | 2 +- crates/stackable-operator/src/cli.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/stackable-operator/CHANGELOG.md b/crates/stackable-operator/CHANGELOG.md index ba1caafcf..64f602158 100644 --- a/crates/stackable-operator/CHANGELOG.md +++ b/crates/stackable-operator/CHANGELOG.md @@ -6,7 +6,7 @@ All notable changes to this project will be documented in this file. ### Added -- Add a `CommonStackableCliArgs` struct, which can be used for non-operator Stackable tools ([#1083]). +- Add a `cli::CommonOptions` struct, which can be used for non-operator Stackable tools ([#1083]). ### Changed diff --git a/crates/stackable-operator/src/cli.rs b/crates/stackable-operator/src/cli.rs index 6df039da7..6739c95b9 100644 --- a/crates/stackable-operator/src/cli.rs +++ b/crates/stackable-operator/src/cli.rs @@ -195,7 +195,7 @@ pub enum Command { /// assert_eq!(opts, Command::Run(Run { /// name: "foo".to_string(), /// common: ProductOperatorRun { -/// common: CommonStackableCliArgs { +/// common: CommonOptions { /// telemetry: TelemetryOptions::default(), /// cluster_info: KubernetesClusterInfoOptions { /// kubernetes_cluster_domain: None, @@ -233,7 +233,7 @@ pub enum Command { #[command(long_about = "")] pub struct ProductOperatorRun { #[command(flatten)] - pub common: CommonStackableCliArgs, + pub common: CommonOptions, #[command(flatten)] pub operator_environment: OperatorEnvironmentOptions, @@ -253,7 +253,7 @@ pub struct ProductOperatorRun { /// utilities such as `user-info-fetcher` or `opa-bundle-builder`. So this struct offers a limited /// set, that should be shared across all Stackable tools running on Kubernetes. #[derive(clap::Parser, Debug, PartialEq, Eq)] -pub struct CommonStackableCliArgs { +pub struct CommonOptions { #[command(flatten)] pub telemetry: TelemetryOptions, From 07df20222b31df431e52c0dfbaafc47ccbb74a59 Mon Sep 17 00:00:00 2001 From: Sebastian Bernauer Date: Mon, 25 Aug 2025 11:03:43 +0200 Subject: [PATCH 5/5] fix docs --- crates/stackable-operator/src/cli.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/stackable-operator/src/cli.rs b/crates/stackable-operator/src/cli.rs index 6739c95b9..3c91bae9d 100644 --- a/crates/stackable-operator/src/cli.rs +++ b/crates/stackable-operator/src/cli.rs @@ -163,7 +163,7 @@ pub enum Command { /// Can be embedded into an extended argument set: /// /// ```rust -/// # use stackable_operator::cli::{Command, CommonStackableCliArgs, OperatorEnvironmentOptions, ProductOperatorRun, ProductConfigPath}; +/// # use stackable_operator::cli::{Command, CommonOptions, OperatorEnvironmentOptions, ProductOperatorRun, ProductConfigPath}; /// # use stackable_operator::{namespace::WatchNamespace, utils::cluster_info::KubernetesClusterInfoOptions}; /// # use stackable_telemetry::tracing::TelemetryOptions; /// use clap::Parser;