@@ -163,7 +163,7 @@ pub enum Command<Run: Args = ProductOperatorRun> {
163163/// Can be embedded into an extended argument set:
164164///
165165/// ```rust
166- /// # use stackable_operator::cli::{Command, OperatorEnvironmentOptions, ProductOperatorRun, ProductConfigPath};
166+ /// # use stackable_operator::cli::{Command, CommonOptions, OperatorEnvironmentOptions, ProductOperatorRun, ProductConfigPath};
167167/// # use stackable_operator::{namespace::WatchNamespace, utils::cluster_info::KubernetesClusterInfoOptions};
168168/// # use stackable_telemetry::tracing::TelemetryOptions;
169169/// use clap::Parser;
@@ -195,13 +195,15 @@ pub enum Command<Run: Args = ProductOperatorRun> {
195195/// assert_eq!(opts, Command::Run(Run {
196196/// name: "foo".to_string(),
197197/// common: ProductOperatorRun {
198+ /// common: CommonOptions {
199+ /// telemetry: TelemetryOptions::default(),
200+ /// cluster_info: KubernetesClusterInfoOptions {
201+ /// kubernetes_cluster_domain: None,
202+ /// kubernetes_node_name: "baz".to_string(),
203+ /// },
204+ /// },
198205/// product_config: ProductConfigPath::from("bar".as_ref()),
199206/// watch_namespace: WatchNamespace::One("foobar".to_string()),
200- /// telemetry: TelemetryOptions::default(),
201- /// cluster_info: KubernetesClusterInfoOptions {
202- /// kubernetes_cluster_domain: None,
203- /// kubernetes_node_name: "baz".to_string(),
204- /// },
205207/// operator_environment: OperatorEnvironmentOptions {
206208/// operator_namespace: "stackable-operators".to_string(),
207209/// operator_service_name: "foo-operator".to_string(),
@@ -230,17 +232,28 @@ pub enum Command<Run: Args = ProductOperatorRun> {
230232#[ derive( clap:: Parser , Debug , PartialEq , Eq ) ]
231233#[ command( long_about = "" ) ]
232234pub struct ProductOperatorRun {
235+ #[ command( flatten) ]
236+ pub common : CommonOptions ,
237+
238+ #[ command( flatten) ]
239+ pub operator_environment : OperatorEnvironmentOptions ,
240+
233241 /// Provides the path to a product-config file
234242 #[ arg( long, short = 'p' , value_name = "FILE" , default_value = "" , env) ]
235243 pub product_config : ProductConfigPath ,
236244
237245 /// Provides a specific namespace to watch (instead of watching all namespaces)
238246 #[ arg( long, env, default_value = "" ) ]
239247 pub watch_namespace : WatchNamespace ,
248+ }
240249
241- #[ command( flatten) ]
242- pub operator_environment : OperatorEnvironmentOptions ,
243-
250+ /// All the CLI arguments that all (or at least most) Stackable applications use.
251+ ///
252+ /// [`ProductOperatorRun`] is intended for operators, but it has fields that are not needed for
253+ /// utilities such as `user-info-fetcher` or `opa-bundle-builder`. So this struct offers a limited
254+ /// set, that should be shared across all Stackable tools running on Kubernetes.
255+ #[ derive( clap:: Parser , Debug , PartialEq , Eq ) ]
256+ pub struct CommonOptions {
244257 #[ command( flatten) ]
245258 pub telemetry : TelemetryOptions ,
246259
0 commit comments