Skip to content

Commit fe99fa2

Browse files
authored
feat(stackable-operator): Add re-exports for telemetry and versioned crate (#1007)
* feat: Add re-exports to stackable-operator * chore: Update changelog * chore: Bump crossbeam-channel 0.5.15 (0.5.14 was yanked) * fix(docs): Use correct references
1 parent 26b2cee commit fe99fa2

File tree

5 files changed

+40
-14
lines changed

5 files changed

+40
-14
lines changed

Cargo.lock

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/stackable-operator/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
44

55
## [Unreleased]
66

7+
### Added
8+
9+
- Add re-exports for `stackable-telemetry` and `stackable-versioned` ([#1007]).
10+
- Add new features: `default`, `full`, `telemetry`, and `versioned` ([#1007]).
11+
12+
[#1007]: https://github.com/stackabletech/operator-rs/pull/1007
13+
714
## [0.91.0] - 2025-04-08
815

916
### Changed

crates/stackable-operator/Cargo.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,15 @@ edition.workspace = true
88
repository.workspace = true
99

1010
[features]
11+
full = ["time", "telemetry", "versioned"]
12+
default = ["telemetry", "versioned"]
1113
time = ["dep:time"]
14+
telemetry = []
15+
versioned = []
1216

1317
[dependencies]
14-
stackable-telemetry = { path = "../stackable-telemetry", features = ["clap"]}
18+
stackable-telemetry = { path = "../stackable-telemetry", features = ["clap"] }
19+
stackable-versioned = { path = "../stackable-versioned", features = ["k8s"] }
1520
stackable-operator-derive = { path = "../stackable-operator-derive" }
1621
stackable-shared = { path = "../stackable-shared" }
1722

crates/stackable-operator/src/lib.rs

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
//! ## Crate Features
2+
//!
3+
//! - `default` enables a default set of features which most operators need.
4+
//! - `full` enables all available features.
5+
//! - `time` enables interoperability between [`time::Duration`] and the `time` crate.
6+
//! - `telemetry` enables various helpers for emitting telemetry data.
7+
//! - `versioned` enables the macro for CRD versioning.
8+
19
pub mod builder;
210
pub mod cli;
311
pub mod client;
@@ -21,14 +29,16 @@ pub mod time;
2129
pub mod utils;
2230
pub mod validation;
2331

32+
// External re-exports
33+
pub use k8s_openapi;
34+
pub use kube;
35+
pub use schemars;
2436
// Internal re-exports
37+
// TODO (@Techassi): Ideally we would want webhook and certs exported here as
38+
// well, but that would require some restructuring of crates.
39+
pub use stackable_shared as shared;
2540
pub use stackable_shared::{crd::CustomResourceExt, yaml::YamlSchema};
26-
27-
pub mod shared {
28-
pub use stackable_shared::*;
29-
}
30-
31-
// External re-exports
32-
pub use ::k8s_openapi;
33-
pub use ::kube;
34-
pub use ::schemars;
41+
#[cfg(feature = "telemetry")]
42+
pub use stackable_telemetry as telemetry;
43+
#[cfg(feature = "versioned")]
44+
pub use stackable_versioned as versioned;

crates/stackable-versioned-macros/src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ especially for CustomResourceDefinitions (CRDs). These features are
700700
completely opt-in. You need to enable the `k8s` feature (which enables
701701
optional dependencies) and use the `k8s()` parameter in the macro.
702702
703-
You need to derive both [`kube::CustomResource`] and [`schemars::JsonSchema`].
703+
You need to derive both [`kube::CustomResource`] and [`schemars::JsonSchema`][1].
704704
705705
```
706706
# use stackable_versioned_macros::versioned;
@@ -730,7 +730,7 @@ println!("{}", serde_yaml::to_string(&merged_crd).unwrap());
730730
# }
731731
```
732732
733-
The generated `merged_crd` method is a wrapper around [kube's `merge_crds`][1]
733+
The generated `merged_crd` method is a wrapper around [kube's `merge_crds`][2]
734734
function. It automatically calls the `crd` methods of the CRD in all of its
735735
versions and additionally provides a strongly typed selector for the stored
736736
API version.
@@ -846,6 +846,9 @@ mod v1 {
846846
It is possible to include structs and enums which are not CRDs. They are instead
847847
versioned as expected (without adding the `#[kube]` derive macro and generating
848848
code to merge CRD versions).
849+
850+
[1]: https://docs.rs/schemars/latest/schemars/derive.JsonSchema.html
851+
[2]: https://docs.rs/kube/latest/kube/core/crd/fn.merge_crds.html
849852
"#
850853
)]
851854
#[proc_macro_attribute]

0 commit comments

Comments
 (0)