diff --git a/CHANGELOG.md b/CHANGELOG.md index d251b691..af773ee1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ All notable changes to this project will be documented in this file. - `vector` `0.26.0` -> `0.33.0` ([#378], [#409]). - Let secret-operator handle certificate conversion ([#392]). - `operator-rs` `0.44.0` -> `0.55.0` ([#381], [#394], [#404], [#405], [#409]). +- Consolidate Rust workspace members ([#425]). ### Fixed @@ -38,6 +39,7 @@ All notable changes to this project will be documented in this file. [#407]: https://github.com/stackabletech/hdfs-operator/pull/407 [#409]: https://github.com/stackabletech/hdfs-operator/pull/409 [#422]: https://github.com/stackabletech/hdfs-operator/pull/422 +[#425]: https://github.com/stackabletech/hdfs-operator/pull/425 ## [23.7.0] - 2023-07-14 diff --git a/Cargo.lock b/Cargo.lock index fc601244..6241f53c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -941,9 +941,9 @@ dependencies = [ [[package]] name = "jobserver" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "936cfd212a0155903bcbc060e316fb6cc7cbf2e1907329391ebadc1fe0ce77c2" +checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" dependencies = [ "libc", ] @@ -1851,9 +1851,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" +checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80" dependencies = [ "serde", ] @@ -2004,6 +2004,9 @@ dependencies = [ name = "stackable-hdfs-operator" version = "0.0.0-dev" dependencies = [ + "anyhow", + "built", + "clap", "futures 0.3.28", "indoc", "product-config", @@ -2019,20 +2022,6 @@ dependencies = [ "tracing-futures", ] -[[package]] -name = "stackable-hdfs-operator-binary" -version = "0.0.0-dev" -dependencies = [ - "anyhow", - "built", - "clap", - "stackable-hdfs-crd", - "stackable-hdfs-operator", - "stackable-operator", - "tokio", - "tracing", -] - [[package]] name = "stackable-operator" version = "0.56.0" @@ -2286,9 +2275,9 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.3" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" dependencies = [ "serde", ] @@ -2732,9 +2721,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winnow" -version = "0.5.15" +version = "0.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c2e3184b9c4e92ad5167ca73039d0c42476302ab603e2fec4487511f38ccefc" +checksum = "829846f3e3db426d4cee4510841b71a8e58aa2a76b1132579487ae430ccd9c7b" dependencies = [ "memchr", ] diff --git a/Cargo.toml b/Cargo.toml index 263886e6..9cbad6b7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,5 @@ [workspace] -members = [ - "rust/crd", "rust/operator", "rust/operator-binary" -] +members = ["rust/crd", "rust/operator-binary"] [workspace.package] version = "0.0.0-dev" diff --git a/rust/operator-binary/Cargo.toml b/rust/operator-binary/Cargo.toml index dd9fb544..5ff2a4a9 100644 --- a/rust/operator-binary/Cargo.toml +++ b/rust/operator-binary/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "stackable-hdfs-operator-binary" +name = "stackable-hdfs-operator" description = "Stackable Operator for Apache Hadoop HDFS" version.workspace = true authors.workspace = true @@ -7,21 +7,30 @@ license.workspace = true edition.workspace = true repository.workspace = true publish = false -build = "build.rs" [dependencies] stackable-hdfs-crd = { path = "../crd" } -stackable-hdfs-operator = { path = "../operator" } anyhow.workspace = true clap.workspace = true +futures.workspace = true +indoc.workspace = true +product-config.workspace = true +serde_json.workspace = true +serde.workspace = true +snafu.workspace = true stackable-operator.workspace = true +strum.workspace = true tokio.workspace = true +tracing-futures.workspace = true tracing.workspace = true +[dev-dependencies] +rstest.workspace = true + [build-dependencies] built.workspace = true [[bin]] name = "stackable-hdfs-operator" -path = "src/stackable-hdfs-operator.rs" +path = "src/main.rs" diff --git a/rust/operator/src/config.rs b/rust/operator-binary/src/config.rs similarity index 100% rename from rust/operator/src/config.rs rename to rust/operator-binary/src/config.rs diff --git a/rust/operator/src/container.rs b/rust/operator-binary/src/container.rs similarity index 100% rename from rust/operator/src/container.rs rename to rust/operator-binary/src/container.rs diff --git a/rust/operator/src/discovery.rs b/rust/operator-binary/src/discovery.rs similarity index 100% rename from rust/operator/src/discovery.rs rename to rust/operator-binary/src/discovery.rs diff --git a/rust/operator/src/event.rs b/rust/operator-binary/src/event.rs similarity index 100% rename from rust/operator/src/event.rs rename to rust/operator-binary/src/event.rs diff --git a/rust/operator/src/hdfs_controller.rs b/rust/operator-binary/src/hdfs_controller.rs similarity index 100% rename from rust/operator/src/hdfs_controller.rs rename to rust/operator-binary/src/hdfs_controller.rs diff --git a/rust/operator/src/kerberos.rs b/rust/operator-binary/src/kerberos.rs similarity index 100% rename from rust/operator/src/kerberos.rs rename to rust/operator-binary/src/kerberos.rs diff --git a/rust/operator/src/kerberos_hdfs_3.2_stacktrace.txt b/rust/operator-binary/src/kerberos_hdfs_3.2_stacktrace.txt similarity index 100% rename from rust/operator/src/kerberos_hdfs_3.2_stacktrace.txt rename to rust/operator-binary/src/kerberos_hdfs_3.2_stacktrace.txt diff --git a/rust/operator/src/lib.rs b/rust/operator-binary/src/main.rs similarity index 64% rename from rust/operator/src/lib.rs rename to rust/operator-binary/src/main.rs index 29257578..49b3fae4 100644 --- a/rust/operator/src/lib.rs +++ b/rust/operator-binary/src/main.rs @@ -1,10 +1,12 @@ use std::sync::Arc; +use clap::{crate_description, crate_version, Parser}; use futures::StreamExt; use product_config::ProductConfigManager; use stackable_hdfs_crd::{constants::*, HdfsCluster}; use stackable_operator::{ - client::Client, + cli::{Command, ProductOperatorRun}, + client::{self, Client}, k8s_openapi::api::{ apps::v1::StatefulSet, core::v1::{ConfigMap, Pod, Service}, @@ -13,6 +15,7 @@ use stackable_operator::{ labels::ObjectLabels, logging::controller::report_controller_reconciled, namespace::WatchNamespace, + CustomResourceExt, }; use tracing::info_span; use tracing_futures::Instrument; @@ -28,11 +31,56 @@ mod pod_svc_controller; mod product_logging; mod built_info { + include!(concat!(env!("OUT_DIR"), "/built.rs")); + pub const TARGET_PLATFORM: Option<&str> = option_env!("TARGET"); pub const CARGO_PKG_VERSION: &str = env!("CARGO_PKG_VERSION"); } pub const OPERATOR_NAME: &str = "hdfs.stackable.tech"; +#[derive(clap::Parser)] +#[clap(about, author)] +struct Opts { + #[clap(subcommand)] + cmd: Command, +} + +#[tokio::main] +async fn main() -> anyhow::Result<()> { + let opts = Opts::parse(); + match opts.cmd { + Command::Crd => HdfsCluster::print_yaml_schema()?, + Command::Run(ProductOperatorRun { + product_config, + watch_namespace, + tracing_target, + }) => { + stackable_operator::logging::initialize_logging( + "HDFS_OPERATOR_LOG", + APP_NAME, + tracing_target, + ); + + stackable_operator::utils::print_startup_string( + crate_description!(), + crate_version!(), + built_info::GIT_VERSION, + built_info::TARGET_PLATFORM.unwrap_or("unknown target"), + built_info::BUILT_TIME_UTC, + built_info::RUSTC_VERSION, + ); + let product_config = product_config.load(&[ + "deploy/config-spec/properties.yaml", + "/etc/stackable/hdfs-operator/config-spec/properties.yaml", + ])?; + let client = client::create_client(Some(OPERATOR_NAME.to_string())).await?; + create_controller(client, product_config, watch_namespace).await; + } + }; + + Ok(()) +} + pub async fn create_controller( client: Client, product_config: ProductConfigManager, diff --git a/rust/operator/src/operations/graceful_shutdown.rs b/rust/operator-binary/src/operations/graceful_shutdown.rs similarity index 100% rename from rust/operator/src/operations/graceful_shutdown.rs rename to rust/operator-binary/src/operations/graceful_shutdown.rs diff --git a/rust/operator/src/operations/mod.rs b/rust/operator-binary/src/operations/mod.rs similarity index 100% rename from rust/operator/src/operations/mod.rs rename to rust/operator-binary/src/operations/mod.rs diff --git a/rust/operator/src/operations/pdb.rs b/rust/operator-binary/src/operations/pdb.rs similarity index 100% rename from rust/operator/src/operations/pdb.rs rename to rust/operator-binary/src/operations/pdb.rs diff --git a/rust/operator/src/pod_svc_controller.rs b/rust/operator-binary/src/pod_svc_controller.rs similarity index 100% rename from rust/operator/src/pod_svc_controller.rs rename to rust/operator-binary/src/pod_svc_controller.rs diff --git a/rust/operator/src/product_logging.rs b/rust/operator-binary/src/product_logging.rs similarity index 100% rename from rust/operator/src/product_logging.rs rename to rust/operator-binary/src/product_logging.rs diff --git a/rust/operator-binary/src/stackable-hdfs-operator.rs b/rust/operator-binary/src/stackable-hdfs-operator.rs deleted file mode 100644 index 6c9fe1ab..00000000 --- a/rust/operator-binary/src/stackable-hdfs-operator.rs +++ /dev/null @@ -1,58 +0,0 @@ -use clap::{crate_description, crate_version, Parser}; -use stackable_hdfs_crd::constants::APP_NAME; -use stackable_hdfs_crd::HdfsCluster; -use stackable_hdfs_operator::OPERATOR_NAME; -use stackable_operator::{ - cli::{Command, ProductOperatorRun}, - client, CustomResourceExt, -}; - -mod built_info { - // The file has been placed there by the build script. - include!(concat!(env!("OUT_DIR"), "/built.rs")); - pub const TARGET_PLATFORM: Option<&str> = option_env!("TARGET"); -} - -#[derive(clap::Parser)] -#[clap(about, author)] -struct Opts { - #[clap(subcommand)] - cmd: Command, -} - -#[tokio::main] -async fn main() -> anyhow::Result<()> { - let opts = Opts::parse(); - match opts.cmd { - Command::Crd => HdfsCluster::print_yaml_schema()?, - Command::Run(ProductOperatorRun { - product_config, - watch_namespace, - tracing_target, - }) => { - stackable_operator::logging::initialize_logging( - "HDFS_OPERATOR_LOG", - APP_NAME, - tracing_target, - ); - - stackable_operator::utils::print_startup_string( - crate_description!(), - crate_version!(), - built_info::GIT_VERSION, - built_info::TARGET_PLATFORM.unwrap_or("unknown target"), - built_info::BUILT_TIME_UTC, - built_info::RUSTC_VERSION, - ); - let product_config = product_config.load(&[ - "deploy/config-spec/properties.yaml", - "/etc/stackable/hdfs-operator/config-spec/properties.yaml", - ])?; - let client = client::create_client(Some(OPERATOR_NAME.to_string())).await?; - stackable_hdfs_operator::create_controller(client, product_config, watch_namespace) - .await; - } - }; - - Ok(()) -} diff --git a/rust/operator/Cargo.toml b/rust/operator/Cargo.toml deleted file mode 100644 index 941321fc..00000000 --- a/rust/operator/Cargo.toml +++ /dev/null @@ -1,27 +0,0 @@ -[package] -name = "stackable-hdfs-operator" -description = "Stackable Operator for Apache Hadoop HDFS - The Operator Library" -version.workspace = true -authors.workspace = true -license.workspace = true -edition.workspace = true -repository.workspace = true -publish = false - -[dependencies] -stackable-hdfs-crd = { path = "../crd" } - -futures.workspace = true -indoc.workspace = true -serde.workspace = true -serde_json.workspace = true -snafu.workspace = true -stackable-operator.workspace = true -product-config.workspace = true -strum.workspace = true -tokio.workspace = true -tracing.workspace = true -tracing-futures.workspace = true - -[dev-dependencies] -rstest.workspace = true