diff --git a/Cargo.lock b/Cargo.lock index ebcd2867b..9c0ecb97e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -617,9 +617,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.14" +version = "0.5.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ba6d68e24814cb8de6bb986db8222d3a027d15872cabc0d18817bc3c0e4471" +checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2" dependencies = [ "crossbeam-utils", ] @@ -3210,6 +3210,7 @@ dependencies = [ "stackable-operator-derive", "stackable-shared", "stackable-telemetry", + "stackable-versioned", "strum", "tempfile", "time", diff --git a/crates/stackable-operator/CHANGELOG.md b/crates/stackable-operator/CHANGELOG.md index 853b1b082..3b37d96ff 100644 --- a/crates/stackable-operator/CHANGELOG.md +++ b/crates/stackable-operator/CHANGELOG.md @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +### Added + +- Add re-exports for `stackable-telemetry` and `stackable-versioned` ([#1007]). +- Add new features: `default`, `full`, `telemetry`, and `versioned` ([#1007]). + +[#1007]: https://github.com/stackabletech/operator-rs/pull/1007 + ## [0.91.0] - 2025-04-08 ### Changed diff --git a/crates/stackable-operator/Cargo.toml b/crates/stackable-operator/Cargo.toml index e6cbe45cd..b96316a28 100644 --- a/crates/stackable-operator/Cargo.toml +++ b/crates/stackable-operator/Cargo.toml @@ -8,10 +8,15 @@ edition.workspace = true repository.workspace = true [features] +full = ["time", "telemetry", "versioned"] +default = ["telemetry", "versioned"] time = ["dep:time"] +telemetry = [] +versioned = [] [dependencies] -stackable-telemetry = { path = "../stackable-telemetry", features = ["clap"]} +stackable-telemetry = { path = "../stackable-telemetry", features = ["clap"] } +stackable-versioned = { path = "../stackable-versioned", features = ["k8s"] } stackable-operator-derive = { path = "../stackable-operator-derive" } stackable-shared = { path = "../stackable-shared" } diff --git a/crates/stackable-operator/src/lib.rs b/crates/stackable-operator/src/lib.rs index 50567fb88..cd4108ca0 100644 --- a/crates/stackable-operator/src/lib.rs +++ b/crates/stackable-operator/src/lib.rs @@ -1,3 +1,11 @@ +//! ## Crate Features +//! +//! - `default` enables a default set of features which most operators need. +//! - `full` enables all available features. +//! - `time` enables interoperability between [`time::Duration`] and the `time` crate. +//! - `telemetry` enables various helpers for emitting telemetry data. +//! - `versioned` enables the macro for CRD versioning. + pub mod builder; pub mod cli; pub mod client; @@ -21,14 +29,16 @@ pub mod time; pub mod utils; pub mod validation; +// External re-exports +pub use k8s_openapi; +pub use kube; +pub use schemars; // Internal re-exports +// TODO (@Techassi): Ideally we would want webhook and certs exported here as +// well, but that would require some restructuring of crates. +pub use stackable_shared as shared; pub use stackable_shared::{crd::CustomResourceExt, yaml::YamlSchema}; - -pub mod shared { - pub use stackable_shared::*; -} - -// External re-exports -pub use ::k8s_openapi; -pub use ::kube; -pub use ::schemars; +#[cfg(feature = "telemetry")] +pub use stackable_telemetry as telemetry; +#[cfg(feature = "versioned")] +pub use stackable_versioned as versioned; diff --git a/crates/stackable-versioned-macros/src/lib.rs b/crates/stackable-versioned-macros/src/lib.rs index 0c4fba634..469ee61b0 100644 --- a/crates/stackable-versioned-macros/src/lib.rs +++ b/crates/stackable-versioned-macros/src/lib.rs @@ -700,7 +700,7 @@ especially for CustomResourceDefinitions (CRDs). These features are completely opt-in. You need to enable the `k8s` feature (which enables optional dependencies) and use the `k8s()` parameter in the macro. -You need to derive both [`kube::CustomResource`] and [`schemars::JsonSchema`]. +You need to derive both [`kube::CustomResource`] and [`schemars::JsonSchema`][1]. ``` # use stackable_versioned_macros::versioned; @@ -730,7 +730,7 @@ println!("{}", serde_yaml::to_string(&merged_crd).unwrap()); # } ``` -The generated `merged_crd` method is a wrapper around [kube's `merge_crds`][1] +The generated `merged_crd` method is a wrapper around [kube's `merge_crds`][2] function. It automatically calls the `crd` methods of the CRD in all of its versions and additionally provides a strongly typed selector for the stored API version. @@ -846,6 +846,9 @@ mod v1 { It is possible to include structs and enums which are not CRDs. They are instead versioned as expected (without adding the `#[kube]` derive macro and generating code to merge CRD versions). + +[1]: https://docs.rs/schemars/latest/schemars/derive.JsonSchema.html +[2]: https://docs.rs/kube/latest/kube/core/crd/fn.merge_crds.html "# )] #[proc_macro_attribute]